优化: AI模块(provider重试兼容+aichat交互+工具卡片可读化+diff高亮)

This commit is contained in:
2026-06-16 02:33:16 +08:00
parent d2cb38cdac
commit 10e4945e5a
26 changed files with 2337 additions and 332 deletions

View File

@@ -8,11 +8,15 @@ export default {
fileInfo: 'File Info',
appendFile: 'Append File',
searchFiles: 'Search Files',
patchFile: 'Patch File',
deleteFile: 'Delete File',
renameFile: 'Rename/Move File',
},
aiTool: {
fileInfoDesc: 'Get file or directory metadata (exists, size, line count, modified time, is binary, is directory) without reading content',
appendFileDesc: 'Append content to end of file. Creates file if not exists. Returns bytes written and new file size',
searchFilesDesc: 'Search for files matching a pattern (case-insensitive substring match) in a directory. Supports recursive search, max 50 results with total count and has_more flag',
renameFileDesc: 'Rename or move a file (one tool covers both rename and move). from=source path, to=target path, overwrite=default false (reject if target exists). Atomic rename on same volume, auto copy+remove across volumes',
},
errorNotFound: 'Request failed: the endpoint or model does not exist. Please check the Provider configuration.',
errorAuth: 'Request failed: the API key is invalid or lacks permission.',
@@ -21,6 +25,15 @@ export default {
streamInterruptedAfterTool: '⚠ The tool finished, but the following reply was interrupted (no data stream for a long time). You can click Continue to retry.',
streamInterrupted: '⚠ The response was interrupted (no data stream for a long time). This may be due to a network disconnection or a backend error. Please try again.',
queueFull: 'Send queue is full (max {limit} items)',
forceSendConfirm: 'AI generation appears stuck. Force-stop and send anyway? (This may interrupt the current response)',
forceSendBtn: 'Force Send',
queueTimedOut: 'Queue timed out',
approvalNotDelivered: 'Approval operation failed to reach the backend: {error}',
approvalTimeout: '⚰ Approval timed out, automatically rejected: {toolName}',
// AE-2025-07: Agentic loop progress bar copy
// Note: max round / completed tool count are not surfaced by backend this round;
// template conditionally omits them. Add *WithMax keys once backend exposes them.
agenticProgress: '🔄 Round {round} · ⏳{pending} pending',
agenticProgressNoPending: '🔄 Round {round}',
},
}

View File

@@ -18,7 +18,10 @@ export default {
// ── Header buttons ──
conversationList: 'Chat list',
maximize: 'Maximize',
pendingApprovalCount: '{n} pending',
pendingApprovalHint: 'Click to jump to the first pending approval',
restoreSidebar: 'Restore sidebar',
sidebarResizeHint: 'Drag to resize sidebar',
detachWindow: 'Detach window',
closePanel: 'Close panel',
dockRight: 'Dock to main window right',
@@ -32,11 +35,22 @@ export default {
providerNotConfigured: 'No AI provider configured. Please add one in settings.',
notConfigured: 'Not configured',
// ── Empty states ──
// ── Empty states (UX-2025-20: example prompt cards + no-provider guidance) ──
emptyNoProvider: 'No AI provider configured',
emptyNoProviderHint: 'Please add a provider in settings to start chatting',
emptyTitle: 'Chat with AI assistant',
emptyHint: 'Try "create a project" or "list all tasks"',
// Example prompt cards: click to fill and send (4 prompts, DevFlow scenarios)
examplePrompt1: 'Analyze this projects dependencies',
examplePrompt2: 'Help me write a workflow node',
examplePrompt3: 'List all current tasks',
examplePrompt4: 'Generate a project idea',
goToSettings: 'Open settings',
goToSettingsHint: 'The detached window cannot open settings directly. Configure AI providers on the main windows Settings page.',
// ── Provider switch feedback (UX-2025-14) ──
providerSwitched: 'Switched to {model}',
providerSwitchHint: 'Current model: {model}',
// ── Back to bottom ──
backToBottom: 'Back to bottom',
@@ -63,5 +77,10 @@ export default {
clearChat: 'Clear',
confirmClearChat: 'Are you sure you want to clear all messages in this chat? This cannot be undone.',
toastSendFail: 'Send failed: {msg}',
// ── Message copy (F-260615-13) ──
copyMsg: 'Copy message',
copied: 'Copied',
copyFailed: 'Copy failed',
},
}

View File

@@ -3,9 +3,14 @@ export default {
running: 'Running…',
approve: 'Approve',
reject: 'Reject',
approveAll: 'Approve All ({n})',
rejectAll: 'Reject All',
rejectedHint: 'User rejected this action',
// B-260616-12: tool execution slow hint (frontend fallback, no backend cancel IPC)
executionSlow: 'Tool "{name}" is taking longer than expected, please wait…',
collapse: 'Collapse',
expandAll: 'Expand all',
collapseAll: 'Collapse all',
written: 'written',
items: 'items',
lines: 'lines',
@@ -45,5 +50,28 @@ export default {
projectLabel: '"{name}"',
projectIdNotFound: '(project not found, id={id})',
// AE-2025-05: High-risk approval second confirm (ask once more before approve; misclick cancellable)
confirmHighDelete: 'Permanently delete? This action cannot be undone',
confirmHighExec: 'Run this command?',
confirmHighGeneric: 'Proceed with this high-risk action?',
// Tool result detail format (plain-text result + approval placeholder appends arg summary)
resultDetail: '{raw} ({detail})',
// Approval argument key labels
argLabel: {
id: 'ID',
projectId: 'Project ID',
name: 'Name',
title: 'Title',
description: 'Description',
field: 'Field',
value: 'Value',
path: 'Path',
priority: 'Priority',
tags: 'Tags',
source: 'Source',
},
},
}

View File

@@ -8,11 +8,15 @@ export default {
fileInfo: '文件信息',
appendFile: '追加写入',
searchFiles: '搜索文件',
patchFile: '修改文件',
deleteFile: '删除文件',
renameFile: '重命名/移动文件',
},
aiTool: {
fileInfoDesc: '获取文件或目录的元信息(是否存在、大小、行数、修改时间、是否二进制、是否目录),不读取文件内容',
appendFileDesc: '向文件末尾追加内容,文件不存在则自动创建。返回写入字数和新文件大小',
searchFilesDesc: '在指定目录下搜索匹配模式(字符串包含匹配)的文件名,返回路径和大小列表。支持递归搜索,结果限 50 条',
renameFileDesc: '重命名或移动文件(同一工具覆盖 rename 和 move。from=源路径、to=目标路径、overwrite=默认 false 目标存在拒绝。同卷原子 rename跨卷自动 copy+remove',
},
errorNotFound: '调用失败:接口地址或模型不存在,请检查 Provider 配置',
errorAuth: '调用失败:API Key 无效或无权限',
@@ -21,6 +25,14 @@ export default {
streamInterruptedAfterTool: '⚠ 工具已执行完成,后续回复中断(长时间无数据流)。可点继续重试。',
streamInterrupted: '⚠ 响应中断(长时间无数据流)。可能是网络断连或后端异常,请重试。',
queueFull: '待发送队列已满(最多 {limit} 条)',
forceSendConfirm: 'AI 生成似乎卡住了。是否强制结束当前生成并发送消息?(可能中断正在生成的回复)',
forceSendBtn: '强制发送',
queueTimedOut: '排队超时',
approvalNotDelivered: '审批操作未送达后端:{error}',
approvalTimeout: '⚰ 审批超时,已自动拒绝:{toolName}',
// AE-2025-07: Agentic 循环进度条文案
// 注:max 轮次/已完成工具数本轮后端暂不透传,模板条件渲染省略;后端补全后新增 *WithMax key
agenticProgress: '🔄 循环 {round} · ⏳{pending}待审批',
agenticProgressNoPending: '🔄 循环 {round}',
},
}

View File

@@ -18,7 +18,10 @@ export default {
// ── Header 按钮 ──
conversationList: '对话列表',
maximize: '最大化',
pendingApprovalCount: '{n} 项待审批',
pendingApprovalHint: '点击跳转到第一个待审批项',
restoreSidebar: '还原侧栏',
sidebarResizeHint: '拖拽调整侧栏宽度',
detachWindow: '分离窗口',
closePanel: '关闭面板',
dockRight: '吸附到主窗口右侧',
@@ -32,11 +35,22 @@ export default {
providerNotConfigured: '未配置 AI 提供商,请在设置中添加',
notConfigured: '未配置',
// ── 空状态 ──
// ── 空状态(UX-2025-20:示例问题卡片 + 无 provider 引导) ──
emptyNoProvider: '未配置 AI 提供商',
emptyNoProviderHint: '请在设置中添加 Provider 后开始对话',
emptyTitle: '与 AI 助手对话',
emptyHint: '可以说"帮我创建一个项目"或"列出所有任务"',
// 示例问题卡片:点击自动填入并发送(4 条,DevFlow 场景相关)
examplePrompt1: '分析这个项目的依赖关系',
examplePrompt2: '帮我写一个工作流节点',
examplePrompt3: '列出当前所有任务',
examplePrompt4: '生成一个项目灵感',
goToSettings: '去设置',
goToSettingsHint: '分离窗口无法直接打开设置,请在主窗口的设置页配置 AI 提供商',
// ── Provider 切换反馈(UX-2025-14) ──
providerSwitched: '已切换到 {model}',
providerSwitchHint: '当前模型:{model}',
// ── 回到底部 ──
backToBottom: '回到底部',
@@ -63,5 +77,10 @@ export default {
clearChat: '清空',
confirmClearChat: '确定清空当前对话的所有消息?此操作不可恢复。',
toastSendFail: '发送失败:{msg}',
// ── 消息拷贝(F-260615-13) ──
copyMsg: '复制消息',
copied: '已复制',
copyFailed: '复制失败',
},
}

View File

@@ -3,9 +3,14 @@ export default {
running: '执行中…',
approve: '批准执行',
reject: '拒绝',
approveAll: '全部批准 {n} 项',
rejectAll: '全部拒绝',
rejectedHint: '用户拒绝了此操作',
// B-260616-12:工具执行超时提示(前端降级,无后端取消 IPC)
executionSlow: '工具「{name}」执行较久,请稍候…',
collapse: '收起',
expandAll: '展开全部',
collapseAll: '全部收起',
written: '已写入',
items: '项',
lines: '行',
@@ -48,5 +53,28 @@ export default {
// 审批参数特化(id/project_id 回显项目名,查不到标注原 id)
projectLabel: '「{name}」',
projectIdNotFound: '(项目已不存在, id={id})',
// AE-2025-05:High 风险审批二次确认文案(批准前再问一次,误点可取消)
confirmHighDelete: '确定永久删除?此操作不可恢复',
confirmHighExec: '确定执行此命令?',
confirmHighGeneric: '确定执行此高危操作?',
// 工具结果详情格式(非 JSON 纯文本 + 审批占位时补参数摘要)
resultDetail: '{raw}{detail}',
// 审批参数键标签
argLabel: {
id: 'ID',
projectId: '项目 ID',
name: '名称',
title: '标题',
description: '描述',
field: '字段',
value: '新值',
path: '路径',
priority: '优先级',
tags: '标签',
source: '来源',
},
},
}