11"""如需修改配置,请在 `data/cmd_config.json` 中修改或者在管理面板中可视化修改。"""
22
33import os
4- from typing import Any , TypedDict
54
65from astrbot .core .computer .booters .cua_defaults import CUA_DEFAULT_CONFIG
76from astrbot .core .utils .astrbot_path import get_astrbot_data_path
316315}
317316
318317
319- class ChatProviderTemplate (TypedDict ):
320- id : str
321- provider_source_id : str
322- model : str
323- modalities : list
324- custom_extra_body : dict [str , Any ]
325- max_context_tokens : int
326-
327-
328- CHAT_PROVIDER_TEMPLATE = {
329- "id" : "" ,
330- "provide_source_id" : "" ,
331- "model" : "" ,
332- "modalities" : [],
333- "custom_extra_body" : {},
334- "max_context_tokens" : 0 ,
335- }
336-
337318"""
338319AstrBot v3 时代的配置元数据,目前仅承担以下功能:
339320
@@ -1992,13 +1973,13 @@ class ChatProviderTemplate(TypedDict):
19921973 "options" : ["text" , "image" , "audio" , "tool_use" ],
19931974 "labels" : ["文本" , "图像" , "音频" , "工具使用" ],
19941975 "render_type" : "checkbox" ,
1995- "hint" : "模型支持的模态。如所填写的模型不支持图像,请取消勾选图像 。" ,
1976+ "hint" : "模型支持的模态及能力 。" ,
19961977 },
19971978 "custom_headers" : {
1998- "description" : "自定义添加请求头 " ,
1979+ "description" : "自定义请求头 " ,
19991980 "type" : "dict" ,
20001981 "items" : {},
2001- "hint" : "此处添加的键值对将被合并到 OpenAI SDK 的 default_headers 中,用于自定义 HTTP 请求头。值必须为字符串。 " ,
1982+ "hint" : "此处添加的键值对将被合并到 OpenAI SDK 的 default_headers 中,用于自定义 HTTP 请求头。" ,
20021983 },
20031984 "ollama_disable_thinking" : {
20041985 "description" : "关闭思考模式" ,
@@ -2009,7 +1990,7 @@ class ChatProviderTemplate(TypedDict):
20091990 "description" : "自定义请求体参数" ,
20101991 "type" : "dict" ,
20111992 "items" : {},
2012- "hint" : "用于在请求时添加额外的参数,如 temperature、 top_p、 max_tokens 等。" ,
1993+ "hint" : "用于在请求时添加额外的参数,如 temperature, top_p, max_tokens, reasoning_effort 等。" ,
20131994 "template_schema" : {
20141995 "temperature" : {
20151996 "name" : "Temperature" ,
@@ -2652,7 +2633,7 @@ class ChatProviderTemplate(TypedDict):
26522633 "max_context_tokens" : {
26532634 "description" : "模型上下文窗口大小" ,
26542635 "type" : "int" ,
2655- "hint" : "模型最大上下文 Token 大小。如果为 0,则会自动从模型元数据填充(如有),也可手动修改。 " ,
2636+ "hint" : "模型最大上下文 Token 大小。如果为 0,则会自动从模型元数据填充(如有)" ,
26562637 },
26572638 "dify_api_key" : {
26582639 "description" : "API Key" ,
@@ -3566,6 +3547,14 @@ class ChatProviderTemplate(TypedDict):
35663547 "provider_settings.agent_runner_type" : "local" ,
35673548 },
35683549 },
3550+ "provider_settings.fallback_max_context_tokens" : {
3551+ "description" : "上下文窗口兜底值" ,
3552+ "type" : "int" ,
3553+ "hint" : "当 max_context_tokens 为 0 且模型不在内置元数据中时,使用此值作为上下文窗口大小。默认 128000。" ,
3554+ "condition" : {
3555+ "provider_settings.agent_runner_type" : "local" ,
3556+ },
3557+ },
35693558 },
35703559 "condition" : {
35713560 "provider_settings.agent_runner_type" : "local" ,
0 commit comments