mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
refactor: centralize tool status symbols in constants (#7054)
This commit is contained in:
parent
83a40ff9d4
commit
4c3ec1f0cc
3 changed files with 28 additions and 14 deletions
|
|
@ -13,6 +13,7 @@ import type {
|
|||
Config,
|
||||
ToolCallConfirmationDetails,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { TOOL_STATUS } from '../../constants.js';
|
||||
|
||||
// Mock child components to isolate ToolGroupMessage behavior
|
||||
vi.mock('./ToolMessage.js', () => ({
|
||||
|
|
@ -29,14 +30,16 @@ vi.mock('./ToolMessage.js', () => ({
|
|||
status: ToolCallStatus;
|
||||
emphasis: string;
|
||||
}) {
|
||||
const statusSymbol = {
|
||||
[ToolCallStatus.Success]: '✓',
|
||||
[ToolCallStatus.Pending]: 'o',
|
||||
[ToolCallStatus.Executing]: '⊷',
|
||||
[ToolCallStatus.Confirming]: '?',
|
||||
[ToolCallStatus.Canceled]: '-',
|
||||
[ToolCallStatus.Error]: 'x',
|
||||
}[status];
|
||||
// Use the same constants as the real component
|
||||
const statusSymbolMap: Record<ToolCallStatus, string> = {
|
||||
[ToolCallStatus.Success]: TOOL_STATUS.SUCCESS,
|
||||
[ToolCallStatus.Pending]: TOOL_STATUS.PENDING,
|
||||
[ToolCallStatus.Executing]: TOOL_STATUS.EXECUTING,
|
||||
[ToolCallStatus.Confirming]: TOOL_STATUS.CONFIRMING,
|
||||
[ToolCallStatus.Canceled]: TOOL_STATUS.CANCELED,
|
||||
[ToolCallStatus.Error]: TOOL_STATUS.ERROR,
|
||||
};
|
||||
const statusSymbol = statusSymbolMap[status] || '?';
|
||||
return (
|
||||
<Text>
|
||||
MockTool[{callId}]: {statusSymbol} {name} - {description} ({emphasis})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue