feat:将英文的工具名称映射为中文展示
This commit is contained in:
@ -491,6 +491,19 @@ export function getMessageAreaStyles(): string {
|
||||
*/
|
||||
export function getMessageAreaScript(): string {
|
||||
return `
|
||||
// 工具名称映射
|
||||
function getToolDisplayName(toolName) {
|
||||
const toolNameMap = {
|
||||
'file_read': '已完成文件读取',
|
||||
'file_write': '已完成文件写入',
|
||||
'file_list': '已读取目录',
|
||||
'syntax_check': '语法检查',
|
||||
'simulation': '仿真',
|
||||
'waveform_summary': '波形分析'
|
||||
};
|
||||
return toolNameMap[toolName] || toolName;
|
||||
}
|
||||
|
||||
// 添加消息
|
||||
function addMessage(text, sender) {
|
||||
const div = document.createElement('div');
|
||||
@ -729,7 +742,7 @@ export function getMessageAreaScript(): string {
|
||||
<div class="tool-segment-header\${shouldCollapse ? ' collapsed' : ''}" data-collapsible="\${shouldCollapse}">
|
||||
\${shouldCollapse ? collapseIconSvg : ''}
|
||||
<span class="tool-segment-icon">\${statusIcon}</span>
|
||||
<span class="tool-segment-name">\${segment.toolName || '工具'}</span>
|
||||
<span class="tool-segment-name">\${getToolDisplayName(segment.toolName) || '工具'}</span>
|
||||
\${toolResult && !shouldCollapse ? \`<span class="tool-segment-result">\${toolResult}</span>\` : ''}
|
||||
</div>
|
||||
\${shouldCollapse ? \`<div class="tool-segment-content collapsed"><span class="tool-segment-result" style="display:block;white-space:pre-wrap;max-width:100%;margin-top:8px;margin-left:18px;">\${toolResult}</span></div>\` : ''}
|
||||
@ -920,7 +933,7 @@ export function getMessageAreaScript(): string {
|
||||
<div class="tool-segment-header\${shouldCollapse ? ' collapsed' : ''}" data-collapsible="\${shouldCollapse}">
|
||||
\${shouldCollapse ? collapseIconSvg : ''}
|
||||
<span class="tool-segment-icon">\${statusIcon}</span>
|
||||
<span class="tool-segment-name">\${segment.toolName || '工具'}</span>
|
||||
<span class="tool-segment-name">\${getToolDisplayName(segment.toolName) || '工具'}</span>
|
||||
\${toolResult && !shouldCollapse ? \`<span class="tool-segment-result">\${toolResult}</span>\` : ''}
|
||||
</div>
|
||||
\${shouldCollapse ? \`<div class="tool-segment-content collapsed"><span class="tool-segment-result" style="display:block;white-space:pre-wrap;max-width:100%;margin-top:8px;margin-left:18px;">\${toolResult}</span></div>\` : ''}
|
||||
@ -1054,7 +1067,7 @@ export function getMessageAreaScript(): string {
|
||||
div.className = \`message tool-status tool-\${status}\`;
|
||||
div.innerHTML = \`
|
||||
<span class="tool-icon">\${statusIcons[status]}</span>
|
||||
<span class="tool-name">\${toolName}</span>
|
||||
<span class="tool-name">\${getToolDisplayName(toolName)}</span>
|
||||
<span class="tool-status-text">\${statusTexts[status]}</span>
|
||||
\${detail ? \`<div class="tool-detail">\${detail}</div>\` : ''}
|
||||
\`;
|
||||
|
||||
Reference in New Issue
Block a user