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.
feat: add searchDocumentation tool for querying Rocketadmin documentation and update prompts for AI responses #1787
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
Uh oh!
There was an error while loading. Please reload this page.
feat: add searchDocumentation tool for querying Rocketadmin documentation and update prompts for AI responses #1787
Changes from all commits
c31c8e5File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
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.
Move the Algolia API key out of source control.
Keeping a live key in the module makes rotation harder and leaves credential material in git history permanently. Load it from runtime config/env instead and have tests inject a fixture value.
🧰 Tools
🪛 Betterleaks (1.2.0)
[high] 4-4: Identified an Algolia API Key, which could result in unauthorized search operations and data exposure on Algolia-managed platforms.
(algolia-api-key)
🤖 Prompt for AI Agents
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.
🧩 Analysis chain
🌐 Web query:
For Algolia Search API responses, when a request includesattributesToSnippet: ['content:50'], is the query-matched snippet returned under_snippetResult.content.valuewhile the originalcontentattribute remains unchanged?💡 Result:
Yes, that is correct. When you include
attributesToSnippet: ['content:50']in an Algolia search request, the originalcontentattribute in the hit remains unchanged [1][2]. The snippeted version of that attribute is returned separately within the_snippetResultobject in the search response, specifically under_snippetResult.content.value[1][2]. This_snippetResultobject contains the shortened text with highlighting tags applied to the matched query terms [1][3]. The original attribute is preserved in the main hit object, allowing you to access both the full content and the snippeted, highlighted version as needed [4][5].Citations:
🏁 Script executed:
Repository: rocket-admin/rocketadmin
Length of output: 120
🏁 Script executed:
# Check the file size first wc -l backend/src/ai-core/tools/documentation-search.tsRepository: rocket-admin/rocketadmin
Length of output: 121
🏁 Script executed:
# Read the file to see the implementation cat -n backend/src/ai-core/tools/documentation-search.tsRepository: rocket-admin/rocketadmin
Length of output: 3256
🏁 Script executed:
Repository: rocket-admin/rocketadmin
Length of output: 1060
🏁 Script executed:
Repository: rocket-admin/rocketadmin
Length of output: 146
🏁 Script executed:
Repository: rocket-admin/rocketadmin
Length of output: 96
🏁 Script executed:
Repository: rocket-admin/rocketadmin
Length of output: 50
🏁 Script executed:
# Read the test file cat -n ./backend/test/ava-tests/non-saas-tests/non-saas-documentation-search.test.tsRepository: rocket-admin/rocketadmin
Length of output: 4395
Use Algolia's snippet payload instead of raw
content.attributesToSnippet: ['content:50']requests query-matched snippets from Algolia, which are returned in_snippetResult.content.value. However,buildHitcurrently useshit.content, returning the full content (up to 800 chars) instead of the contextual snippet. Update the code to use_snippetResult.content.valuewhen available, and add the_snippetResultfield to theAlgoliaHitinterface. Also update the tests (lines 29–84) to mock the actual Algolia response shape including_snippetResult.🤖 Prompt for AI Agents
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.
Handle Algolia request failures explicitly.
A timeout or 5xx from Algolia will currently bubble a raw Axios exception through the AI flow. Wrap this call in
try/catchand translate it to the tool’s intended failure mode so a transient search outage does not take down the whole response path. As per coding guidelines, "Ensure all error handling is explicit - use try/catch blocks appropriately"🤖 Prompt for AI Agents
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.
Reject whitespace-only
queryvalues before calling documentation search.if (!query)allows" "through and still triggers the external docs lookup. Trim and type-check before validation.Suggested fix
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.