-
Notifications
You must be signed in to change notification settings - Fork 1
move custom search dialog to its own component separate from default … #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new RAG-based AI search API endpoint was introduced, while the previous AI-enhanced search logic was removed from the standard search endpoint. The UI was updated to support toggling between standard and AI search, including a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AISearchToggle
participant CustomSearchDialog
participant RAGSearchAPI
participant ExternalAIAgent
User->>AISearchToggle: Click Sparkles button
AISearchToggle->>CustomSearchDialog: Open dialog
User->>CustomSearchDialog: Enter query and submit
CustomSearchDialog->>RAGSearchAPI: GET /api/rag-search?query=...
RAGSearchAPI->>ExternalAIAgent: POST query to AI agent API
ExternalAIAgent-->>RAGSearchAPI: Return AI answer + related docs
RAGSearchAPI-->>CustomSearchDialog: Return combined results
CustomSearchDialog-->>User: Display AI answer and related documents
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying with
|
Status | Name | Latest Commit | Preview URL | Updated (UTC) |
---|---|---|---|---|
✅ Deployment successful! View logs |
docs | 4b132e5 | Commit Preview URL | Jul 04 2025, 09:26 PM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
app/api/rag-search/route.ts (1)
22-24
: Remove redundant conditional assignment.The condition checks if
url === '/'
and then assigns the same value, which has no effect.- if (url === '/') { - url = '/'; - }components/RAGSearchToggle.tsx (1)
7-23
: Consider using TypeScript for better type safety.Based on the codebase conventions, components should use TypeScript for improved type safety and IDE support.
Would you like me to help convert this component to TypeScript with proper type definitions?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
app/api/rag-search/route.ts
(1 hunks)app/api/search/route.ts
(1 hunks)app/layout.config.tsx
(2 hunks)app/layout.tsx
(0 hunks)components/CustomSearchDialog/hooks/useMessages.tsx
(1 hunks)components/CustomSearchDialog/index.tsx
(1 hunks)components/RAGSearchToggle.tsx
(1 hunks)
💤 Files with no reviewable changes (1)
- app/layout.tsx
🧰 Additional context used
🧠 Learnings (4)
app/layout.config.tsx (1)
Learnt from: CR
PR: agentuity/docs#0
File: .cursor/rules/mdx.mdc:0-0
Timestamp: 2025-07-01T12:36:29.712Z
Learning: This is MDX so some react components can be used
components/RAGSearchToggle.tsx (1)
Learnt from: CR
PR: agentuity/docs#0
File: .cursor/rules/mdx.mdc:0-0
Timestamp: 2025-07-01T12:36:29.712Z
Learning: This is MDX so some react components can be used
app/api/rag-search/route.ts (8)
Learnt from: afterrburn
PR: agentuity/docs#208
File: agent-docs/src/agents/doc-qa/index.ts:27-28
Timestamp: 2025-06-28T18:06:02.340Z
Learning: The answerQuestion function in agent-docs/src/agents/doc-qa/rag.ts handles errors internally by logging them and returning a fallback JSON answer, so it doesn't require external try-catch blocks at the call site.
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : The file should export a default function
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-01T12:36:46.237Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use structured error handling with try/catch blocks
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-01T12:36:46.237Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Import types from `@agentuity/sdk`
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer loading types from the node modules package `@agentuity/sdk` in the node_modules folder
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-01T12:36:46.237Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : All code should be in Typescript format
app/api/search/route.ts (6)
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : The file should export a default function
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-01T12:36:46.237Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Import types from `@agentuity/sdk`
Learnt from: afterrburn
PR: agentuity/docs#208
File: agent-docs/src/agents/doc-qa/index.ts:27-28
Timestamp: 2025-06-28T18:06:02.340Z
Learning: The answerQuestion function in agent-docs/src/agents/doc-qa/rag.ts handles errors internally by logging them and returning a fallback JSON answer, so it doesn't require external try-catch blocks at the call site.
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-01T12:36:36.319Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer loading types from the node modules package `@agentuity/sdk` in the node_modules folder
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-01T12:36:46.237Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use structured error handling with try/catch blocks
🧬 Code Graph Analysis (3)
app/layout.config.tsx (1)
components/RAGSearchToggle.tsx (1)
RAGSearchToggle
(7-23)
components/RAGSearchToggle.tsx (1)
components/CustomSearchDialog/index.tsx (1)
CustomSearchDialog
(12-116)
app/api/search/route.ts (1)
lib/source.ts (1)
source
(5-8)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Workers Builds: docs
🔇 Additional comments (5)
app/api/rag-search/route.ts (1)
31-48
: Good error handling in metadata retrieval.The function properly handles errors and provides sensible fallbacks when metadata cannot be retrieved.
components/CustomSearchDialog/hooks/useMessages.tsx (1)
70-70
: URL correctly updated to use the new RAG search endpoint.The fetch URL properly points to the new
/api/rag-search
endpoint that handles AI-augmented search queries.app/layout.config.tsx (1)
6-6
: Clean integration of RAG search toggle in navigation.The RAGSearchToggle is properly imported and placed at the beginning of the navigation links for good visibility.
Also applies to: 47-47
components/CustomSearchDialog/index.tsx (1)
38-38
: Good refactoring of dialog container styles.Consolidating the styles directly on Dialog.Content removes unnecessary wrapper elements and simplifies the component structure.
app/api/search/route.ts (1)
4-5
: No lingering POST/legacy calls to/api/search
found
A repository-wide search for/api/search
(excluding the GET-only route handler) returned no client-side fetches or other references.
components/RAGSearchToggle.tsx
Outdated
<button onClick={handleToggle}> | ||
<Sparkles className="size-4 text-cyan-700 dark:text-cyan-500" /> | ||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add accessibility attributes and hover states to the button.
The button lacks proper accessibility attributes and visual feedback for better user experience.
- <button onClick={handleToggle}>
+ <button
+ onClick={handleToggle}
+ aria-label="Open AI-powered search"
+ className="p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer"
+ >
<Sparkles className="size-4 text-cyan-700 dark:text-cyan-500" />
</button>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<button onClick={handleToggle}> | |
<Sparkles className="size-4 text-cyan-700 dark:text-cyan-500" /> | |
</button> | |
<button | |
onClick={handleToggle} | |
aria-label="Open AI-powered search" | |
className="p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer" | |
> | |
<Sparkles className="size-4 text-cyan-700 dark:text-cyan-500" /> | |
</button> |
🤖 Prompt for AI Agents
In components/RAGSearchToggle.tsx around lines 17 to 19, the button element is
missing accessibility attributes and hover state styles. Add an aria-label
attribute to the button to describe its action for screen readers, and include
CSS classes or inline styles to provide visual feedback on hover, such as
changing the button's background or icon color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (7)
app/(docs)/layout.tsx
(1 hunks)app/layout.config.tsx
(0 hunks)components/AISearchToggle.tsx
(1 hunks)components/CLICommand.tsx
(1 hunks)components/CustomSearchDialog/SearchInput.tsx
(1 hunks)components/CustomSearchDialog/index.tsx
(1 hunks)package.json
(1 hunks)
💤 Files with no reviewable changes (1)
- app/layout.config.tsx
✅ Files skipped from review due to trivial changes (2)
- components/CLICommand.tsx
- components/AISearchToggle.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- components/CustomSearchDialog/index.tsx
🧰 Additional context used
🧠 Learnings (2)
package.json (1)
Learnt from: CR
PR: agentuity/docs#0
File: .cursor/rules/mdx.mdc:0-0
Timestamp: 2025-07-01T12:36:29.712Z
Learning: This is MDX so some react components can be used
app/(docs)/layout.tsx (1)
Learnt from: CR
PR: agentuity/docs#0
File: .cursor/rules/mdx.mdc:0-0
Timestamp: 2025-07-01T12:36:29.712Z
Learning: This is MDX so some react components can be used
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Workers Builds: docs
🔇 Additional comments (4)
package.json (1)
27-27
: LGTM: New dependency addition supports AI search functionality.The lucide-react dependency is appropriately added to support the new AISearchToggle component mentioned in the AI summary.
components/CustomSearchDialog/SearchInput.tsx (1)
24-29
: LGTM: Good UX improvement with proper focus management.The new useEffect correctly refocuses the textarea when loading completes, improving user experience by ensuring the input remains focused after AI search responses.
app/(docs)/layout.tsx (2)
4-5
: LGTM: Clean import structure for search toggle components.The imports are properly structured with the external fumadocs-ui component and the local AISearchToggle component.
10-23
: LGTM: Well-structured layout integration with responsive design.The searchToggle prop implementation is clean and follows good practices:
- Proper flex container with appropriate gap spacing
- Responsive design with
max-md:hidden
for mobile screens- Correct sizing with
flex-1
on LargeSearchToggle- Clean component composition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
bin/collect-changed-files.sh (1)
36-37
: Minor: use|| :
instead of spawning a subshell forgrep
(grep '^content/' || true)
preventsset -e
+pipefail
from aborting when no matches exist, but the extra subshell is unnecessary:- (grep '^content/' || true) | \ + grep '^content/' || : | \
|| :
(NOP) achieves the same without an extra process and keeps the pipeline simpler..github/workflows/sync-docs.yml (2)
31-42
: Quote$GITHUB_OUTPUT
when writing outputs
>> $GITHUB_OUTPUT
risks word-splitting if the env var ever contains spaces (unlikely but possible). Quote it for correctness:-echo "before_commit=$BEFORE_COMMIT" >> $GITHUB_OUTPUT -echo "after_commit=$AFTER_COMMIT" >> $GITHUB_OUTPUT +echo "before_commit=$BEFORE_COMMIT" >> "$GITHUB_OUTPUT" +echo "after_commit=$AFTER_COMMIT" >> "$GITHUB_OUTPUT"
35-35
: Trailing whitespace – failsyamllint
Blank lines 35 and 43 contain stray spaces, flagged by YAMLlint. Remove the spaces to keep the workflow lint-clean.
Also applies to: 43-43
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/sync-docs.yml
(2 hunks)bin/collect-changed-files.sh
(2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/sync-docs.yml
30-30: shellcheck reported issue in this script: SC2086:info:14:42: Double quote to prevent globbing and word splitting
(shellcheck)
30-30: shellcheck reported issue in this script: SC2086:info:15:40: Double quote to prevent globbing and word splitting
(shellcheck)
30-30: shellcheck reported issue in this script: SC2086:info:19:54: Double quote to prevent globbing and word splitting
(shellcheck)
30-30: shellcheck reported issue in this script: SC2086:info:20:44: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs.yml
[error] 35-35: trailing spaces
(trailing-spaces)
[error] 43-43: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Workers Builds: docs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Seng Rith <50646727+afterrburn@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
.github/workflows/sync-docs.yml (1)
57-58
: Nice catch on quoting the commit SHAThe
git fetch
invocation is now correctly quoted, eliminating SC2086 word-splitting issues noted in a previous review. ✅
🧹 Nitpick comments (1)
.github/workflows/sync-docs.yml (1)
35-43
: Strip trailing whitespace — YAML-lint is already complainingLines 35 and 43 contain nothing but spaces, triggering
YAMLlint trailing-spaces
.
Remove them to keep the workflow lint-clean.- +
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/sync-docs.yml
(2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs.yml
[error] 35-35: trailing spaces
(trailing-spaces)
[error] 43-43: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Workers Builds: docs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Seng Rith <50646727+afterrburn@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/sync-docs.yml (1)
35-35
: Remove trailing whitespaceYAML-lint flags lines 35 and 43 for trailing spaces. This is a pure style issue, but fixing it silences CI and keeps diffs clean.
Also applies to: 43-43
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/sync-docs.yml
(2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs.yml
[error] 35-35: trailing spaces
(trailing-spaces)
[error] 43-43: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Workers Builds: docs
🔇 Additional comments (1)
.github/workflows/sync-docs.yml (1)
57-58
: Nice fix: variable is now safely quotedQuoting
${{ steps.commits.outputs.before_commit }}
removes the SC2086 warning and prevents word-splitting issues.
No further action needed here.
New Features
Dependency Updates
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Chores