Skip to content

fix: update translation labels to include stripping 'thinking' context #1222

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Chapoly1305
Copy link
Contributor

@Chapoly1305 Chapoly1305 commented Jul 12, 2025

Similar to Release v2.2.6 (b29645f), this PR helps people does not know how to use Regex and just simply get rid of thinking tag.

This pull request introduces changes to enhance the handling of translation results by stripping both empty lines and "thinking" tags from text. Updates include modifications to localization files for multiple languages and improvements to the stripEmptyLines function in the codebase.

Localization updates:

Code functionality enhancement:

  • src/utils/str.ts: Enhanced the stripEmptyLines function to strip <think>...</think> tags and their content from text, in addition to normalizing line endings and removing empty lines.

For example, when using qwen3:32b,
Before:
Screenshot 2025-07-12 at 12 06 10 AM

After:
Screenshot 2025-07-12 at 12 08 45 AM

Note: The stripping process will be conducted after all responses have been received. Consequently, there will be a temporary display of the thinking context. Once the translation is received in full, the thinking tag will be deleted.

Test Build:
translate-for-zotero.xpi.zip

@Chapoly1305 Chapoly1305 mentioned this pull request Jul 12, 2025
1 task
@ramonmi
Copy link
Contributor

ramonmi commented Jul 12, 2025

  • Some irrelevant issues: I wonder why I haven't encountered such translated results with <think> </think> labels before. Thanks a lot.
image

@Chapoly1305
Copy link
Contributor Author

Chapoly1305 commented Jul 12, 2025

  • Some irrelevant issues: I wonder why I haven't encountered such translated results with <think> </think> labels before. Thanks a lot.

I have never tried this model from platform like aliyun. I did replicate with ollama like the ticket I referred. Maybe when you use /no_think, the upstream stripped it for you, but that's not how this model works originally.

@ramonmi
Copy link
Contributor

ramonmi commented Jul 13, 2025

I see. Thanks. ・◡・

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