Skip to content

Commit

Permalink
fix(chat): Fix error if no recent models set (Issue #2653) (#2729)
Browse files Browse the repository at this point in the history
  • Loading branch information
denys-kolomiitsev authored Dec 4, 2024
1 parent feb2828 commit b504407
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 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,23 @@ const getInstalledModelIdsFailEpic: AppEpic = (action$, state$) =>
const recentModelIds = ModelsSelectors.selectRecentModelsIds(
state$.value,
);
const availableModels = ModelsSelectors.selectModels(state$.value);
const fallbackModels = availableModels?.[0]?.reference
? [availableModels[0].reference]
: [];

const modelsToInstall = recentModelIds.length
? recentModelIds
: defaultModelIds;

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

return of(
ModelsActions.addInstalledModels({
references: [...myAppIds, ...modelsToInstall],
references: agentsToInstall,
}),
);
}),
Expand Down

0 comments on commit b504407

Please sign in to comment.