新增: obscura 安装引导(prompt AI 看 hint 帮装 + 前端工具卡片 AI 帮装按钮)

This commit is contained in:
lxy
2026-08-01 18:07:56 +08:00
parent d664bdc309
commit 3afaff9efe
11 changed files with 332 additions and 4 deletions
+19
View File
@@ -491,6 +491,24 @@ async function handleRetry(): Promise<void> {
}
}
/**
* fetch_url obscura 未装时"AI 帮装"按钮:自动触发 AI 对话让 AI run_command 装流式。
* 提示语足够具体(给出 cargo install + GitHub releases 两种装法 + 装完告知用户重试),
* AI 拿到能直接 run_command 不需再问;装完 obscura 即可用,用户重试 fetch_url 即走 JS 渲染。
* 复用 store.sendMessage(经 useAiSend 暴露,触发 ai_chat_send → agentic loop)。
* 失败 toast(对齐 handleRetry 错误处理模式)。
*/
async function onInstallObscura(): Promise<void> {
try {
await store.sendMessage(t('aiTool.obscuraInstallPrompt'))
await nextTick()
scrollToBottom()
} catch (e) {
const msg = e instanceof Error ? e.message : String(e)
emit('toast', { msg: t('aiChat.sendFailed', { msg }), type: 'error' })
}
}
// ── F-15 阶段2: 消息分段(归档段折叠) ──
// ChatMessage.status 渲染语义(types.ts 未含 status 字段,前端经 cast 读写闭环):
// null | undefined | 'active' → 正常消息(现状)
@@ -748,6 +766,7 @@ defineExpose({
:toolCalls="item.msg.toolCalls"
@approve="({ id, approved, decision }) => store.approveToolCall(id, approved, decision)"
@batch-approve="(decision) => store.batchApprove(decision)"
@install-obscura="onInstallObscura"
/>
<!-- UX-2025-13:消息时间戳(相对时间+hover绝对时间),流式生成中不显示避免抖动 -->