fix(aibox): reasoning展示严格遵循配置文件reasoning_enabled开关
之前即使reasoning_enabled=false,模型自发返回的reasoning_content 仍会被动态展示——配置只管了API请求参数,不管展示逻辑。 现在添加constants.REASONING_ENABLED门控,关着时静默忽略。
This commit is contained in:
1 parent
b216535757
commit
918f3ea32a
1 file changed
+4
-7
+4
-7
@@ -7340,19 +7340,16 @@ class DeepSeekChat:
|
|||||||
|
|
||||||
delta = choices[0].get('delta', {})
|
delta = choices[0].get('delta', {})
|
||||||
|
|
||||||
# 【关键】处理 reasoning_content(思考内容)
|
# 【关键】处理 reasoning_content(思考内容),仅当配置启用时才展示
|
||||||
if 'reasoning_content' in delta and delta['reasoning_content']:
|
if constants.REASONING_ENABLED and 'reasoning_content' in delta and delta['reasoning_content']:
|
||||||
reasoning = delta['reasoning_content']
|
reasoning = delta['reasoning_content']
|
||||||
full_reasoning += reasoning
|
full_reasoning += reasoning
|
||||||
|
|
||||||
# 发送思考开始信号(仅第一次,且未提前发送过)
|
# 发送思考开始信号(仅第一次)
|
||||||
if not reasoning_started and output_callback:
|
if not reasoning_started and output_callback:
|
||||||
if not constants.REASONING_ENABLED:
|
|
||||||
# 非显式思考模式但模型返回了思考内容,动态发送开始信号
|
|
||||||
output_callback("reasoning_start", "🤔 思考中...")
|
|
||||||
reasoning_started = True
|
reasoning_started = True
|
||||||
|
|
||||||
# 实时发送思考内容给前端(无需debug_level限制)
|
# 实时发送思考内容给前端
|
||||||
if output_callback:
|
if output_callback:
|
||||||
output_callback("reasoning", reasoning)
|
output_callback("reasoning", reasoning)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user