Skip to content

Chat fix 0806#1298

Merged
duckduckhero merged 5 commits intomainfrom
chat-fix-0806
Aug 7, 2025
Merged

Chat fix 0806#1298
duckduckhero merged 5 commits intomainfrom
chat-fix-0806

Conversation

@duckduckhero
Copy link
Contributor

@duckduckhero duckduckhero commented Aug 6, 2025

Summary by cubic

Improved tool calling logic in chat by adding support for new models and ensuring correct tool access messaging.

  • Bug Fixes
    • Fixed tool access checks for "gpt-4o" and similar models.
    • Updated chat instructions to inform users when a model cannot access certain tools.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

📝 Walkthrough

Walkthrough

The changes extend the prepareMessageHistory function to accept an optional modelId parameter and propagate this value through relevant calls and template rendering. The logic for handling specific model IDs is updated to include "openai/gpt-4o" and "gpt-4o". Additionally, a template file is corrected to properly close a conditional block.

Changes

Cohort / File(s) Change Summary
Chat Logic Update
apps/desktop/src/components/right-panel/hooks/useChatLogic.ts
Extended prepareMessageHistory to accept modelId, passed through call sites and into prompt rendering; expanded model ID checks to include "openai/gpt-4o" and "gpt-4o".
Template Syntax Fix
crates/template/assets/ai_chat_system.jinja
Added a missing {% endif %} to correctly close a conditional block for model-specific instructions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatLogic
    participant TemplateRenderer

    User->>ChatLogic: processUserMessage(model)
    ChatLogic->>ChatLogic: prepareMessageHistory(..., model.modelId)
    ChatLogic->>TemplateRenderer: Render system prompt with modelId
    TemplateRenderer-->>ChatLogic: Rendered prompt
    ChatLogic-->>User: Response based on modelId logic
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 03aafd5 and 38d682e.

📒 Files selected for processing (2)
  • apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (3 hunks)
  • crates/template/assets/ai_chat_system.jinja (2 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/hooks/useChatLogic.ts
🔇 Additional comments (6)
crates/template/assets/ai_chat_system.jinja (2)

147-147: LGTM: Model ID expansion follows existing pattern.

The addition of "openai/gpt-4o" and "gpt-4o" to the conditional maintains consistency with the existing model ID format and aligns with the corresponding changes in the TypeScript logic.


160-160: LGTM: Template syntax fix.

The closing {% endif %} properly closes the conditional block that starts at line 147, fixing the template syntax and ensuring the tool calling instructions are properly wrapped for the specified model IDs.

apps/desktop/src/components/right-panel/hooks/useChatLogic.ts (4)

80-80: LGTM: Optional parameter addition follows TypeScript best practices.

The optional modelId parameter is properly typed and positioned, maintaining backward compatibility while enabling the new model-specific template rendering functionality.


117-117: LGTM: Template context properly extended.

The modelId is correctly passed to the template rendering context, enabling model-specific conditional logic in the Jinja template.


313-313: LGTM: Function call properly utilizes new parameter.

The model.modelId is correctly passed to prepareMessageHistory, ensuring the template has access to the current model information for conditional rendering.


321-323: LGTM: Conditional logic consistently expanded.

The addition of "openai/gpt-4o" and "gpt-4o" to the conditional maintains consistency with the template changes and ensures these model variants have access to the same tool capabilities as other supported models.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chat-fix-0806

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

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate unit tests to generate unit tests for 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

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 2 files. Review in cubic

@duckduckhero duckduckhero merged commit a205b0f into main Aug 7, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 18, 2025
This was referenced Aug 26, 2025
@ComputelessComputer ComputelessComputer deleted the chat-fix-0806 branch December 14, 2025 15:21
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.

1 participant