Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions astrbot/core/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -2391,13 +2391,13 @@
"type": {
"description": "思考类型",
"type": "string",
"options": ["", "adaptive"],
"hint": "Opus 4.6+ / Sonnet 4.6+ 推荐设为 'adaptive'。留空则使用手动 budget 模式。参见: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking",
"options": ["", "adaptive", "enabled", "disabled"],
"hint": "'adaptive' 自适应模式 (推荐 Opus 4.6+/Sonnet 4.6+)。'enabled' 手动启用思考。留空则使用手动 budget 模式。参见: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking",
},
"budget": {
"description": "思考预算",
"type": "int",
"hint": "手动 budget_tokens,需 >= 1024。仅在 type 为空时生效。Opus 4.6 / Sonnet 4.6 上已弃用。参见: https://platform.claude.com/docs/en/build-with-claude/extended-thinking",
"hint": "手动 budget_tokens,需 >= 1024。 type 为空或 enabled 时生效。Opus 4.6 / Sonnet 4.6 上已弃用。参见: https://platform.claude.com/docs/en/build-with-claude/extended-thinking",
},
"effort": {
"description": "思考深度",
Expand Down
15 changes: 10 additions & 5 deletions astrbot/core/provider/sources/anthropic_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,16 @@ def _apply_thinking_config(self, payloads: dict) -> None:
output_cfg["effort"] = effort
if output_cfg:
payloads["output_config"] = output_cfg
elif not thinking_type and self.thinking_config.get("budget"):
payloads["thinking"] = {
"budget_tokens": self.thinking_config.get("budget"),
"type": "enabled",
}
elif thinking_type == "enabled" or (
not thinking_type and self.thinking_config.get("budget")
):
payloads["thinking"] = {"type": "enabled"}
if self.thinking_config.get("budget"):
payloads["thinking"]["budget_tokens"] = self.thinking_config.get(
"budget"
)
elif thinking_type == "disabled":
payloads["thinking"] = {"type": "disabled"}

def _prepare_payload(self, messages: list[dict]):
"""准备 Anthropic API 的请求 payload
Expand Down
Loading