feat(search): Obsidian-style global search with file/folder targeting#494
Open
KevinYoung-Kw wants to merge 13 commits intoop7418:mainfrom
Open
feat(search): Obsidian-style global search with file/folder targeting#494KevinYoung-Kw wants to merge 13 commits intoop7418:mainfrom
KevinYoung-Kw wants to merge 13 commits intoop7418:mainfrom
Conversation
|
@KevinYoung-Kw is attempting to deploy a commit to the op7418's projects Team on Vercel. A member of the Team first needs to authorize it. |
- Add /api/search endpoint supporting scoped queries (sessions:, messages:, files:) and default cross-dimension search - Add GlobalSearchDialog using cmdk CommandDialog with grouped results - Add Cmd/Ctrl+K shortcut via useGlobalSearchShortcut hook - Wire ChatListPanel search button to open global search - Remove legacy session-only search dialog from ChatListPanel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Redesign the global search dialog with session-grouped messages, Obsidian-style previews, and larger dialog sizing. - GlobalSearchDialog: group messages by session with foldable groups; distinguish user/assistant/tool via icons; enlarge to sm:max-w-3xl; highlight matched keyword in snippet with primary color - File/Folder search: pass ?file=path&q=query; auto-open file tree, expand parent folders and target directory, scroll and flash-highlight the matched item (files and directories both supported) - Search API:兼容单数前缀 (session:/message:/file:) and return contentType for icon selection; folders are now searchable - Snippet generation: bias keyword toward the front so it survives single-line truncation in the UI list - i18n: add globalSearch.toolLabel for zh/en Relates to op7418#482 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Give CommandDialog a fixed height (h-[60vh] max-h-[600px]) so the overall dialog no longer expands and contracts as results appear. Remove max-h from CommandList and let it fill remaining space with flex-1, so only the result list scrolls while the input stays put. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…arning - Use h-[min(80vh,520px)] for smooth viewport scaling instead of breakpoint-based hard switch - Override CommandList default max-h-[300px] with max-h-none so results fill the entire dialog and the bottom white area is gone - Replace <button> in CommandGroup heading with <div> to silence the aria-hidden/focus browser warning - Remove unused FolderOpen import Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…dings Apply bg-muted/40, rounded corners, and font-medium text-foreground to session-level message group headers so they visually separate from individual message items and create clearer hierarchy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…animations Switch AIFileTree from defaultExpanded to controlled expanded so that changing highlightPath actually opens parent folders in real time. Add polling (100ms × 15) instead of a single setTimeout so the scroll-to-highlight waits for Collapsible animation to finish. Reset flash tracker on highlightPath change to avoid stale state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…reshes Replace the global hasFlashedRef flag with a seekKeyRef tied to the specific highlightPath. This stops the polling interval from restarting whenever the file tree auto-refreshes (e.g. after streaming ends), which was causing users to be snapped back to the highlighted file while they were manually scrolling. Also removes the unnecessary loading dependency from the scroll effect. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- add seek token on file result navigation - use reactive search params in chat/file-tree panels - key file-tree seeking by path+seek token - degrade update API to no-update payload on upstream failures
- avoid consuming seek key before target is found - include workingDirectory in seek key - clear stale tree state on project switch - add Playwright regression for repeated + cross-session file seeks
- cover all/session/message/file search modes - seed sessions/messages/files deterministically - make Cmd/Ctrl+K open global search even while editing
4b849e6 to
33b2233
Compare
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.
Summary
在原有“仅搜索会话名”的基础上,升级为 Obsidian 风格的全局搜索:支持搜索会话、消息内容、文件、目录,并附带上下文预览和直达定位。
与原搜索的区别
设计思路
1. 搜索结果分组展示
之前搜到 10 条消息时,根本不知道它们来自哪几个会话。现在消息按会话折叠分组,文件和会话也各自成组,扫一眼就能定位到想找的上下文。
2. 结果 preview 更友好
sm:max-w-3xl,snippet 能显示更多内容min(80vh, 520px)高度,输入框始终置顶,不会因结果加载而上下跳动3. 文件/目录可搜索、可直达
seekKeyRef保护,防止刷新后把用户正在手动浏览的滚动位置又拽回高亮节点4. 搜索前缀更顺手
提示文案改成单数
session:/message:/file:,API 同时兼容复数旧写法。snippet 截取策略把关键词往前靠,避免被单行 truncate 截掉。Follow-up fixes (post review)
根据 UI/UX 验收反馈,补充了以下稳定性与可用性修复:
默认全局搜索补齐文件/目录维度
scope=all现在也会返回 files(不再需要必须写file:才能命中)文件 deep-link 不再被默认面板初始化覆盖
?file=时,优先保持文件树打开,避免“点了结果但文件树被关掉”关闭搜索弹窗时中止 in-flight 请求
关键词高亮对前缀查询生效
session:xxx / message:xxx / file:xxx会用解析后的实际关键词xxx进行高亮消息分组折叠头支持键盘操作
CommandItem承载折叠逻辑,支持 command 列表内键盘导航与回车切换IME 结束时避免重复请求
onCompositionEnd里的即时搜索,统一走去抖查询文件树重复定位与跨会话定位稳定性修复
seek标识并将定位键扩展为path + seek (+ workingDirectory),避免第二次同路径跳转被误判为“已定位”更新检查接口降级处理
/api/app/updates返回可降级响应,避免前端出现 502 噪音v0.50.3 验收更新
已将本 PR 分支对齐到
v0.50.3基线后重新验收:npm run test通过(1047/1047)npm run build通过playwright:global-search-file-seek.spec.ts通过playwright:global-search-modes.spec.ts通过结论:在
v0.50.3上,当前 PR 覆盖范围内的搜索功能与 UI/UX 未发现新增回归。Test plan
file:xxx→ 仅显示文件/目录结果Relates to #482
Latest incremental update
session:/message:/file:)时,在搜索框下方显示主题色范围提示条(含当前 scope 文案与前缀标识),降低“当前正在搜哪一类内容”的认知负担。