Skip to content

feat(web-studio): search modes, panel collapse, and structured JSONL rendering - #4470

Open
ZaynJarvis wants to merge 2 commits into
mainfrom
feat/studio-playground-search-and-jsonl
Open

feat(web-studio): search modes, panel collapse, and structured JSONL rendering#4470
ZaynJarvis wants to merge 2 commits into
mainfrom
feat/studio-playground-search-and-jsonl

Conversation

@ZaynJarvis

@ZaynJarvis ZaynJarvis commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Studio 一轮体验优化

搜索

  • 搜索面板从「只能按文件名子串过滤」扩展成 5 种模式:files / find / search / grep / globTab 循环切换、query 不变。检索走已有的 useRetrievalQuery,没有新写分发。目录浏览(/ 前缀)下 Tab 保持原来的「进目录」语义。
  • glob pattern 不含 / 时自动补 **/(对齐 gitignore / VS Code / fd 惯例),含 / 原样透传。
  • 结果里的目录现在可以预览 L0/L1。
  • 面板宽度改为跟随模式而非光标:搜索和目录浏览(///)统一宽版,空结果或切换命令时不再变宽变窄;只有还没输入的 idle 提示保持窄版。
  • Playground 里 Cmd/Ctrl+F 打开搜索面板;焦点在 CodeMirror 内时放行给编辑器自带查找。
image

布局

  • 右侧交互面板可折叠,状态持久化;折叠时拖拽把手一并隐藏,展开入口在中间面包屑条右端。
  • cwd 从拥挤的面板头部(max-w-40 截断到读不出内容)挪到终端输入行做 shell prompt 前缀。
  • 选中态统一成 bg-muted text-foreground,去掉 bg-foreground text-background 反色和实心 primary 那几处。
image

JSONL 预览

原来的消息分类是字符串往返:先把结构化 part 拼成 [tool: xxx]\n{...},再用正则去 match 自己拼出来的前缀。后果是一条 assistant 消息只要同时含 text 和 tool_use 就被压成一坨,[tool: 前缀漏进正文,且只有第一个 part 的类型能被识别。

  • 改成按 parts[].type 判定 tool / text、按 role 判定 user / assistant,一条消息可以含多个 part 各自渲染。
  • 修 tool response 渲染:OV 的 claude-code peer 把 tool result 落成 role:'user' + type:'tool' 且只有 tool_output 没有 tool_input,parser 却无条件先造一个 input={} 的 call part,导致整条被判成 tool call → 标签落回 user、渲染出一个空 {} 框、套上 user 蓝底。改成无 input 且有 output 时不造 call part。
  • 换行修复:内容里的 / / \r 归一化成 \n;markdown 单换行不再被折叠(新增 remark-breaks,只作用于 JSONL 聊天体,普通 .md 保持 CommonMark)。
  • 配色零新色相:工具族统一「虚线边框 + muted 灰阶」,tool 输出 bg-muted/30 + max-h-96 封顶(顺带治了巨型输出撑爆卡片),thinking / 未识别 part 灰下去,invalid 加 border-destructive/30。明暗双主题都验过。
  • dialog 模式改名(Dialog mode / 对话模式),且非 dialog 模式下 toolcall 开关也生效了 —— 之前 if (!dialogMode || showTools) 让它在 raw 模式下完全失效。
image

顺带

routeTree.gen.ts 每次 build 都产生 123 增 123 删的无意义 diff。根因是 @tanstack/router-plugindependenciesdevDependencies 里重复声明、版本还打架(^1.132.0 vs latest),谁跑一次 npm i 谁就换一个生成器版本。删掉重复声明、锁死版本、提交重新生成的文件。连续 build ×2 + test ×1 后文件 sha256 一致。

依赖

未改动

后端、检索 API、ACL;lib/sessions/types/message.ts(那是服务端 SSE 的严格形状,JSONL 预览要吃任意历史版本的落盘行,宽松度要求相反)。搜索结果行第二行的 abstract 显示逻辑对目录浏览列表同样生效,本轮不做区分。

  • human reviewed

…wsing

`/` and `//` put the palette into directory browsing, which was still using
the narrow layout, so the dialog resized whenever the query switched between
searching and browsing. Only the empty idle prompt stays narrow now.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C65Cb79Dvr5zLD6ib1T9Ew
isDir: item.uri.endsWith('/'),
abstract: item.abstract,
// ponytail: reuse the `size` slot to surface the semantic score.
size:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里把 semantic score 塞进 VikingFsEntry.size 后,结果列表会在原本展示文件大小的位置直接显示类似 0.84 的无标签数值,用户无法判断它代表相关性分数,后续复用 size 做格式化或排序时也容易产生歧义。建议为检索结果使用独立的 row view model / score 字段,并在 UI 中明确标注含义。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants