-
Notifications
You must be signed in to change notification settings - Fork 17
ECHO-313 Refactor reply_utils.py, SpikeMessage component and update reply templates for improved prompts #188
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
…ed context handling - Updated the SpikeMessage component to use a minimum width for the logo, enhancing layout consistency. - Added a partial closing tag pattern in reply_utils.py to improve parsing accuracy. - Revised prompt templates in German, English, Spanish, French, and Dutch to clarify context instructions and streamline response structure, ensuring better guidance for AI responses.
WalkthroughThis update streamlines the prompt templates for multiple languages by removing detailed step-by-step instructions and replacing them with concise, open-ended guidance. It also adjusts the English prompt template to require explicit tagging of analysis and response sections. Minor UI and backend logic tweaks are included. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend
participant Backend
participant AI_Assistant
User->>Frontend: Sends message
Frontend->>Backend: Forwards message
Backend->>AI_Assistant: Sends prompt (with new concise instructions and explicit tag requirements)
AI_Assistant-->>Backend: Returns output with <detailed_analysis> and <response> tags
Backend-->>Frontend: Sends AI response
Frontend-->>User: Displays AI response
Possibly related PRs
Suggested labels
✨ Finishing Touches
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. 🪧 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 (
|
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
🔭 Outside diff range comments (1)
echo/server/dembrane/reply_utils.py (1)
353-364:"</"at index 0 makes the stop-condition far too greedyPlacing the generic
"</"pattern before the more specific"</response"variants causes the detection loop to short-circuit on any closing tag fragment inside the<response>body (e.g.</detailed_analysis>, Markdown that contains</span>, user text like"</3"), prematurely halting the stream and truncating the assistant’s answer.A safer ordering / strategy:
- partial_closing_patterns = [ - "</", - "</r", + # Keep generic fallback last to avoid premature matches + partial_closing_patterns = [ "</r", "</re", "</res", "</resp", "</respo", "</respon", "</respons", "</response", "</response>", + "</", # fallback – only hit if *really* split at '</' ]Even better: switch to a single regexp
r"</response"on the rolling buffer or parse the chunks with a tiny state machine, eliminating the maintenance burden of this growing prefix list.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
echo/frontend/src/components/participant/SpikeMessage.tsx(1 hunks)echo/server/dembrane/reply_utils.py(1 hunks)echo/server/prompt_templates/get_reply_system.de.jinja(2 hunks)echo/server/prompt_templates/get_reply_system.en.jinja(1 hunks)echo/server/prompt_templates/get_reply_system.es.jinja(2 hunks)echo/server/prompt_templates/get_reply_system.fr.jinja(2 hunks)echo/server/prompt_templates/get_reply_system.nl.jinja(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
echo/frontend/src/components/participant/SpikeMessage.tsx (1)
echo/frontend/src/components/common/Logo.tsx (1)
Logo(57-64)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: ci-check-server
🔇 Additional comments (7)
echo/server/prompt_templates/get_reply_system.es.jinja (1)
1-35: LGTM – template reads cleanerThe trimmed Spanish prompt keeps the required tag contract while shedding verbose instructions. No blocking comments from my side.
echo/server/prompt_templates/get_reply_system.nl.jinja (1)
1-35: Dutch prompt simplification looks goodConsistent with the other locales and still enforces the
<detailed_analysis>/<response>wrappers.echo/server/prompt_templates/get_reply_system.de.jinja (1)
1-35: German template update is fineNothing leaps out—structure matches the revised spec.
echo/server/prompt_templates/get_reply_system.en.jinja (1)
26-35: Parser alignment – double-check new tag semanticsNice call-out for
<detailed_analysis>/<response>– this will keep the stream parser sane. Just make surereply_utils._CLOSING_TAG_PATTERNwas expanded to include both tags and that downstream consumers tolerate the two-block structure (they previously assumed a single<response>tag).If the regex only whitelists a finite tag list, add these:
-_ALLOWED_CLOSING_TAGS = {"response", ...} +_ALLOWED_CLOSING_TAGS = {"response", "detailed_analysis", ...}echo/server/prompt_templates/get_reply_system.fr.jinja (3)
1-4: LGTM – intro wording reads clean in FR
Nothing to flag.
20-22: Context emphasis tweak looks good
Highlighting the main transcript + prior replies mirrors the EN template – all good.
26-35: Consistent tag names across locales – perfectTags stay in English while the prose is French, which is exactly what the parser expects. ✅
…eply templates for improved prompts (#188) Refactor SpikeMessage component and update reply templates for improved context handling - Updated the SpikeMessage component to use a minimum width for the logo, enhancing layout consistency. - Added a partial closing tag pattern in reply_utils.py to improve parsing accuracy. - Revised prompt templates in German, English, Spanish, French, and Dutch to clarify context instructions and streamline response structure, ensuring better guidance for AI responses.
Summary by CodeRabbit
Style
New Features
Documentation
Refactor