Beam: remove fallbackLlmId

This commit is contained in:
Enrico Ros
2024-04-22 01:01:33 -07:00
parent 5bb11249d6
commit e1ec56a120
2 changed files with 5 additions and 7 deletions
+2 -2
View File
@@ -178,7 +178,7 @@ export const createScatterSlice: StateCreator<RootStoreSlice & ScatterStoreSlice
setRayCount: (count: number) => {
const { rays, fallbackLlmId, _syncRaysStateToScatter } = _get();
const { rays, _syncRaysStateToScatter } = _get();
if (count < rays.length) {
// Terminate exceeding rays
rays.slice(count).forEach(rayScatterStop);
@@ -189,7 +189,7 @@ export const createScatterSlice: StateCreator<RootStoreSlice & ScatterStoreSlice
_set({
rays: [...rays, ...Array(count - rays.length).fill(null)
// Create missing rays, copying the llmId of the former Ray, or using the fallback
.map(() => createBRay(rays[rays.length - 1]?.rayLlmId || fallbackLlmId)),
.map(() => createBRay(rays[rays.length - 1]?.rayLlmId || null)),
],
});
}
+3 -5
View File
@@ -42,7 +42,6 @@ const initRootStateSlice = (): RootStateSlice => ({
isOpen: false,
isMaximized: false,
fallbackLlmId: null,
inputHistory: null,
inputIssues: null,
inputReady: false,
@@ -68,7 +67,7 @@ const createRootSlice: StateCreator<BeamStore, [], [], RootStoreSlice> = (_set,
...initRootStateSlice(),
open: (chatHistory: Readonly<DMessage[]>, fallbackLlmId: DLLMId | null, callback: BeamSuccessCallback) => {
open: (chatHistory: Readonly<DMessage[]>, initialChatLlmId: DLLMId | null, callback: BeamSuccessCallback) => {
const { isOpen: wasAlreadyOpen, terminateKeepingSettings, setRayLlmIds } = _get();
// reset pending operations
@@ -82,7 +81,6 @@ const createRootSlice: StateCreator<BeamStore, [], [], RootStoreSlice> = (_set,
_set({
// input
isOpen: true,
fallbackLlmId: fallbackLlmId,
inputHistory: isValidHistory ? history : null,
inputIssues: isValidHistory ? null : 'Invalid history',
inputReady: isValidHistory,
@@ -91,8 +89,8 @@ const createRootSlice: StateCreator<BeamStore, [], [], RootStoreSlice> = (_set,
// rays already reset
// update the model only if the dialog was not already open
...(!wasAlreadyOpen && fallbackLlmId && {
currentGatherLlmId: fallbackLlmId,
...(!wasAlreadyOpen && initialChatLlmId && {
currentGatherLlmId: initialChatLlmId,
} satisfies Partial<GatherStoreSlice>),
});
},