BEAM: selfish when solo.

This commit is contained in:
Enrico Ros
2025-03-16 01:57:30 -07:00
parent 7305c9d354
commit 85ac64dea1
+4 -4
View File
@@ -40,7 +40,7 @@ export function createBRayEmpty(llmId: DLLMId | null): BRay {
};
}
function rayScatterStart(ray: BRay, llmId: DLLMId | null, inputHistory: DMessage[], onlyIdle: boolean, scatterStore: ScatterStoreSlice): BRay {
function rayScatterStart(ray: BRay, llmId: DLLMId | null, inputHistory: DMessage[], onlyIdle: boolean, playNice: boolean, scatterStore: ScatterStoreSlice): BRay {
if (ray.genAbortController)
return ray;
if (onlyIdle && ray.status !== 'empty')
@@ -79,7 +79,7 @@ function rayScatterStart(ray: BRay, llmId: DLLMId | null, inputHistory: DMessage
scatterSystemInstruction,
scatterInputHistory,
'beam-scatter', ray.rayId,
{ abortSignal: abortController.signal, throttleParallelThreads: getUXLabsHighPerformance() ? 0 : rays.length },
{ abortSignal: abortController.signal, throttleParallelThreads: getUXLabsHighPerformance() ? 0 : !playNice ? 1 : rays.length },
onMessageUpdated,
)
.then((status) => {
@@ -311,7 +311,7 @@ export const createScatterSlice: StateCreator<RootStoreSlice & ScatterStoreSlice
const { inputHistory } = _get();
_set(state => ({
// Start all rays
rays: state.rays.map(ray => rayScatterStart(ray, ray.rayLlmId, inputHistory || [], false, _get())),
rays: state.rays.map(ray => rayScatterStart(ray, ray.rayLlmId, inputHistory || [], false, true, _get())),
}));
_get()._syncRaysStateToScatter();
},
@@ -328,7 +328,7 @@ export const createScatterSlice: StateCreator<RootStoreSlice & ScatterStoreSlice
_rayUpdate(rayId, (ray) =>
ray.status === 'scattering'
? /* User Terminated the ray */ rayScatterStop(ray)
: /* User Started the ray */ rayScatterStart(ray, ray.rayLlmId, inputHistory || [], false, _get()),
: /* User Started the ray */ rayScatterStart(ray, ray.rayLlmId, inputHistory || [], false, false, _get()),
);
_syncRaysStateToScatter();
},