From 85efc6e96b3298330da1306dbcc6dc1b2b91f89f Mon Sep 17 00:00:00 2001 From: gyuannn Date: Thu, 6 Feb 2025 01:42:29 +0800 Subject: [PATCH] feat: Improve handling of think tags --- src/renderer/src/utils/formats.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/utils/formats.ts b/src/renderer/src/utils/formats.ts index 901f5975..be0e37ba 100644 --- a/src/renderer/src/utils/formats.ts +++ b/src/renderer/src/utils/formats.ts @@ -87,13 +87,13 @@ export function withMessageThought(message: Message) { } const content = message.content.trim() - const thinkPattern = /(.*?)<\/think>/s + const thinkPattern = /^(.*?)<\/think>/s const matches = content.match(thinkPattern) if (!matches) { // 处理未闭合的 think 标签情况 if (content.startsWith('')) { - message.reasoning_content = content.replace('', '') + message.reasoning_content = content.slice(7) // ''.length === 7 message.content = '' } return message