Skip to content

Conversation

@Ayyanaruto
Copy link
Contributor

@Ayyanaruto Ayyanaruto commented Oct 14, 2025

Description

Fixed autodetect title generation for models that use <think> blocks (like qwen3:30b). Updated the removeCodeBlocksAndTrim function to remove thinking content before generating chat titles, preventing titles from showing the model's reasoning process instead of actual response content.

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Tests

Added comprehensive test coverage in core/util/index.test.ts for:

  • Basic <think> block removal from text
  • Multiple think blocks in the same message
  • Combination of code blocks and think blocks
  • Think blocks containing newlines

Fixes

Closes #5689

Updated the removeCodeBlocksAndTrim function to use greedy regex matching (/<think>[\s\S]*<\/think>/g) to properly handle all think block scenarios while maintaining existing code block removal functionality.


Summary by cubic

Fixed autodetected chat titles for models that emit blocks (e.g., qwen3) by stripping thinking and code blocks before building the title, so titles reflect the actual answer.

  • Bug Fixes
    • Updated removeCodeBlocksAndTrim to remove … and ``` code blocks, including multiline and multiple blocks.
    • Added tests for think blocks, combinations with code blocks, multiple blocks, and newlines.

- Update removeCodeBlocksAndTrim to handle <think> blocks from models like qwen3
- Add comprehensive test coverage for think block removal
- Fixes issue where chat titles showed thinking process instead of content

Fixes continuedev#5689
@Ayyanaruto Ayyanaruto requested a review from a team as a code owner October 14, 2025 09:44
@Ayyanaruto Ayyanaruto requested review from tingwai and removed request for a team October 14, 2025 09:44
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 14, 2025
Copy link
Contributor

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

No issues found across 2 files

Copy link
Collaborator

@tingwai tingwai left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the improvement!

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Oct 15, 2025
@tingwai tingwai merged commit 1e42198 into continuedev:main Oct 15, 2025
56 of 57 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Oct 15, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 15, 2025
@sestinj
Copy link
Contributor

sestinj commented Oct 16, 2025

🎉 This PR is included in version 1.29.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Oct 17, 2025

🎉 This PR is included in version 1.26.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Oct 17, 2025

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Oct 21, 2025

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer released size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

BUG: Autodetect title does not handle models with <think> like qwen3

3 participants