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/1335-move-error-select-folder-window
  • Loading branch information
Derikyan committed Jan 7, 2025
2 parents 2ece418 + 84bd78c commit cc86313
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 84 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
99 changes: 44 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"lodash-es": "^4.17.21",
"micromark-util-sanitize-uri": "^2.0.1",
"mime-types": "^2.1.35",
"next": "14.2.17",
"next": "14.2.22",
"next-auth": "^4.24.10",
"next-i18next": "^13.2.2",
"node-fetch": "^3.3.2",
Expand Down

0 comments on commit cc86313

Please sign in to comment.