JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(session): modify session cannot be stopped bug
iamcandiceguo7e5e0a5bfae2
diff --git a/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts b/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.tsindex 4d8a9917bc..e0b83b011c 100644--- a/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts+++ b/jiuwenswarm/channels/web/frontend/src/hooks/useWebSocket.ts@@ -1135,10 +1135,12 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {session_id: sessionId,intent,};- if (useSessionStore.getState().mode === 'team'- && ['pause', 'resume', 'cancel', 'supplement'].includes(intent)) {- params.mode = 'team';- params.team = true;+ const currentMode = useSessionStore.getState().mode;+ if (['pause', 'resume', 'cancel', 'supplement'].includes(intent)) {+ params.mode = currentMode;+ if (currentMode === 'team') {+ params.team = true;+ }}if (intent === 'supplement') {params.new_input = newInput ?? '';diff --git a/jiuwenswarm/gateway/message_handler/message_handler.py b/jiuwenswarm/gateway/message_handler/message_handler.pyindex 82b324db8b..e009034bbb 100644--- a/jiuwenswarm/gateway/message_handler/message_handler.py+++ b/jiuwenswarm/gateway/message_handler/message_handler.py@@ -3220,11 +3220,10 @@ class MessageHandler(ABC):)elif intent == "cancel":- # 使用 fire_and_forget 模式,避免 await AgentServer 响应阻塞 _forward_loop,+ # 使用 await 模式,若cancel过长时间可能导致session残余# 导致后续 session.create 等请求在队列中等待超时await self._cancel_agent_work_for_session(- msg, msg.session_id,- agent_notify="fire_and_forget",+ msg, msg.session_id)elif intent in ("pause", "resume"):