fix(ui): stabilize tool header icons and mcp completion label
This commit is contained in:
parent
9d8beacc8d
commit
bb6bfff176
@ -594,10 +594,12 @@
|
|||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
min-width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
flex: 0 0 16px;
|
||||||
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
color: var(--claude-text-secondary);
|
color: var(--claude-text-secondary);
|
||||||
}
|
}
|
||||||
@ -618,7 +620,7 @@
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-shrink: 0;
|
flex: 0 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.captured-status {
|
.captured-status {
|
||||||
|
|||||||
@ -145,6 +145,30 @@ function describeReadFileResult(tool: any): string {
|
|||||||
return '文件读取完成';
|
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 {
|
export function getToolStatusText(tool: any, opts?: { intentEnabled?: boolean }): string {
|
||||||
if (!tool) {
|
if (!tool) {
|
||||||
return '';
|
return '';
|
||||||
@ -161,6 +185,11 @@ export function getToolStatusText(tool: any, opts?: { intentEnabled?: boolean })
|
|||||||
return tool.message;
|
return tool.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MCP 工具完成态统一显示:<工具名> 执行完成(避免刷新前后文案不一致)
|
||||||
|
if (tool.status === 'completed' && isMcpTool(tool)) {
|
||||||
|
return `${getMcpToolDisplayName(tool)} 执行完成`;
|
||||||
|
}
|
||||||
|
|
||||||
// 开启时:有 intent 就只显示 intent
|
// 开启时:有 intent 就只显示 intent
|
||||||
if (intentEnabled && hasIntent) {
|
if (intentEnabled && hasIntent) {
|
||||||
return intentText;
|
return intentText;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user