-
Notifications
You must be signed in to change notification settings - Fork 56
fix: document chat prompt is fixed #898
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
WalkthroughIntroduces structured prompt changes in server/ai/agentPrompts.ts with dynamic date context, renamed sections, explicit JSON response schema, and null-answer fallback logic. Updates server/services/fileProcessor.ts to change processFile’s extractImages default from true to false without altering control flow. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant FPS as FileProcessorService
participant IE as ImageExtractor
participant IS as ImageSummarizer
Client->>FPS: processFile(buffer, mimeType, fileName, vespaDocId, storagePath?, extractImages=?, describeImages=?)
note right of FPS: Default extractImages = false (changed)
alt extractImages == true
FPS->>IE: extract(buffer, mimeType)
IE-->>FPS: images[]
alt describeImages == true
FPS->>IS: describe(images[])
IS-->>FPS: descriptions[]
else describeImages == false
note over FPS: Skip image descriptions
end
else extractImages == false
note over FPS: Skip image extraction
end
FPS-->>Client: ProcessingResult
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @Himanshvarma, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on improving the reliability and clarity of the AI agent's document chat functionality by refining its underlying prompt. It provides the AI with more structured guidance on how to interpret context, format responses, and manage cases where information is not found. Additionally, a minor adjustment was made to the default image extraction setting in the file processing service to optimize its behavior. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request updates the agentBaselineFileContextPromptJson prompt to be more detailed and structured, which is a good improvement. However, it also changes the default behavior of file processing to disable image extraction, which could have unintended side effects. My review includes a high-severity comment on this change and a medium-severity comment to improve the clarity of the updated prompt by removing repetitive instructions.
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)
server/services/fileProcessor.ts (1)
29-31: Alternative: keep backward-compat default, allow opt-out via envSafer default preserves behavior while enabling a controlled switch.
- extractImages: boolean = false, + extractImages: boolean = process.env.FILEPROC_EXTRACT_IMAGES_DEFAULT === "false" ? false : true,Document FILEPROC_EXTRACT_IMAGES_DEFAULT and plan a staged flip.
server/ai/agentPrompts.ts (1)
859-861: Minor: duplicated “current date” phrasinggetDateForAI() already includes “Current Date : …”. Prepending “The current date is:” yields clunky duplication.
-) => `The current date is: ${getDateForAI()}. Based on this information, make your answers. Don't try to give vague answers without +) => `${getDateForAI()}. Based on this information, make your answers. Don't try to give vague answers without any logic. Be formal as much as possible.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
server/ai/agentPrompts.ts(2 hunks)server/services/fileProcessor.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
server/ai/agentPrompts.ts (2)
server/utils/index.ts (1)
getDateForAI(3-24)server/ai/context.ts (1)
userContext(832-846)
🔇 Additional comments (3)
server/ai/agentPrompts.ts (3)
862-875: LGTM: clearer single-file context and richer file metadataThe SINGLE-file emphasis, added ID/mime/size/timestamps, and explicit chunk-index rules improve determinism for citations.
889-905: LGTM: strict chunk-level citation rulesThe 1–2 citations per sentence, no grouped indices, and per-chunk grounding help reduce hallucinations.
917-921: LGTM: explicit null-answer fallbackClear null contract when context doesn’t match will simplify handlers and avoid speculative answers.
Description
Testing
Additional Notes
Summary by CodeRabbit