fix(ui): stabilize tool header icons and mcp completion label

This commit is contained in:
JOJO 2026-04-27 15:51:52 +08:00
parent 9d8beacc8d
commit bb6bfff176
2 changed files with 32 additions and 1 deletions

View File

@ -594,10 +594,12 @@
.arrow {
width: 16px;
min-width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 16px;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
color: var(--claude-text-secondary);
}
@ -618,7 +620,7 @@
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
flex: 0 0 20px;
}
.captured-status {

View File

@ -145,6 +145,30 @@ function describeReadFileResult(tool: any): string {
return '文件读取完成';
}
function isMcpTool(tool: any): boolean {
const name = String(tool?.name || '');
return name.startsWith('mcp__');
}
function getMcpToolDisplayName(tool: any): string {
const customDisplayName = String(tool?.display_name || '').trim();
if (customDisplayName) {
return customDisplayName;
}
const name = String(tool?.name || '').trim();
if (!name.startsWith('mcp__')) {
return name || 'MCP 工具';
}
const parts = name.split('__').filter(Boolean);
if (parts.length >= 3) {
const remoteName = parts.slice(2).join('__').trim();
if (remoteName) {
return remoteName;
}
}
return name || 'MCP 工具';
}
export function getToolStatusText(tool: any, opts?: { intentEnabled?: boolean }): string {
if (!tool) {
return '';
@ -161,6 +185,11 @@ export function getToolStatusText(tool: any, opts?: { intentEnabled?: boolean })
return tool.message;
}
// MCP 工具完成态统一显示:<工具名> 执行完成(避免刷新前后文案不一致)
if (tool.status === 'completed' && isMcpTool(tool)) {
return `${getMcpToolDisplayName(tool)} 执行完成`;
}
// 开启时:有 intent 就只显示 intent
if (intentEnabled && hasIntent) {
return intentText;