Skip to content

Commit f0c27cb

Browse files
committed
feat(extension): 添加思考标签过滤功能以支持链式思考模型
- 自动从 AI 响应中移除 `<think>...</think>` 标签 - 修复 DeepSeek-R1、MiniMax-M2.1 等链式思考模型在提交消息中包含推理过程的问题 - 更新版本号至 0.1.5 并更新 CHANGELOG.md
1 parent 89a48ea commit f0c27cb

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to the "wtf-commit" extension will be documented in this fil
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.5] - 2026-01-18
9+
### Fixed
10+
- **Thinking Tag Filter**: Automatically strips `<think>...</think>` tags from AI responses. This fixes the issue where models with Chain-of-Thought reasoning (e.g., DeepSeek-R1, MiniMax-M2.1) would include their reasoning process in the commit message. ([#1](https://github.com/codertesla/wtf-commit/issues/1))
11+
812
## [0.1.4] - 2026-01-17
913
### Added
1014
- New AI provider: **OpenRouter** with default model `mistralai/devstral-2512:free`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "wtf-commit",
33
"displayName": "WTF Commit",
44
"description": "AI-powered Git commit message generator",
5-
"version": "0.1.4",
5+
"version": "0.1.5",
66
"license": "MIT",
77
"publisher": "codertesla",
88
"icon": "icon.png",

src/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ async function callLLM(
341341
throw new Error('No content in API response');
342342
}
343343

344-
return content.trim();
344+
// Filter out <think>...</think> tags from models that include CoT reasoning (e.g., DeepSeek-R1, MiniMax-M2.1)
345+
let result = content.trim();
346+
result = result.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
347+
348+
return result;
345349
}
346350

347351
async function checkChangelog(context: vscode.ExtensionContext) {

0 commit comments

Comments
 (0)