Skip to content

Conversation

@duckduckhero
Copy link
Contributor

  • shoutout to @plyght for fixing title generation
  • tried to enhance prompting for chat

@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

📝 Walkthrough

Walkthrough

The changes introduce improved handling and formatting for generated titles and chat messages in the desktop app. Titles are now sanitized before storage, chat message containers and text are made selectable via CSS, LLM connection type is passed to system prompts, and the AI chat system template is updated to clarify markdown note formatting using triple backticks.

Changes

Files/Paths Change Summary
apps/desktop/src/components/editor-area/index.tsx Cleans generated title text (removes quotes, trims whitespace) before updating session state.
apps/desktop/src/components/right-panel/components/chat/chat-messages-view.tsx
apps/desktop/src/components/right-panel/components/chat/message-content.tsx
Adds select-text CSS class to chat message containers and plain text elements for selectable text.
apps/desktop/src/components/right-panel/views/chat-view.tsx Imports LLM connector, retrieves LLM connection type, and passes it to system template rendering.
crates/template/assets/ai_chat_system.jinja Updates template instructions: clarifies markdown notes must use triple backticks, adds conditional for "HyprLocal" type with examples.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EditorArea
    participant SessionState

    User->>EditorArea: Trigger title generation
    EditorArea->>EditorArea: Generate title text
    EditorArea->>EditorArea: Clean title (remove quotes, trim)
    EditorArea->>SessionState: updateTitle(cleanedTitle)
Loading
sequenceDiagram
    participant ChatView
    participant ConnectorCommands
    participant TemplateCommands

    ChatView->>ConnectorCommands: getLlmConnection()
    ConnectorCommands-->>ChatView: Return connection type
    ChatView->>TemplateCommands: render("ai_chat.system", {type})
    TemplateCommands-->>ChatView: Rendered system content
Loading

Estimated code review effort

2 (~15 minutes)

Possibly related PRs

  • add automatic title generation #935: Introduced automatic title generation and updating in the same function modified here, directly relating to the change that now cleans the generated title.
✨ 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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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.

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.

Copy link

@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: 0

🧹 Nitpick comments (1)
apps/desktop/src/components/right-panel/views/chat-view.tsx (1)

163-163: Remove debug console.log before production.

The console.log statement should be removed before merging to production to avoid cluttering the console output.

-    console.log("systemContent", systemContent);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5805f68 and 20470fb.

📒 Files selected for processing (5)
  • apps/desktop/src/components/editor-area/index.tsx (1 hunks)
  • apps/desktop/src/components/right-panel/components/chat/chat-messages-view.tsx (1 hunks)
  • apps/desktop/src/components/right-panel/components/chat/message-content.tsx (2 hunks)
  • apps/desktop/src/components/right-panel/views/chat-view.tsx (2 hunks)
  • crates/template/assets/ai_chat_system.jinja (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • apps/desktop/src/components/right-panel/components/chat/chat-messages-view.tsx
  • apps/desktop/src/components/right-panel/components/chat/message-content.tsx
  • apps/desktop/src/components/editor-area/index.tsx
  • apps/desktop/src/components/right-panel/views/chat-view.tsx
🔇 Additional comments (5)
apps/desktop/src/components/editor-area/index.tsx (1)

65-66: LGTM! Good title sanitization.

The regex correctly removes leading and trailing quotes (both single and double) and trims whitespace before updating the session title. This ensures clean title storage without extraneous formatting.

apps/desktop/src/components/right-panel/views/chat-view.tsx (1)

6-6: LGTM! Good integration of LLM connection type.

The addition of connectorCommands import and retrieval of the LLM connection type enables dynamic system prompt rendering based on the connection type, which aligns well with the template enhancements.

Also applies to: 151-151, 160-160

crates/template/assets/ai_chat_system.jinja (1)

10-10: LGTM! Excellent template enhancements.

The changes significantly improve the template by:

  • Clarifying triple backtick usage for markdown blocks (line 10)
  • Adding specific response examples for "HyprLocal" connection type (lines 41-66)
  • Emphasizing proper markdown formatting (line 132)
  • Proper conditional structure with the Custom type block

The examples demonstrate correct markdown formatting within code blocks, which will help ensure consistent AI responses.

Also applies to: 41-66, 132-132, 135-135

apps/desktop/src/components/right-panel/components/chat/chat-messages-view.tsx (1)

20-20: LGTM! Good UX improvement.

Adding the select-text class enables text selection in the chat messages container, improving user experience by allowing users to select and copy chat content.

apps/desktop/src/components/right-panel/components/chat/message-content.tsx (1)

15-15: LGTM! Consistent text selection styling.

Adding select-text class to both text rendering scenarios (lines 15 and 27) ensures consistent text selection behavior across all message content types, complementing the container-level styling in chat-messages-view.tsx.

Also applies to: 27-27

@duckduckhero duckduckhero merged commit 1d1916a into main Jul 21, 2025
8 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants