Skip to content

Commit f5b3d94

Browse files
committed
fix: 修正thinking_config
1 parent 4d1a699 commit f5b3d94

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

astrbot/core/config/default.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@
569569
"dangerous_content": "BLOCK_MEDIUM_AND_ABOVE",
570570
},
571571
"gm_thinking_config": {
572-
"enable": False,
573572
"budget": 0,
574573
},
575574
},
@@ -809,15 +808,10 @@
809808
"description": "Gemini思考设置",
810809
"type": "object",
811810
"items": {
812-
"enable": {
813-
"description": "启用思考",
814-
"type": "bool",
815-
"hint": "启用后,模型将在可用时输出思考过程",
816-
},
817811
"budget": {
818812
"description": "思考预算",
819813
"type": "int",
820-
"hint": "模型应该生成的思考Token的数量",
814+
"hint": "模型应该生成的思考Token的数量,设为0关闭思考。除gemini-2.5-flash外的模型会静默忽略此参数。",
821815
},
822816
},
823817
},

astrbot/core/provider/sources/gemini_source.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,17 @@ async def _prepare_query_config(
179179
tools=tool_list,
180180
safety_settings=self.safety_settings if self.safety_settings else None,
181181
thinking_config=types.ThinkingConfig(
182-
include_thoughts=self.provider_config.get("gm_thinking_config", {}).get(
183-
"enable", False
184-
),
185-
thinking_budget=self.provider_config.get("gm_thinking_config", {}).get(
186-
"budget", 0
182+
thinking_budget=min(
183+
int(
184+
self.provider_config.get("gm_thinking_config", {}).get(
185+
"budget", 0
186+
)
187+
),
188+
24576,
187189
),
188-
),
190+
)
191+
if "gemini-2.5-flash" in self.get_model()
192+
else None,
189193
automatic_function_calling=types.AutomaticFunctionCallingConfig(
190194
disable=True
191195
),

0 commit comments

Comments
 (0)