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:调工具失败后不显示loading图标
douran40569300c9bc
diff --git a/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx b/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsxindex 16861acbdc..900d39a311 100644--- a/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx+++ b/jiuwenclaw/web/src/components/ChatPanel/ToolGroupDisplay.tsx@@ -35,6 +35,8 @@ function ToolDetailModal({ execution, onClose }: ToolDetailModalProps) {const isTimeout = status === 'timeout';const isError = status === 'error';const isSuccess = status === 'completed' && !(result && result.result && result.result.includes('success=False'));+ const hasResult = !!result;+ const isFailed = hasResult && !isSuccess && !isTimeout;// ESC 键关闭@@ -73,28 +75,28 @@ function ToolDetailModal({ execution, onClose }: ToolDetailModalProps) {}}><div className="flex items-center gap-4">- <span className={clsx(- 'tool-pair-icon',- isSuccess ? 'success' : isError ? 'error' : isTimeout ? 'warning' : 'pending'- )}- style={{ width: '32px', height: '32px' }}- >- {isSuccess ? (- <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>- <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />- </svg>- ) : isError ? (- '❌'- ) : 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" />- </svg>- ) : (- <svg className="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>- <path strokeLinecap="round" strokeLinejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />- </svg>+ {!isFailed && !isError && (+ <span className={clsx(+ 'tool-pair-icon',+ isSuccess ? 'success' : isTimeout ? 'warning' : 'pending')}- </span>+ style={{ width: '32px', height: '32px' }}+ >+ {isSuccess ? (+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>+ <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />+ </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" />+ </svg>+ ) : (+ <svg className="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>+ <path strokeLinecap="round" strokeLinejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />+ </svg>+ )}+ </span>+ )}<div><h2className="text-lg font-semibold font-mono"@@ -261,6 +263,7 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {const isTimeout = status === 'timeout';const isError = status === 'error';const isSuccess = status === 'completed' && !(result && result.result && result.result.includes('success=False'));+ const isFailed = hasResult && !isSuccess && !isTimeout;const resultSummary = result? (result.summary || (isSuccess ? t('chatUi.toolResult.success') : '❌')): '';@@ -274,28 +277,26 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {data-tool-status={status}><div className="tool-pair-header" onClick={() => setShowModal(true)}>- <span className={clsx(- 'tool-pair-icon',- isSuccess ? 'success' : isError ? 'error' : isTimeout ? 'warning' : 'pending'- )}>- {isSuccess ? (- <svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>- <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />- </svg>- ) : isError ? (- <svg className="w-3 h-3" 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-3 h-3" 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" />- </svg>- ) : (- <svg className="w-3 h-3 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>- <path strokeLinecap="round" strokeLinejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />- </svg>- )}- </span>+ {!isFailed && !isError && (+ <span className={clsx(+ 'tool-pair-icon',+ isSuccess ? 'success' : isTimeout ? 'warning' : 'pending'+ )}>+ {isSuccess ? (+ <svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>+ <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />+ </svg>+ ) : isTimeout ? (+ <svg className="w-3 h-3" 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" />+ </svg>+ ) : (+ <svg className="w-3 h-3 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24" strokeWidth={2}>+ <path strokeLinecap="round" strokeLinejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />+ </svg>+ )}+ </span>+ )}{toolCall.name === 'session' ? (<span className="tool-pair-name">{subtitle || t('chatUi.toolGroup.sessionCompleted')}</span>@@ -309,7 +310,7 @@ export function ToolExecutionItem({ execution }: { execution: ToolExecution }) {{hasResult && (<span className={clsx('tool-pair-result-badge',- result.success ? 'success' : 'error'+ isSuccess ? 'success' : 'error')}>{resultSummary}</span>