fix: 移除 Markdown 消息中的工具使用标签

This commit is contained in:
kuaifan 2026-01-13 12:57:54 +00:00
parent 42e4ddbd17
commit 4f2d382fd6
2 changed files with 2 additions and 0 deletions

View File

@ -713,6 +713,7 @@ class WebSocketDialogMsg extends AbstractModel
$text = $msgData['text'] ?? ''; $text = $msgData['text'] ?? '';
if (!$text) return ''; if (!$text) return '';
if ($msgData['type'] === 'md') { if ($msgData['type'] === 'md') {
$text = preg_replace('/<\/?tool-use[^>]*>/', '', $text);
$text = preg_replace("/:::\s*reasoning[\s\S]*?:::/", "", $text); $text = preg_replace("/:::\s*reasoning[\s\S]*?:::/", "", $text);
if (preg_match('/:::\s*reasoning\s+/', $text)) { if (preg_match('/:::\s*reasoning\s+/', $text)) {
return Doo::translate('思考中...'); return Doo::translate('思考中...');

View File

@ -269,6 +269,7 @@ import {convertLocalResourcePath} from "../components/Replace/utils";
return ''; return '';
} }
if (type === 'md') { if (type === 'md') {
text = text.replace(/<\/?tool-use[^>]*>/g, '');
text = text.replace(/:::\s*reasoning[\s\S]*?:::/g, ""); text = text.replace(/:::\s*reasoning[\s\S]*?:::/g, "");
if (/:::\s*reasoning\s+/.test(text)) { if (/:::\s*reasoning\s+/.test(text)) {
return $A.L('思考中...') return $A.L('思考中...')