mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
BEAM: selfish when solo.
This commit is contained in:
@@ -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();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user