Skip to content

Conversation

@ussaama
Copy link
Contributor

@ussaama ussaama commented Jun 17, 2025

  • 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

    • Improved visual consistency in the participant message display.
  • New Features

    • Enhanced detection of partial closing tags in streamed responses for more robust handling.
  • Documentation

    • Updated English prompt template to clarify required output structure with explicit tagging instructions.
  • Refactor

    • Simplified and condensed system prompt templates for German, Spanish, French, and Dutch, reducing prescriptive analysis steps and focusing on more open-ended, natural conversation guidance.

…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.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

Walkthrough

This 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

File(s) Change Summary
echo/frontend/src/components/participant/SpikeMessage.tsx Added min-w-[20px] CSS class to the Logo component for layout consistency.
echo/server/dembrane/reply_utils.py Prepended "</" to partial_closing_patterns to improve detection of partial closing tags in streamed responses.
echo/server/prompt_templates/get_reply_system.en.jinja Added explicit instructions and example for wrapping output in <detailed_analysis> and <response> tags.
echo/server/prompt_templates/get_reply_system.de.jinja
echo/server/prompt_templates/get_reply_system.es.jinja
echo/server/prompt_templates/get_reply_system.fr.jinja
echo/server/prompt_templates/get_reply_system.nl.jinja
Simplified and condensed prompt templates: removed detailed procedural instructions, favoring concise open-ended guidance.

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
Loading

Possibly related PRs

Suggested labels

Feature

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ussaama ussaama changed the title Refactor reply_utils.py, SpikeMessage component and update reply templates for improved prompts ECHO-313 Refactor reply_utils.py, SpikeMessage component and update reply templates for improved prompts Jun 17, 2025
@ussaama ussaama requested a review from spashii June 17, 2025 10:15
@linear
Copy link

linear bot commented Jun 17, 2025

ECHO-313 Fix Get Reply

@ussaama ussaama enabled auto-merge June 17, 2025 10:15
@coderabbitai coderabbitai bot added the Feature label Jun 17, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 greedy

Placing 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

📥 Commits

Reviewing files that changed from the base of the PR and between 819b12f and c4a3e13.

📒 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 cleaner

The 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 good

Consistent 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 fine

Nothing 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 semantics

Nice call-out for <detailed_analysis> / <response> – this will keep the stream parser sane. Just make sure reply_utils._CLOSING_TAG_PATTERN was 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 – perfect

Tags stay in English while the prose is French, which is exactly what the parser expects. ✅

@ussaama ussaama added this pull request to the merge queue Jun 17, 2025
Merged via the queue into main with commit 0c29d30 Jun 17, 2025
7 checks passed
@ussaama ussaama deleted the get-reply-fix branch June 17, 2025 14:38
spashii pushed a commit that referenced this pull request Nov 18, 2025
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants