mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
Update astrbot/core/provider/sources/xiaomi_token_plan_source.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -46,11 +46,12 @@ class ProviderXiaomiTokenPlan(ProviderAnthropic):
|
||||
provider_config["api_base"] = "https://token-plan-cn.xiaomimimo.com/anthropic"
|
||||
|
||||
# Xiaomi Token Plan requires the Authorization: Bearer <token> header.
|
||||
key = provider_config.get("key", "")
|
||||
actual_key = key[0] if isinstance(key, list) else key
|
||||
provider_config.setdefault("custom_headers", {})["Authorization"] = (
|
||||
f"Bearer {actual_key}"
|
||||
)
|
||||
keys = provider_config.get("key", [])
|
||||
actual_key = keys[0] if isinstance(keys, list) and keys else keys
|
||||
if actual_key:
|
||||
provider_config.setdefault("custom_headers", {})["Authorization"] = (
|
||||
f"Bearer {actual_key}"
|
||||
)
|
||||
|
||||
super().__init__(
|
||||
provider_config,
|
||||
|
||||
Reference in New Issue
Block a user