Skip to content
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

fix(chat): Fix error if no recent models set (Issue #2653) #2729

Merged
merged 9 commits into from
Dec 4, 2024
9 changes: 8 additions & 1 deletion apps/chat/src/store/models/models.epics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,21 @@ const getInstalledModelIdsFailEpic: AppEpic = (action$, state$) =>
const recentModelIds = ModelsSelectors.selectRecentModelsIds(
state$.value,
);
const availableModels = ModelsSelectors.selectModels(state$.value);
const firstAvailableModelId = availableModels[0].id;
denys-kolomiitsev marked this conversation as resolved.
Show resolved Hide resolved

const modelsToInstall = recentModelIds.length
? recentModelIds
: defaultModelIds;

const installCandidates = [...myAppIds, ...modelsToInstall];
const agentsToInstall = installCandidates.length
? installCandidates
: [firstAvailableModelId];

return of(
ModelsActions.addInstalledModels({
references: [...myAppIds, ...modelsToInstall],
references: [...agentsToInstall],
denys-kolomiitsev marked this conversation as resolved.
Show resolved Hide resolved
}),
);
}),
Expand Down
Loading