fix: address PR review comments from a7m-1st

- Add is_final field to AgentMessage type in chatbox.d.ts
- Simplify chatStore.ts streaming handler (remove type cast, use currentTaskId)
- Use deep copy for model_config_dict to ensure isolation between cloned agents
This commit is contained in:
mkdev11 2026-01-24 00:37:17 +01:00
parent 9edb54878f
commit 8a44f386a6
3 changed files with 8 additions and 6 deletions

View file

@ -1,5 +1,6 @@
import asyncio
import contextvars
import copy
import json
import os
import platform
@ -835,8 +836,9 @@ class ListenChatAgent(ChatAgent):
new_agent.process_task_id = self.process_task_id
# Preserve model_config_dict (including stream setting) from original agent
# Use deep copy to ensure isolation - nested dicts won't affect other agents
if hasattr(self, 'model_backend') and hasattr(self.model_backend, 'model_config_dict'):
new_agent.model_backend.model_config_dict.update(self.model_backend.model_config_dict)
new_agent.model_backend.model_config_dict = copy.deepcopy(self.model_backend.model_config_dict)
# Copy memory if requested
if with_memory:

View file

@ -849,18 +849,16 @@ const chatStore = (initial?: Partial<ChatStore>) => createStore<ChatStore>()(
// Handle streaming agent output during task execution
if (agentMessages.step === "streaming_agent_output") {
const data = agentMessages.data as { process_task_id?: string; content?: string; is_final?: boolean };
const { process_task_id, content, is_final } = data;
const currentId = getCurrentTaskId();
const { process_task_id, content, is_final } = agentMessages.data;
if (!process_task_id) return;
if (is_final) {
// Clear streaming output when final marker received
clearStreamingAgentOutput(currentId, process_task_id);
clearStreamingAgentOutput(currentTaskId, process_task_id);
} else if (content) {
// Append streaming content
updateStreamingAgentOutput(currentId, process_task_id, content);
updateStreamingAgentOutput(currentTaskId, process_task_id, content);
}
return;
}

View file

@ -127,6 +127,8 @@ declare global {
current_length?: number;
max_length?: number;
text?: string;
// Streaming agent output
is_final?: boolean;
};
status?: 'running' | 'filled' | 'completed';
}