优化: AI Chat全栈多批审查修复与架构清理(risk_level清理/路由解耦/工具渲染/测试补测/死代码)

This commit is contained in:
2026-06-18 22:57:19 +08:00
parent 0ca5d9805f
commit a2871a66e0
87 changed files with 5720 additions and 3012 deletions

View File

@@ -20,6 +20,7 @@ export default {
today: 'Today',
yesterday: 'Yesterday',
earlier: 'Earlier',
groupEmpty: 'None',
// ── Header buttons ──
conversationList: 'Chat list',
@@ -155,7 +156,10 @@ export default {
clearContext: 'Clear context',
compressContext: 'Compress context',
// Confirm dialog (clear is semantically irreversible; history archived, not deleted)
clearContextConfirm: 'Clear the current chat context? History is archived and preserved; new chats are not affected.',
// Title "Clear context" folded into the lead sentence; stress irreversible + archived segment + AI no longer sees history
clearContextConfirm: 'Clear context? This action is irreversible. The current chat context will be archived as a segment (the AI will no longer see these history messages). New chats are not affected.',
// Danger button label for the confirm dialog (ConfirmDialog dangerLabel); falls back to common.confirm if omitted
clearContextDangerLabel: 'Clear',
// Collapsed separator (consecutive same-status merged into one bar; {n}=merged message count)
contextArchived: 'Archived {n} messages',
compressed: 'Context compressed',

View File

@@ -11,12 +11,17 @@ export default {
// UX-260616-01: tool execution failure marker (AR-6 keeps status=completed, red to distinguish from success)
executionFailed: 'Failed',
executionFailedHint: 'Tool execution failed, see details below',
// Singular expand/collapse (ToolCard single-card content, command output toggle; expandAll/collapseAll are for ToolCardList global multi-group)
expand: 'Expand',
collapse: 'Collapse',
expandAll: 'Expand all',
collapseAll: 'Collapse all',
written: 'written',
items: 'items',
lines: 'lines',
// UX-260618-08/11: truncation hints (read_file paged truncation / list_directory 1000-entry cap)
linesTruncated: '{shown}/{total} lines, truncated',
dirTruncated: 'Truncated, first {n} items only',
readPrefix: 'Read',
readFallback: 'Read File',
@@ -39,6 +44,9 @@ export default {
taskCount: '{n} tasks',
projectCount: '{n} projects',
ideaCount: '{n} ideas',
// UX-260618-10/12: list_trash collapsed header count + paged has_more hint (backend returns {items,total,has_more} object)
trashCount: '{n} in trash',
listHasMore: '({n} shown, more available)',
createdWithName: 'Created: {name}',
created: 'Created',
updatedField: 'Updated {field}',
@@ -50,22 +58,38 @@ export default {
purged: 'Purged',
purgeIneffective: 'Purge ineffective',
workflowHint: 'Run it on the workflow page',
// UX-260618-05: run_workflow tool_result shows execution_id (workflowHint misleading — workflow already triggered; old key kept for other refs)
workflowTriggered: 'Task {id} triggered workflow (advancing to {status}, execution {exec})',
workflowTriggeredShort: 'Execution {exec}',
// UX-260616-04: formatToolResult covers all tools with human-readable summaries (missing keys)
updatedTaskField: 'Task {id} updated field {field}',
advancedTask: 'Task {id} advanced to {status}',
// UX-260618-09: advance_task return-round accumulation (shown only when >0)
advancedTaskWithRounds: 'Task {id} advanced to {status} (returned {n} times)',
commandOk: 'Command succeeded ({ms} ms)',
commandFailed: 'Command failed (exit code {code})',
commandOutputLines: '{n} lines of output',
patchedFile: 'Patched {path} ({diff} bytes)',
// UX-260618-06: patch_file multi-match hint + size_diff unit
patchedMatches: 'matched {n} places',
bytesUnit: 'bytes',
patchedNoChange: '{path} no change',
appendedTo: 'Appended {bytes} to {path}',
renamedFile: 'Renamed {from} → {to}',
// UX-260618-12: rename_file bytes/cross-volume + write_file overwrite/encoding hints
renamedWithBytes: 'Renamed {from} → {to} ({bytes})',
renamedCrossVolume: 'Moved {from} → {to} (cross-volume, {bytes})',
writeOverwrite: 'overwrote {old} → {neww}',
encodingLabel: 'encoding: {enc}',
foundN: 'Found {n}',
boundDir: 'Bound directory "{path}" stack: {stack}',
deleteFilePermanent: 'Permanently deleted {path}',
deleteFileSoft: 'Soft-deleted {path} (backed up)',
// UX-260618-07: soft-delete adds backup_path (trash filename so user knows where to recover from)
deleteFileSoft: 'Soft-deleted {path} (backed up, recover from: {backup_path})',
fileInfoSize: '{path} {size}',
// UX-260618-12: file_info modified time (epoch_ms → client toLocaleString)
fileInfoModified: ' · modified {time}',
fileInfoLines: ' · {n} lines',
fileInfoBinary: ' · binary',
fileInfoDir: ' · directory',

46
src/i18n/en/auditLog.ts Normal file
View File

@@ -0,0 +1,46 @@
export default {
auditLog: {
title: 'Approval History',
refresh: 'Refresh',
desc: 'AI tool call audit records (newest first). Arguments and results show summaries only; full data persists in the local database.',
loading: 'Loading…',
empty: 'No audit records',
col: {
time: 'Requested',
tool: 'Tool',
risk: 'Risk',
status: 'Status',
decided: 'Decided by',
args: 'Args summary',
result: 'Result summary',
},
pager: {
prev: 'Prev',
next: 'Next',
page: 'Page {n}',
last: '(last)',
},
risk: {
low: 'Low',
medium: 'Med',
high: 'High',
},
status: {
pending: 'Pending',
approved: 'Approved',
rejected: 'Rejected',
executing: 'Executing',
completed: 'Completed',
failed: 'Failed',
},
decided: {
human: 'Human',
auto: 'Auto',
},
},
}

7
src/i18n/en/error.ts Normal file
View File

@@ -0,0 +1,7 @@
export default {
error: {
title: 'Render Error',
desc: 'This section failed to render due to an internal error. Try reloading.',
retry: 'Retry',
},
}

View File

@@ -51,11 +51,9 @@ export default {
fetchFailedNotFound: 'Endpoint not found, this vendor may not support model listing: {msg}',
toastModelEditLocalOnly: 'Enabled / weight are local edits, overwritten on next fetch',
// Model trait tags (4 dimensions + probe source)
// Model trait tags (modality + capability + probe source; cost/intel 去除见 UX-260618-04)
tagModality: { text: 'Text', vision: 'Vision', audio: 'Audio', video: 'Video' },
tagCapability: { tool_use: 'Tool use', embedding: 'Embedding', code_gen: 'Code' },
tagCost: { free: 'Free', low: 'Low', medium: 'Medium', high: 'High' },
tagIntel: { lite: 'Lite', standard: 'Standard', plus: 'Plus', ultra: 'Ultra' },
tagSource: { user_set: 'Manual', preset_table: 'Preset', heuristic: 'Heuristic', default: 'Default' },
// ===== Connection panel =====

View File

@@ -27,6 +27,7 @@ export default {
group: {
taskCount: '{n} tasks',
unknownProject: 'Unknown Project',
empty: 'No tasks yet',
},
// New task modal

View File

@@ -20,6 +20,7 @@ export default {
today: '今天',
yesterday: '昨天',
earlier: '更早',
groupEmpty: '暂无',
// ── Header 按钮 ──
conversationList: '对话列表',
@@ -156,7 +157,10 @@ export default {
clearContext: '清空上下文',
compressContext: '压缩上下文',
// 二次确认(清空不可逆语义,防误触;历史归档保留不删)
clearContextConfirm: '确定清空当前对话上下文?历史消息归档保留,不影响新对话',
// 标题「清空上下文」融入正文首句;强调不可逆 + 归档分段 + AI 不再看到历史
clearContextConfirm: '清空上下文?此操作不可逆,当前对话上下文将被归档为分段(AI 将不再看到这些历史消息)。新对话不受影响。',
// 二次确认弹窗的危险按钮文案(ConfirmDialog dangerLabel);不传则回退 common.confirm
clearContextDangerLabel: '清空',
// 折叠分隔条(连续同 status 合并一条;{n}=合并的消息条数)
contextArchived: '已归档 {n} 条消息',
compressed: '已压缩上下文',

View File

@@ -13,10 +13,14 @@ export default {
executionFailedHint: '工具执行失败,详情见下方',
collapse: '收起',
expandAll: '展开全部',
expand: '展开',
collapseAll: '全部收起',
written: '已写入',
items: '项',
lines: '行',
// UX-260618-08/11:截断提示(read_file 分页截断 / list_directory 1000 上限截断)
linesTruncated: '{shown}/{total} 行,已截断',
dirTruncated: '已截断,仅前 {n} 项',
// 工具显示名(含路径摘要前缀,fallback 兜底)
readPrefix: '读取',
@@ -41,6 +45,9 @@ export default {
taskCount: '{n} 项任务',
projectCount: '{n} 个项目',
ideaCount: '{n} 条灵感',
// UX-260618-10/12:list_trash 折叠态计数 + 分页 has_more 提示(后端返 {items,total,has_more} 对象)
trashCount: '回收站 {n} 项',
listHasMore: '(已显示 {n} 项,还有更多)',
createdWithName: '已创建:{name}',
created: '已创建',
updatedField: '已更新 {field}',
@@ -52,22 +59,38 @@ export default {
purged: '已彻底删除',
purgeIneffective: '清除未生效',
workflowHint: '请到工作流页面运行',
// UX-260618-05:run_workflow tool_result 显 execution_id(workflowHint 误导——工作流已触发;旧 key 保留防他处引用)
workflowTriggered: '任务 {id} 已触发工作流(推进至 {status},执行实例 {exec})',
workflowTriggeredShort: '执行实例 {exec}',
// UX-260616-04:formatToolResult 覆盖全部工具产出人类可读摘要(补缺失 key)
updatedTaskField: '任务 {id} 已更新字段 {field}',
advancedTask: '任务 {id} 已推进至 {status}',
// UX-260618-09:advance_task 退回累加轮数(>0 才显)
advancedTaskWithRounds: '任务 {id} 已推进至 {status}(已退回 {n} 次)',
commandOk: '命令成功({ms} 毫秒)',
commandFailed: '命令失败(退出码 {code}',
commandOutputLines: '{n} 行输出',
patchedFile: '已修改 {path}(增减 {diff} 字节)',
// UX-260618-06:patch_file 多匹配提示 + size_diff 单位
patchedMatches: '匹配 {n} 处',
bytesUnit: '字节',
patchedNoChange: '{path} 无更改',
appendedTo: '已向 {path} 追加 {bytes}',
renamedFile: '已重命名 {from} → {to}',
// UX-260618-12:rename_file 字节/跨卷 + write_file 覆盖/编码提示
renamedWithBytes: '已重命名 {from} → {to}({bytes})',
renamedCrossVolume: '已移动 {from} → {to}(跨卷,{bytes})',
writeOverwrite: '覆盖 {old} → {neww}',
encodingLabel: '编码:{enc}',
foundN: '找到 {n} 项',
boundDir: '已绑定目录「{path}」技术栈:{stack}',
deleteFilePermanent: '已硬删除 {path}',
deleteFileSoft: '已软删除 {path}(已备份)',
// UX-260618-07:软删补 backup_path(回收站文件名,用户知从哪恢复)
deleteFileSoft: '已软删除 {path}(已备份,可从 {backup_path} 恢复)',
fileInfoSize: '{path} {size}',
// UX-260618-12:file_info 修改时间(epoch_ms → 客户端 toLocaleString)
fileInfoModified: ' · 修改于 {time}',
fileInfoLines: ' · {n} 行',
fileInfoBinary: ' · 二进制',
fileInfoDir: ' · 目录',

View File

@@ -0,0 +1,46 @@
export default {
auditLog: {
title: '审批历史',
refresh: '刷新',
desc: 'AI 工具调用审计记录(按请求时间倒序)。参数与结果仅展示摘要,完整数据留存本地数据库。',
loading: '加载中…',
empty: '暂无审计记录',
col: {
time: '请求时间',
tool: '工具',
risk: '风险',
status: '状态',
decided: '决策者',
args: '参数摘要',
result: '结果摘要',
},
pager: {
prev: '上一页',
next: '下一页',
page: '第 {n} 页',
last: '(末页)',
},
risk: {
low: '低',
medium: '中',
high: '高',
},
status: {
pending: '待审批',
approved: '已批准',
rejected: '已拒绝',
executing: '执行中',
completed: '已完成',
failed: '失败',
},
decided: {
human: '人工',
auto: '自动',
},
},
}

7
src/i18n/zh-CN/error.ts Normal file
View File

@@ -0,0 +1,7 @@
export default {
error: {
title: '页面渲染异常',
desc: '当前区域因内部错误无法显示,可尝试重新加载。',
retry: '重试',
},
}

View File

@@ -51,11 +51,9 @@ export default {
fetchFailedNotFound: '端点不存在,该厂商可能不支持模型列表拉取:{msg}',
toastModelEditLocalOnly: '已启用 / 权重为本地编辑,下次拉取时覆盖',
// 模型特征标签(4 维度 + 探测来源)
// 模型特征标签(模态 + 能力 + 探测来源;cost/intel 去除见 UX-260618-04)
tagModality: { text: '文本', vision: '视觉', audio: '音频', video: '视频' },
tagCapability: { tool_use: '工具调用', embedding: '向量', code_gen: '代码' },
tagCost: { free: '免费', low: '低价', medium: '中价', high: '高价' },
tagIntel: { lite: '轻量', standard: '标准', plus: '增强', ultra: '旗舰' },
tagSource: { user_set: '手动', preset_table: '预设', heuristic: '推断', default: '默认' },
// ===== 连接管理面板 =====

View File

@@ -27,6 +27,7 @@ export default {
group: {
taskCount: '{n} 个任务',
unknownProject: '未知项目',
empty: '暂无任务',
},
// 新建任务模态