Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/epam/ai-dial-chat in…
Browse files Browse the repository at this point in the history
…to fix/2882-app-version
  • Loading branch information
Magomed-Elbi Dzhukalaev committed Jan 7, 2025
2 parents 36a5e07 + 3a65e77 commit 40b684b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
15 changes: 2 additions & 13 deletions apps/chat-e2e/src/tests/overlay/modelIdFeature.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { GeneratorUtil, ModelsUtil } from '@/src/utils';
import { expect } from '@playwright/test';

const expectedModelId = 'gpt-4';
const fallbackModelId = 'gpt-35-turbo';

dialOverlayTest(
`[Overlay] Defaults set in the code: modelID is used for new conversation.\n` +
Expand All @@ -26,22 +25,12 @@ dialOverlayTest(
overlayAgentInfoAssertion,
talkToAgentDialogAssertion,
setTestIds,
localStorageManager,
}) => {
setTestIds('EPMRTC-3781', 'EPMRTC-4693');
const randomAgentRequest = 'test';
const recentModelIds = ModelsUtil.getRecentModelIds().filter(
(m) => m !== expectedModelId,
const randomModelId = GeneratorUtil.randomArrayElement(
ModelsUtil.getRecentModelIds().filter((m) => m !== expectedModelId),
);
if (!recentModelIds.length) {
// recentModelIds can be empty
await localStorageManager.setRecentModelsIds(
ModelsUtil.getModel(fallbackModelId)!,
);
}
const randomModelId = recentModelIds.length
? GeneratorUtil.randomArrayElement(recentModelIds)
: fallbackModelId;
const randomModel = ModelsUtil.getOpenAIEntity(randomModelId)!;

const expectedModel = ModelsUtil.getModel(expectedModelId)!;
Expand Down
36 changes: 21 additions & 15 deletions apps/chat/src/store/overlay/overlay.epics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,21 +415,27 @@ const setOverlayOptionsEpic: AppEpic = (action$, state$) =>
}
}

if (modelId) {
actions.push(of(ModelsActions.updateRecentModels({ modelId })));
const shouldLogIn = AuthSelectors.selectIsShouldLogin(state$.value);

actions.push(
of(
SettingsActions.setOverlayDefaultModelId({
overlayDefaultModelId: modelId,
}),
),
);
}
if (overlayConversationId) {
actions.push(
of(SettingsActions.setOverlayConversationId(overlayConversationId)),
);
if (!shouldLogIn) {
if (modelId) {
actions.push(of(ModelsActions.updateRecentModels({ modelId })));

actions.push(
of(
SettingsActions.setOverlayDefaultModelId({
overlayDefaultModelId: modelId,
}),
),
);
}
if (overlayConversationId) {
actions.push(
of(
SettingsActions.setOverlayConversationId(overlayConversationId),
),
);
}
}

// after all actions will send notify that settings are set
Expand All @@ -439,7 +445,7 @@ const setOverlayOptionsEpic: AppEpic = (action$, state$) =>
),
of(OverlayActions.signInOptionsSet({ signInOptions })),
iif(
() => !AuthSelectors.selectIsShouldLogin(state$.value),
() => !shouldLogIn,
of(ConversationsActions.initSelectedConversations()),
EMPTY,
),
Expand Down

0 comments on commit 40b684b

Please sign in to comment.