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:1.切换任务时中断当前任务2.工具调用弹窗错误显示
douran5e0b3275db7c
diff --git a/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx b/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsxindex e960236b2b..4f4bd61877 100644--- a/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx@@ -34,7 +34,7 @@ function ToolDetailModal({ execution, onClose }: ToolDetailModalProps) {const { toolCall, result, status } = execution;const isTimeout = status === 'timeout';const isError = status === 'error';- const isSuccess = status === 'completed';+ const isSuccess = status === 'completed' && !(result && result.result && result.result.includes('success=False'));// ESC 键关闭@@ -84,9 +84,7 @@ function ToolDetailModal({ execution, onClose }: ToolDetailModalProps) {<path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" /></svg>) : isError ? (- <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>- <path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />- </svg>+ '❌') : isTimeout ? (<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v4m0 4h.01M12 3C7.029 3 3 7.029 3 12s4.029 9 9 9 9-4.029 9-9-4.029-9-9-9z" />@@ -174,14 +172,18 @@ function ToolDetailModal({ execution, onClose }: ToolDetailModalProps) {<div><divclassName="flex items-center gap-2 mb-3"- style={{ color: result.success ? 'var(--ok)' : 'var(--danger)' }}+ style={{ color: result.success && !(result.result && result.result.includes('success=False')) ? 'var(--ok)' : 'var(--danger)' }}>- <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>- <path strokeLinecap="round" strokeLinejoin="round" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />- </svg>+ {result.success && !(result.result && result.result.includes('success=False')) ? (+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />+ </svg>+ ) : (+ '❌'+ )}<span className="text-sm font-semibold">{t('chatUi.toolResult.result')}- {!result.success && (+ {(!result.success || (result.result && result.result.includes('success=False'))) && (<spanclassName="ml-2 px-2 py-0.5 rounded text-xs font-medium"style={{@@ -202,7 +204,7 @@ function ToolDetailModal({ execution, onClose }: ToolDetailModalProps) {lineHeight: '1.5',backgroundColor: 'var(--bg-elevated)',border: '1px solid var(--border)',- color: result.success ? 'var(--text)' : 'var(--danger)',+ color: result.success && !(result.result && result.result.includes('success=False')) ? 'var(--text)' : 'var(--danger)',wordBreak: 'break-word',}}>diff --git a/jiuwenclaw/web/src/hooks/useWebSocket.ts b/jiuwenclaw/web/src/hooks/useWebSocket.tsindex c67aa62486..4655d0933c 100644--- a/jiuwenclaw/web/src/hooks/useWebSocket.ts+++ b/jiuwenclaw/web/src/hooks/useWebSocket.ts@@ -400,6 +400,13 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {// 切换模式const switchMode = useCallback(async (sessionId: string, mode: AgentMode) => {+ if (sessionId && sessionId !== 'new') {+ try {+ await interrupt(sessionId, 'cancel');+ } catch {+ // 忽略中断错误,继续切换模式+ }+ }setProcessing(false);setThinking(false);setMode(mode);@@ -407,7 +414,7 @@ export function useWebSocket(options: UseWebSocketOptions): UseWebSocketReturn {updateSession(sessionId, { mode });}},- [setMode, updateSession, setProcessing, setThinking]+ [setMode, updateSession, setProcessing, setThinking, interrupt]);// 发送用户回答