From 03b11481ed03d890446e5d811ddcca446c403724 Mon Sep 17 00:00:00 2001
From: Dong_master <2213070223@qq.com>
Date: Sun, 10 Aug 2025 00:28:55 +0800
Subject: [PATCH] fix:fix remove_think logic, and end fix
---
pkg/provider/modelmgr/requesters/anthropicmsgs.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/pkg/provider/modelmgr/requesters/anthropicmsgs.py b/pkg/provider/modelmgr/requesters/anthropicmsgs.py
index 0c73068c..f89fb136 100644
--- a/pkg/provider/modelmgr/requesters/anthropicmsgs.py
+++ b/pkg/provider/modelmgr/requesters/anthropicmsgs.py
@@ -299,12 +299,12 @@ class AnthropicMessages(requester.ProviderAPIRequester):
async for chunk in await self.client.messages.create(**args):
# print(chunk)
if isinstance(chunk, anthropic.types.raw_content_block_start_event.RawContentBlockStartEvent): # 记录开始
- if chunk.content_block.type == 'thinking' and not remove_think:
- think_started = True
- continue
- elif chunk.content_block.type == 'text' and not remove_think:
- think_ended = True
- continue
+ if not remove_think:
+ if chunk.content_block.type == 'thinking':
+ think_started = True
+ elif chunk.content_block.type == 'text':
+ think_ended = True
+ continue
elif isinstance(chunk, anthropic.types.raw_content_block_delta_event.RawContentBlockDeltaEvent):
if chunk.delta.type == "thinking_delta":
if think_started:
@@ -317,7 +317,7 @@ class AnthropicMessages(requester.ProviderAPIRequester):
elif chunk.delta.type == "text_delta":
if think_ended:
think_ended = False
- content = '\n\n' + chunk.delta.text
+ content = '\n\n' + chunk.delta.text
else:
content = chunk.delta.text
elif isinstance(chunk, anthropic.types.raw_content_block_stop_event.RawContentBlockStopEvent):