Skip to content

feat(chat): change available agent error message ( Issue #4034) #4045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 69 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0b17999
feat(chat): change available agent error message (#4034)
Derikyan Jun 6, 2025
e11359c
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 6, 2025
485efe8
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 6, 2025
a21beab
test updates
nartovm Jun 6, 2025
bfe5bdc
style fix
Derikyan Jun 7, 2025
d5125c0
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 9, 2025
ff17490
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 9, 2025
53e6f73
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 9, 2025
710bc72
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 9, 2025
9337b4d
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 9, 2025
893d249
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 9, 2025
c6926fc
Merge branch 'development' into fix/4034-available-agent-error-message
nartovm Jun 9, 2025
5570d16
compare mode error displaying
Derikyan Jun 11, 2025
699eff2
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 11, 2025
555029b
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 11, 2025
77ab9d8
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 11, 2025
184844d
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 11, 2025
db8b047
tests update
nartovm Jun 12, 2025
dfad68f
Merge branch 'development' into fix/4034-available-agent-error-message
nartovm Jun 12, 2025
4e4ee21
test updates
nartovm Jun 12, 2025
28686fc
Merge branch 'development' into fix/4034-available-agent-error-message
nartovm Jun 12, 2025
17a3c52
fix tests
nartovm Jun 12, 2025
b1c1d6a
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
nartovm Jun 12, 2025
6191f4f
Merge branch 'development' into fix/4034-available-agent-error-message
nartovm Jun 12, 2025
4cd0a80
An attempt to make the exportImportTest work on the review env
nartovm Jun 12, 2025
801b3d6
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 13, 2025
b4e5de3
refactor
Derikyan Jun 13, 2025
f711f8c
fix/4034-available-agent-error-message: reverted test changes
irinakartun Jun 13, 2025
daf5c97
fix
Derikyan Jun 13, 2025
4761158
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 13, 2025
39ebadd
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 13, 2025
76ab3c6
fix
Derikyan Jun 13, 2025
3848b99
fix
Derikyan Jun 14, 2025
f5c4758
add redux state
Derikyan Jun 14, 2025
c2759c5
fix
Derikyan Jun 15, 2025
bec85d6
fix
Derikyan Jun 16, 2025
0a00266
an attempt to fix the test
nartovm Jun 16, 2025
27c9a33
tests
nartovm Jun 16, 2025
87e9eaf
reduce latency
Derikyan Jun 16, 2025
445e5e5
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 16, 2025
b0b27b6
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 16, 2025
41b42c0
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 16, 2025
5bda1ea
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 16, 2025
b004fc5
fix styleing
Derikyan Jun 16, 2025
0626b3b
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 16, 2025
9df9983
revert test changes
nartovm Jun 17, 2025
136e8cd
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 17, 2025
d267524
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 17, 2025
95151ef
Merge branch 'development' into fix/4034-available-agent-error-message
nartovm Jun 17, 2025
5b4a8ec
Merge branch 'development' into fix/4034-available-agent-error-message
nartovm Jun 18, 2025
a9924e6
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 18, 2025
860adef
fix
Derikyan Jun 18, 2025
ad8c2cd
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 18, 2025
b7ef0c0
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 18, 2025
bdb7a79
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 18, 2025
c7e973c
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 18, 2025
b0d8477
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 18, 2025
0a995c8
code refactoring
Derikyan Jun 18, 2025
325e797
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Derikyan Jun 18, 2025
4e96a5c
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 18, 2025
067dde0
Merge branch 'fix/4034-available-agent-error-message' of https://gith…
Derikyan Jun 18, 2025
9dfd8ab
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 19, 2025
6118904
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 19, 2025
68720b2
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 19, 2025
6b217d5
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 20, 2025
972fcd3
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 23, 2025
a82d6f2
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 23, 2025
2f292ed
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 24, 2025
2f017c4
Merge branch 'development' into fix/4034-available-agent-error-message
Derikyan Jun 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/assertions/chatAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export class ChatAssertion extends BaseAssertion {
await this.assertElementState(changeAgentButton, expectedState);
}

public async assertNotAllowedModelLabelContent() {
public async assertNotAllowedModelLabelContent(model: string) {
await this.assertElementText(
this.chat.notAllowedModelLabel,
ExpectedConstants.notAllowedModelError,
ExpectedConstants.notAllowedAgentError(model),
ExpectedMessages.notAllowedModelErrorDisplayed,
);
}
Expand Down
2 changes: 2 additions & 0 deletions apps/chat-e2e/src/testData/expectedConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const ExpectedConstants = {
noResults: 'No results found',
notAllowedModelError:
'Not available agent selected. Please, change the agent to proceed',
notAllowedAgentError: (agent: string) =>
`Agent is not available. Please, change the agent "${agent}" to proceed.`,
replayAsIsDescr:
'This mode replicates user requests from the original conversation including settings set in each message.',
replayOldVersionWarning:
Expand Down
12 changes: 7 additions & 5 deletions apps/chat-e2e/src/tests/chatExportImportWithAttachment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ dialTest(
chatBar,
confirmationDialog,
chatMessages,
chatMessagesAssertion,
toast,
chat,
chatHeader,
talkToAgentDialog,
Expand Down Expand Up @@ -352,12 +354,12 @@ dialTest(
simpleRequestModel,
marketplacePage,
);
await toast.closeToast();
await dialHomePage.mockChatTextResponse(
MockedChatApiResponseBodies.simpleTextBody,
);
await chat.sendRequestWithButton('1+2=');
const messagesCount =
await chatMessages.chatMessages.getElementsCount();
expect
.soft(messagesCount, ExpectedMessages.messageCountIsCorrect)
.toBe(6);
await chatMessagesAssertion.assertMessagesCount(6);
}
},
);
Expand Down
2 changes: 1 addition & 1 deletion apps/chat-e2e/src/tests/replay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ dialTest(
);
//TODO: add conversation screen verification when fixed https://github.com/epam/ai-dial-chat/issues/2697
await chatAssertion.assertReplayButtonState('hidden');
await chatAssertion.assertNotAllowedModelLabelContent();
await chatAssertion.assertNotAllowedModelLabelContent(notAllowedModel);
},
);

Expand Down
4 changes: 3 additions & 1 deletion apps/chat-e2e/src/tests/talkToAgentCard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,9 @@ dialTest(
await dialHomePage.reloadPage();
await dialHomePage.waitForPageLoaded();
await conversations.selectEntity(conversation.name);
await chatAssertion.assertNotAllowedModelLabelContent();
await chatAssertion.assertNotAllowedModelLabelContent(
conversation.model.id,
);
},
);

Expand Down
4 changes: 3 additions & 1 deletion apps/chat-e2e/src/tests/usePromptNewConversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ dialTest(
await dialHomePage.openHomePage();
await dialHomePage.waitForPageLoaded();
await conversations.selectEntity(conversationWithNonExistentApp.name);
await chatAssertion.assertNotAllowedModelLabelContent(); // Assert error message
await chatAssertion.assertNotAllowedModelLabelContent(
nonExistentAppName,
); // Assert error message
},
);

Expand Down
4 changes: 2 additions & 2 deletions apps/chat-e2e/src/ui/webElements/baseElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export class BaseElement {
return this.rootLocator.boundingBox();
}

async isElementEnabled() {
return this.rootLocator.isEnabled();
async isElementEnabled(options?: { timeout?: number }) {
return this.rootLocator.isEnabled(options);
}

async scrollIntoElementView() {
Expand Down
4 changes: 3 additions & 1 deletion apps/chat/public/locales/en/chat.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"chat.error.incorrect-selected_addon": "Not allowed addon selected. Please, change the addon to proceed",
"chat.error.incorrect-selected_model": "Not available agent selected. Please, change the agent to proceed"
"chat.error.incorrect-selected_model": "Not available agent selected. Please, change the agent to proceed",
"chat.error.agent-not-available": "Agent is not available. Please, {{click}} {{agentId}} to proceed.",
"chat.error.agents-not-available": "Agents are not available. Please, change the agents {{agentId}} and {{agentId}} to proceed."
}
74 changes: 19 additions & 55 deletions apps/chat/src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import { clearStateForMessages } from '@/src/utils/app/clear-messages-state';
import {
excludeSystemMessages,
getConversationModelParams,
isReplayAsIsConversation,
isReplayConversation,
} from '@/src/utils/app/conversation';
import {
isConversationWithFormSchema,
Expand All @@ -32,7 +30,6 @@ import { is4XLScreen } from '@/src/utils/app/mobile';
import { doesModelHaveConfiguration } from '@/src/utils/app/models';
import { isEntityReadOnly } from '@/src/utils/app/permissions';

import { ApplicationStatus } from '@/src/types/applications';
import {
Conversation,
ConversationsTemporarySettings,
Expand Down Expand Up @@ -99,10 +96,8 @@ const ChatView = memo(() => {
const dispatch = useAppDispatch();
const router = useRouter();

const models = useAppSelector(ModelsSelectors.selectModels);
const modelsMap = useAppSelector(ModelsSelectors.selectModelsMap);
const modelError = useAppSelector(ModelsSelectors.selectModelsError);
const areModelsLoaded = useAppSelector(ModelsSelectors.selectAreModelsLoaded);
const addonsMap = useAppSelector(AddonsSelectors.selectAddonsMap);
const isCompareMode = useAppSelector(UISelectors.selectIsCompareMode);
const selectedConversationsIds = useAppSelector(
Expand Down Expand Up @@ -216,60 +211,27 @@ const ChatView = memo(() => {
installedModelIds.has(conv.model.id),
);

const notAllowedItemsForDisplay = useAppSelector(
ConversationsSelectors.selectNotAllowedItemsForDisplay,
);

const isNotAllowed = useAppSelector(
ConversationsSelectors.selectIsNotAllowed,
);

const hasNotAllowedAddons = useAppSelector(
ConversationsSelectors.selectHasNotAllowedAddons,
);

useLayoutEffect(() => {
const isNotAllowedModel =
areModelsLoaded &&
(models.length === 0 ||
selectedConversations.some((conv) => {
if (
isReplayConversation(conv) &&
isReplayAsIsConversation(conv) &&
conv.replay?.replayUserMessagesStack &&
conv.replay?.replayUserMessagesStack[0].model
) {
return conv.replay.replayUserMessagesStack.some(
(message) =>
message.role === Role.User &&
message.model?.id &&
!modelsMap[message.model.id],
);
}

const model = modelsMap[conv.model.id];
const isNotDeployedCustomApp =
model &&
model.type === EntityType.Application &&
model.functionStatus &&
model?.functionStatus !== ApplicationStatus.DEPLOYED;

return (
!model ||
isNotDeployedCustomApp ||
(model.type === EntityType.Assistant &&
conv.assistantModelId &&
!modelsMap[conv.assistantModelId])
);
}));

if (isNotAllowedModel) {
if (isNotAllowed) {
dispatch(ChatActions.setNotAvailableEntityType(EntityType.Model));
} else if (
selectedConversations.some((conversation) =>
conversation.selectedAddons.some((addonId) => !addonsMap[addonId]),
)
) {
} else if (hasNotAllowedAddons) {
dispatch(ChatActions.setNotAvailableEntityType(EntityType.Addon));
} else {
dispatch(ChatActions.setNotAvailableEntityType(undefined));
}
}, [
selectedConversations,
models,
areModelsLoaded,
addonsMap,
modelsMap,
dispatch,
]);
}, [dispatch, isNotAllowed, hasNotAllowedAddons]);

const onLikeHandler = useCallback(
(index: number, conversation: Conversation) => (rate: LikeState) => {
Expand Down Expand Up @@ -887,12 +849,14 @@ const ChatView = memo(() => {
</div>
</div>
{!isPlayback &&
!selectedPublicationUrl &&
notAvailableEntityType &&
!selectedPublicationUrl ? (
notAllowedItemsForDisplay.length ? (
<NotAllowedModel
showScrollDownButton={isScrollDownButton}
onScrollDownClick={handleScrollDown}
type={notAvailableEntityType}
notAllowedItemsForDisplay={notAllowedItemsForDisplay}
onShowChangeModel={handleTalkToConversationId}
/>
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { withRenderForScreen } from '@/src/components/Common/ScreenRender';

function ChatInputFooterView() {
return (
<div className="p-5 empty:hidden max-md:hidden">
<div className="px-5 pb-5 empty:hidden max-md:hidden">
<FooterMessage />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const ChatInputMessage = Inversify.register(
const isChatInputDisabled = useAppSelector(
ConversationsSelectors.selectIsSelectedConversationBlocksInput,
);

const configurationSchema = useAppSelector(
ChatSelectors.selectConfigurationSchema,
);
Expand Down Expand Up @@ -493,6 +494,11 @@ export const ChatInputMessage = Inversify.register(
return t('Talk to your agent');
}, [isChatInputDisabled, t]);

const isDisabled = useMemo(
() => isLoading || isChatInputDisabled,
[isLoading, isChatInputDisabled],
);

const paddingLeftClass = canAttach
? isOverlay
? 'pl-11'
Expand Down Expand Up @@ -521,7 +527,7 @@ export const ChatInputMessage = Inversify.register(
)}
maxHeight={MAX_HEIGHT}
placeholder={chatInputPlaceholder}
disabled={isLoading || isChatInputDisabled}
disabled={isDisabled}
value={content}
rows={1}
onCompositionStart={() => setIsTyping(true)}
Expand Down
Loading
Loading