Implement AI overview search UI#364
Merged
Merged
Conversation
Reviewer's GuideAdds an AI-powered overview experience to workspace search (including summary generation, sources, and Ask AI handoff to chat) and hardens simple-table paste/rendering so Markdown tables no longer create stray wrapper nodes or misaligned rows/cells. Sequence diagram for AI overview search and summary generationsequenceDiagram
actor User
participant Search as Search
participant BestMatch as BestMatch
participant SearchService as SearchService
User->>Search: type searchValue
Search->>BestMatch: render searchValue, askingAI
BestMatch->>BestMatch: debounce(handleSearch)
BestMatch->>SearchService: searchWorkspaceDocuments(workspaceId, searchTerm)
SearchService->>SearchService: GET /api/search/{workspaceId}
SearchService-->>BestMatch: SearchDocumentResponseItem[]
BestMatch->>BestMatch: resolveSearchResultView(outline, item)
BestMatch-->>Search: setViews(views)
alt aiEnabled and results have content
BestMatch->>SearchService: generateSearchSummary(workspaceId, searchTerm, results)
SearchService->>SearchService: POST /api/search/{workspaceId}/summary
SearchService-->>BestMatch: SearchSummaryResult
BestMatch->>BestMatch: setSummary(summary)
end
BestMatch->>Search: render ViewList header
Search->>Search: render SearchAIOverview(aiEnabled, summary, sources)
Sequence diagram for Ask AI handoff from search to chatsequenceDiagram
actor User
participant Search as Search
participant BestMatch as BestMatch
participant SearchAIOverview as SearchAIOverview
participant AppOps as addPage
participant ChatRequest as ChatRequest
participant Router as toView
participant EmptyMessages as EmptyMessages
participant MsgCtx as MessagesHandlerContext
User->>Search: open search dialog
Search->>BestMatch: render with onAskAI
User->>SearchAIOverview: click AskAI / Ask follow-up
SearchAIOverview->>BestMatch: onAskAI(sourceIds)
BestMatch-->>Search: onAskAI(query, sourceIds)
Search->>Search: getAIChatParent(outline, currentViewId)
Search->>AppOps: addPage(parent.view_id, { layout: AIChat, name, prev_view_id })
AppOps-->>Search: created AI chat View
alt query or sourceIds provided
Search->>ChatRequest: new ChatRequest(workspaceId, created.view_id, axiosInstance)
Search->>ChatRequest: updateChatSettings({ rag_ids, metadata.initial_prompt })
end
Search->>Router: toView(created.view_id)
Search->>Search: handleClose()
Router-->>EmptyMessages: mount with chatSettings
EmptyMessages->>MsgCtx: useMessagesHandlerContext()
EmptyMessages->>EmptyMessages: detect metadata.initial_prompt and !initial_prompt_consumed
EmptyMessages->>MsgCtx: submitQuestion(initial_prompt)
EmptyMessages->>MsgCtx: updateChatSettings({ metadata.initial_prompt_consumed: true })
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new semantic indexing logic for simple table rows/cells (
SimpleTableRow/SimpleTableCell) does multiple array scans (filter/find/findIndex) per render; consider precomputing a blockId→(row,col) map once in the table context and passing indices down to avoid O(n²) work on larger tables. - In
SimpleTableRowandSimpleTableCell,useMemodependencies like[context?.tableNode.children]can confuse React hook linting and cause unnecessary recomputations; it would be more robust to pullconst tableNode = context?.tableNodeand depend ontableNode(ortableNode.children) directly, or memoize the table node shape in the context.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new semantic indexing logic for simple table rows/cells (`SimpleTableRow`/`SimpleTableCell`) does multiple array scans (`filter`/`find`/`findIndex`) per render; consider precomputing a blockId→(row,col) map once in the table context and passing indices down to avoid O(n²) work on larger tables.
- In `SimpleTableRow` and `SimpleTableCell`, `useMemo` dependencies like `[context?.tableNode.children]` can confuse React hook linting and cause unnecessary recomputations; it would be more robust to pull `const tableNode = context?.tableNode` and depend on `tableNode` (or `tableNode.children`) directly, or memoize the table node shape in the context.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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
Testing
Summary by Sourcery
Add an AI-powered search overview to the search dialog and improve simple table handling for pasted Markdown content.
New Features:
Bug Fixes:
Enhancements: