diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index b4a4f649c..15931fff5 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -1,5 +1,6 @@ import base64 import json +import re from openai import AsyncOpenAI, NOT_GIVEN from openai.types.chat.chat_completion import ChatCompletion @@ -128,6 +129,12 @@ class ProviderOpenAIOfficial(Provider): if choice.message.content: # text completion completion_text = str(choice.message.content).strip() + + # ้€‚้… deepseek-r1 ๆจกๅž‹ + if r'' in completion_text: + completion_text = re.sub(r'.*?', '', completion_text).strip() + completion_text = completion_text.replace(r'', '').replace(r'', '').strip() + return LLMResponse("assistant", completion_text) elif choice.message.tool_calls: # tools call (function calling)