mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Don't emit unnecessary streamingUpdate events
This commit is contained in:
1 file changed
+2
-2
@@ -508,12 +508,12 @@ export class SessionManager {
|
||||
accumulatedToolCalls.set(index, toolCall);
|
||||
}
|
||||
|
||||
if (session.streamingMessage) {
|
||||
if (session.streamingMessage && accumulatedToolCalls.size > 0) {
|
||||
const sortedToolCalls = [...accumulatedToolCalls.entries()]
|
||||
.sort((a, b) => a[0] - b[0])
|
||||
.map(entry => entry[1]);
|
||||
|
||||
session.streamingMessage.tool_calls = sortedToolCalls.length > 0 ? sortedToolCalls : undefined;
|
||||
session.streamingMessage.tool_calls = sortedToolCalls;
|
||||
this.emit('streamingUpdate', projectId, session.streamingMessage.content, session.streamingMessage.reasoning_content, session.streamingMessage.tool_calls);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user