Skip to content
194 changes: 82 additions & 112 deletions astrbot/core/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from astrbot.core.computer.booters.cua_defaults import CUA_DEFAULT_CONFIG
from astrbot.core.utils.astrbot_path import get_astrbot_data_path

VERSION = "4.25.2"
VERSION = "4.25.0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The version constant was decreased, which is likely an unintended regression.

The previous value was 4.25.2 and it is now 4.25.0. This will make the runtime appear older than prior builds and may break upgrade/version checks. If this change is not an intentional revert to an older release line, the version should be bumped forward instead of decreased.

DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db")
PERSONAL_WECHAT_CONFIG_METADATA = {
"weixin_oc_base_url": {
Expand Down Expand Up @@ -120,20 +120,18 @@
"default_personality": "default",
"persona_pool": ["*"],
"prompt_prefix": "{{prompt}}",
"context_limit_reached_strategy": "llm_compress", # or truncate_by_turns
"context_limit_reached_strategy": "truncate_by_turns", # or llm_compress
"llm_compress_instruction": (
"Based on our full conversation history, produce a concise summary of key takeaways and/or project progress.\n"
"The primary goal of this summary is to enable seamless continuation of the work that follows.\n"
"1. Systematically cover all core topics discussed and the final conclusion/outcome for each; clearly highlight the latest primary focus.\n"
"2. If any tools were used, summarize tool usage (total call count) and extract the most valuable insights from tool outputs.\n"
"3. If any materials (files, documents, code, references) were read during the conversation that may be helpful for subsequent work, list each one with its scope and path.\n"
"4. If there was an initial user goal, state it first and describe the current progress/status.\n"
"5. Write the summary in the user's language.\n"
"3. If there was an initial user goal, state it first and describe the current progress/status.\n"
"4. Write the summary in the user's language.\n"
),
"llm_compress_keep_recent_ratio": 0.15,
"llm_compress_keep_recent": 6,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The configuration key has been changed from "llm_compress_keep_recent_ratio" to "llm_compress_keep_recent" (with a default value of 6 turns). However, the actual context compressor implementation in astrbot/core/agent/context/compressor.py and astrbot/core/agent/context/config.py still expects llm_compress_keep_recent_ratio and does not implement turn-based keeping.

This mismatch will cause the new llm_compress_keep_recent setting to be completely ignored, and could potentially lead to runtime errors or fallback to default values. Please ensure that the context compressor and config classes are updated to support turn-based keeping.

"llm_compress_provider_id": "",
"max_context_length": 50,
"dequeue_context_length": 10,
"max_context_length": -1,
"dequeue_context_length": 1,
"streaming_response": False,
"show_tool_use_status": False,
"show_tool_call_result": False,
Expand Down Expand Up @@ -254,17 +252,6 @@
"host": "0.0.0.0",
"port": 6185,
"disable_access_log": True,
"trust_proxy_headers": False,
"auth_rate_limit": {
"enable": True,
"average_interval": 1.0,
"max_burst": 3,
},
"totp": {
"enable": False,
"secret": "",
"recovery_code_hash": "",
},
"ssl": {
"enable": False,
"cert_file": "",
Expand Down Expand Up @@ -1081,7 +1068,7 @@
"id_whitelist": {
"type": "list",
"items": {"type": "string"},
"hint": "只处理填写的 ID 发来的消息事件,为空时不启用。可使用 /sid 指令获取在平台上的会话 ID(类似 abc:GroupMessage:123)。管理员可在 WebUI 的平台设置中管理白名单",
"hint": "只处理填写的 ID 发来的消息事件,为空时不启用。可使用 /sid 指令获取在平台上的会话 ID(类似 abc:GroupMessage:123)。管理员可使用 /wl 添加白名单",
},
"id_whitelist_log": {
"type": "bool",
Expand Down Expand Up @@ -1250,31 +1237,6 @@
"custom_headers": {"User-Agent": "claude-code/0.1.0"},
"anth_thinking_config": {"type": "", "budget": 0, "effort": ""},
},
"Xiaomi": {
"id": "xiaomi",
"provider": "xiaomi",
"type": "xiaomi_chat_completion",
"provider_type": "chat_completion",
"enable": True,
"key": [],
"api_base": "https://api.xiaomimimo.com/v1",
"timeout": 120,
"proxy": "",
"custom_headers": {},
},
"Xiaomi Token Plan": {
"id": "xiaomi-token-plan",
"provider": "xiaomi-token-plan",
"type": "xiaomi_token_plan",
"provider_type": "chat_completion",
"enable": True,
"key": [],
"api_base": "https://token-plan-cn.xiaomimimo.com/anthropic",
"timeout": 120,
"proxy": "",
"custom_headers": {"User-Agent": "claude-code/0.1.0"},
"anth_thinking_config": {"type": "", "budget": 0, "effort": ""},
},
"xAI": {
"id": "xai",
"provider": "xai",
Expand Down Expand Up @@ -1778,19 +1740,28 @@
"timeout": 20,
"proxy": "",
},
# [PATCH: 2026-06-03] 升级为 V3 API 配置项
# 旧字段 appid/volcengine_cluster/volcengine_voice_type/volcengine_speed_ratio 已移除
# 新字段: resource_id(模型选择), speaker(音色), speech_rate(语调), loudness_rate(音量), pitch(音调), emotion(情感), model(子模型)
"火山引擎_TTS(API)": {
"id": "volcengine_tts",
"type": "volcengine_tts",
"provider": "volcengine",
"provider_type": "text_to_speech",
"enable": False,
"api_key": "",
"appid": "",
"volcengine_cluster": "volcano_tts",
"volcengine_voice_type": "",
"volcengine_speed_ratio": 1.0,
"api_base": "https://openspeech.bytedance.com/api/v1/tts",
"timeout": 20,
"resource_id": "seed-tts-2.0",
"speaker": "",
"format": "mp3",
"sample_rate": 24000,
"bit_rate": 128000,
"speech_rate": 0,
"loudness_rate": 0,
"pitch": 0,
"emotion": "",
"model": "",
"api_base": "https://openspeech.bytedance.com/api/v3/tts/unidirectional",
"timeout": 30,
"proxy": "",
},
"Gemini TTS": {
Expand Down Expand Up @@ -2053,8 +2024,8 @@
},
"max_tokens": {
"name": "Max Tokens",
"description": "最大词元(Tokens)数",
"hint": "生成的最大词元(Tokens)数。",
"description": "最大令牌数",
"hint": "生成的最大令牌数。",
"type": "int",
"default": 8192,
},
Expand Down Expand Up @@ -2203,25 +2174,57 @@
"description": "API Base URL",
"type": "string",
},
"volcengine_cluster": {
# [PATCH: 2026-06-03] V3 API 字段元数据
# 旧字段 volcengine_cluster/volcengine_voice_type/volcengine_speed_ratio/volcengine_volume_ratio 已移除
"resource_id": {
"type": "string",
"description": "火山引擎集群",
"hint": "若使用语音复刻大模型,可选volcano_icl或volcano_icl_concurr,默认使用volcano_tts",
"description": "模型/资源选择",
"hint": "seed-tts-2.0(语音合成2.0) | seed-tts-1.0(语音合成1.0) | seed-icl-2.0(声音复刻2.0) | seed-icl-1.0(声音复刻1.0)",
},
"volcengine_voice_type": {
"speaker": {
"type": "string",
"description": "火山引擎音色",
"hint": "输入声音id(Voice_type)",
"description": "发音人",
"hint": "音色ID,如 zh_female_meilinvyou_uranus_bigtts。详见 https://www.volcengine.com/docs/6561/1257544",
},
"volcengine_speed_ratio": {
"type": "float",
"description": "语速设置",
"hint": "语速设置,范围为 0.2 到 3.0,默认值为 1.0",
"format": {
"type": "string",
"description": "音频格式",
"hint": "mp3 / ogg_opus / pcm",
},
"volcengine_volume_ratio": {
"type": "float",
"description": "音量设置",
"hint": "音量设置,范围为 0.0 到 2.0,默认值为 1.0",
"sample_rate": {
"type": "int",
"description": "采样率",
"hint": "8000/16000/22050/24000/32000/44100/48000",
},
"bit_rate": {
"type": "int",
"description": "比特率",
"hint": "MP3格式建议128000,不传则默认8k音质差",
},
"speech_rate": {
"type": "int",
"description": "语调(语速)",
"hint": "范围-50~100,默认0。100=2倍速,-50=0.5倍速",
},
"loudness_rate": {
"type": "int",
"description": "音量",
"hint": "范围-50~100,默认0。100=2倍音量,-50=0.5倍音量",
},
"pitch": {
"type": "int",
"description": "音调",
"hint": "范围-12~12,默认0。正值升调,负值降调",
},
"emotion": {
"type": "string",
"description": "情感",
"hint": "如 tender/happy/sad/storytelling。仅部分音色支持",
},
"model": {
"type": "string",
"description": "模型子类型",
"hint": "仅 seed-icl-2.0 (声音复刻2.0) 生效: seed-icl-2.0-standard(标准) / seed-icl-2.0-expressive(表现力)",
},
"azure_tts_voice": {
"type": "string",
Expand Down Expand Up @@ -2998,10 +3001,6 @@
"options": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
},
"dashboard.ssl.enable": {"type": "bool"},
"dashboard.trust_proxy_headers": {"type": "bool"},
"dashboard.auth_rate_limit.enable": {"type": "bool"},
"dashboard.auth_rate_limit.average_interval": {"type": "float"},
"dashboard.auth_rate_limit.max_burst": {"type": "int"},
"dashboard.ssl.cert_file": {
"type": "string",
"condition": {"dashboard.ssl.enable": True},
Expand Down Expand Up @@ -3547,30 +3546,30 @@
"type": "object",
"items": {
"provider_settings.max_context_length": {
"description": "压缩前最多保留对话轮数",
"description": "最多携带对话轮数",
"type": "int",
"hint": "普通会话历史超过该轮数后,才会按下方策略进行持久化截断或 LLM 压缩;请求发送前也会先按该值约束上下文。-1 表示不按轮数限制。",
"hint": "超出这个数量时丢弃最旧的部分,一轮聊天记为 1 条,-1 为不限制",
"condition": {
"provider_settings.agent_runner_type": "local",
},
},
"provider_settings.dequeue_context_length": {
"description": "轮次超限时一次丢弃轮数",
"description": "丢弃对话轮数",
"type": "int",
"hint": "当超过“压缩前最多保留对话轮数”且无法使用 LLM 压缩时,一次丢弃多少轮旧对话;请求期截断也会复用该值。",
"hint": "超出最多携带对话轮数时, 一次丢弃的聊天轮数",
"condition": {
"provider_settings.agent_runner_type": "local",
},
},
"provider_settings.context_limit_reached_strategy": {
"description": "历史超限或上下文接近上限时的处理方式",
"description": "超出模型上下文窗口时的处理方式",
"type": "string",
"options": ["truncate_by_turns", "llm_compress"],
"labels": ["按对话轮数截断", "由 LLM 压缩上下文"],
"condition": {
"provider_settings.agent_runner_type": "local",
},
"hint": "普通会话历史仅在超过“压缩前最多保留对话轮数”后执行该策略;请求发送前也会在上下文 token 接近模型窗口时使用同一策略保护本次请求。",
"hint": "",
},
"provider_settings.llm_compress_instruction": {
"description": "上下文压缩提示词",
Expand All @@ -3581,11 +3580,10 @@
"provider_settings.agent_runner_type": "local",
},
},
"provider_settings.llm_compress_keep_recent_ratio": {
"description": "压缩时保留最近上下文比例",
"type": "float",
"slider": {"min": 0, "max": 0.3, "step": 0.01},
"hint": "按当前上下文 token 数保留最近内容,范围 0-0.3。0.15 表示保留 15%;比例大于 0 时至少保留最后一轮。",
"provider_settings.llm_compress_keep_recent": {
"description": "压缩时保留最近对话轮数",
"type": "int",
"hint": "始终保留的最近 N 轮对话。",
"condition": {
"provider_settings.context_limit_reached_strategy": "llm_compress",
"provider_settings.agent_runner_type": "local",
Expand All @@ -3595,7 +3593,7 @@
"description": "用于上下文压缩的模型提供商 ID",
"type": "string",
"_special": "select_provider",
"hint": "留空时使用当前聊天模型进行压缩;如果模型不可用或压缩失败,将回退为“按对话轮数截断”的策略。",
"hint": "留空时将降级为“按对话轮数截断”的策略。",
"condition": {
"provider_settings.context_limit_reached_strategy": "llm_compress",
"provider_settings.agent_runner_type": "local",
Expand Down Expand Up @@ -4245,34 +4243,6 @@
"type": "bool",
"hint": "启用后,WebUI 将直接使用 HTTPS 提供服务。",
},
"dashboard.trust_proxy_headers": {
"description": "信任代理请求头获取客户端 IP",
"type": "bool",
"hint": "关闭时忽略 X-Forwarded-For/X-Real-IP,仅使用连接地址。",
},
"dashboard.auth_rate_limit.enable": {
"description": "启用登录验证速率限制",
"type": "bool",
"hint": "关闭后将不对登录、TOTP 等身份验证接口进行速率限制。",
},
"dashboard.auth_rate_limit.average_interval": {
"description": "验证端点速率限制平均间隔(秒)",
"type": "float",
"hint": "两次身份验证请求之间的最小平均间隔时间。例如设置为 1.0 表示每秒最多处理 1 个请求。",
"condition": {"dashboard.auth_rate_limit.enable": True},
},
"dashboard.auth_rate_limit.max_burst": {
"description": "验证端点速率限制最大突发数",
"type": "int",
"hint": "允许的瞬时最大突发请求数。例如设置为 3 表示在短时间内最多连续处理 3 个请求。",
"condition": {"dashboard.auth_rate_limit.enable": True},
},
"dashboard.totp.enable": {
"description": "启用 WebUI TOTP 双因素认证",
"type": "bool",
"hint": "启用后,登录 WebUI 需要额外输入验证码。",
"_special": "dashboard_totp_manager",
},
"dashboard.ssl.cert_file": {
"description": "SSL 证书文件路径",
"type": "string",
Expand Down
Loading