Repository navigation
fix(chat): K-brain 会话的文件链接能打开,右键可打开所在目录或用默认应用打开,Image 结果能显示 - #1124
Merged
AlphaCatMeow merged 1 commit intoNov 2, 2026
Merged
Conversation
- 打开聊天文件链接时按会话查工作目录:K-brain 会话不在本地历史库,原来报 "The conversation is unavailable on this device."。桌面窗口用当前会话的工作 目录;WebUI 经网关由桌面前端按 K-brain 会话记录查询,不采信请求里的目录; 迁移来的旧会话也以当前历史为准,本地库只作回退 - 文件链接右键:打开文件、打开所在目录;桌面端另有"用默认应用打开"(网页文件 为"用默认浏览器打开"),仅放行文档/媒体/网页类,拒绝脚本、可执行、带宏 Office 与含逗号的路径;Windows 打开时路径一律加引号 - 网址链接右键:显示目标地址,用默认浏览器打开或复制链接 - 没有内置预览的 Office 文件(pptx、odt 等)左键改为在文件管理器中定位 - K-brain 模式下成功的 Image 调用原来什么都不显示:实时与历史结果都转换成 display_image,data URL 只保留一次前缀,远程图片走代理 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
K-brain 模式下代理生成的产物(包括系统临时目录里的临时产物)在聊天里打不开:点文件链接报
The conversation is unavailable on this device.;文件链接没有右键菜单,Office 等没有内置预览的文件无法交给默认应用;成功的 Image 调用在聊天里什么都不显示。本 PR 修复链接打开、加上文件与网址的右键菜单,并让 K-brain 的 Image 结果在桌面与 WebUI 显示。Closes #1123
Depends-On: none
Stack-Root: #1124
Image 工具本身的报错(空占位、url/base64 字段里的路径、临时目录图片被拒)在 K-brain 侧修复:Stack-Cairn/K-brain#79(Closes Stack-Cairn/K-brain#78)。它合入发版后再单独开锁版本 PR,本 PR 不依赖它。
改动
chat_file_links.rs):原来只查桌面本地历史库,K-brain 会话不在库里就报 unavailable。现在先问"当前拥有这段历史的一方",本地库作回退,两边都没有仍拒绝。GatewayController::kbrain_conversation_workdir经 composer action 让桌面前端按自己的会话记录查询(K-brain 模式查 K-brain,否则查本地库)。迁移过来的旧会话也以当前历史为准,不再用本地库里过期的 cwd。ChatFileLinkContextMenu.tsx、chatFileLinkContextMenuStore.ts):打开文件、打开所在目录;桌面端另有"用默认应用打开"(html/htm/xhtml/svg 显示为"用默认浏览器打开")。每个对话区挂一个宿主,多窗格只由第一个渲染;菜单项再点击一次被右键的链接按钮,所以执行的是链接当前的回调(窗格切换会话后不会用旧会话打开),链接已卸载时不执行。WebUI 不显示默认应用一项(在桌面主机上启动应用对远端用户没有意义;网关路径固定传 false)。explorer.exe打开时路径一律加引号(未加引号时逗号会把run.bat,a.pdf拆成 run.bat)。打开所在目录对所有类型可用,只定位不启动。toolImages.ts):K-brain 返回了图片,但前端没有为成功的 Image 生成display_image详情,转录区把这一行整个隐藏;图片data还保留着完整 data URL,渲染时会再拼一次前缀。现在实时(turn.ts)与历史(history.ts)结果都把 data URL 拆成纯 base64 + MIME,Image 结果生成display_image详情(远程 https 图走现有代理),WebUI 实时同步的tool_result事件带上该详情。computer 截图等其他工具图片也因此不再是双前缀。契约地图
ChatFileLink.openInFileManager(菜单)useChatFileLinkNavigation→openChatFileLink→ 桌面 Tauri 命令 / WebUI shim → protoopen_in_file_manager(字段 8,已有)→ Rustopen_in_file_manager_reveals_files_of_every_type_without_launchingChatFileLink.openWithDefaultApp(菜单,仅桌面)openChatFileLink→ Tauri 命令新可选参数open_with_default_appdefault_app_*、chat-file-link-menu-intentChatFileOpenconversation_workdir_*、chat-file-links.test.mjstool.result图片turn.ts、历史history.ts、WebUI 实时tool_result事件(details)kbrain-image-tool-results、review-kbrain-image-webui-live、kbrain-turnevents.go)验证
typecheck:ui/typecheck:gui/typecheck:webui通过;改动文件 LF 后biome check --line-ending=lf通过;node scripts/check-mirror.mjs通过;git diff --check通过;改动的 Rust 文件 rustfmt 通过(envelope_handler.rs1502/1510 行为基线原有格式差异,未动)。cargo test --lib -- chat_file_links windows_open windows_reveal gateway144 通过 0 失败(独立CARGO_TARGET_DIR,避开运行中的调试版)。la-full-tests.mjs,8 个批次全部跑完):4488 条,通过 4479,失败 8,跳过 1。失败均与本 PR 无关:known-failures.json):Tauri cargo 套件首次编译超时、两条按 CWD 读源码的用例。permission-modes-backend、kbrain-trajectory×2:真实 K-brain 进程里 bash 未实际执行("child must really execute bash"),这两个测试及其加载的模块都不在本 diff 内。chat-file-link-context-menu、chat-file-link-menu-intent、chat-file-link-menu-pane-switch、kbrain-image-tool-results、review-chat-file-link-default-app-comma、review-chat-url-menu-confirmation、review-kbrain-image-webui-live、chat-file-links、markdown-image-policy、kbrain-turn;Rust 新增conversation_workdir_*、default_app_*、office_documents_without_a_preview_reveal_on_a_plain_click、open_in_file_manager_reveals_*、windows_open_quotes_paths_so_commas_cannot_split_them等。tauri dev调试版 + MCP bridge;WebUIgateway-webui-dev连调试版托管的网关):%TEMP%下的 report.md / chart.pnghttps://example.com/、打开 / 复制%TEMP%图片(配合 K-brain#79 本地编译的 sidecar)截图
桌面:临时目录 report.md 在编辑器打开 / chart.png 预览 / 文件链接右键菜单 / 网页文件"用默认浏览器打开" / 网址菜单显示目标地址 / 390 宽度 / Image 结果显示







WebUI:编辑保存 / 文件链接菜单(无默认应用项)/ 网址菜单 / 390 宽度 / Image 实时显示





未覆盖
is_active_directory拒绝。events.go)的 Image 显示未改。🤖 Generated with Claude Code