AstrBot 4.9.1__py3-none-any.whl → 4.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- astrbot/cli/__init__.py +1 -1
- astrbot/core/agent/message.py +6 -4
- astrbot/core/agent/response.py +22 -1
- astrbot/core/agent/run_context.py +1 -1
- astrbot/core/agent/runners/tool_loop_agent_runner.py +99 -20
- astrbot/core/astr_agent_context.py +3 -1
- astrbot/core/astr_agent_run_util.py +42 -3
- astrbot/core/astr_agent_tool_exec.py +34 -4
- astrbot/core/config/default.py +127 -184
- astrbot/core/core_lifecycle.py +3 -0
- astrbot/core/db/__init__.py +72 -0
- astrbot/core/db/po.py +59 -0
- astrbot/core/db/sqlite.py +240 -0
- astrbot/core/message/components.py +4 -5
- astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py +6 -1
- astrbot/core/pipeline/respond/stage.py +1 -1
- astrbot/core/platform/sources/telegram/tg_event.py +9 -0
- astrbot/core/platform/sources/webchat/webchat_event.py +22 -18
- astrbot/core/provider/entities.py +41 -0
- astrbot/core/provider/manager.py +203 -93
- astrbot/core/provider/sources/anthropic_source.py +55 -11
- astrbot/core/provider/sources/gemini_source.py +84 -33
- astrbot/core/provider/sources/openai_source.py +21 -6
- astrbot/core/star/__init__.py +5 -1
- astrbot/core/star/command_management.py +449 -0
- astrbot/core/star/context.py +4 -0
- astrbot/core/star/filter/command.py +1 -0
- astrbot/core/star/filter/command_group.py +1 -0
- astrbot/core/star/star_handler.py +4 -0
- astrbot/core/star/star_manager.py +14 -0
- astrbot/core/utils/llm_metadata.py +63 -0
- astrbot/core/utils/migra_helper.py +93 -0
- astrbot/core/utils/plugin_kv_store.py +28 -0
- astrbot/dashboard/routes/__init__.py +2 -0
- astrbot/dashboard/routes/chat.py +56 -13
- astrbot/dashboard/routes/command.py +82 -0
- astrbot/dashboard/routes/config.py +291 -33
- astrbot/dashboard/routes/stat.py +96 -0
- astrbot/dashboard/routes/tools.py +20 -4
- astrbot/dashboard/server.py +1 -0
- {astrbot-4.9.1.dist-info → astrbot-4.10.0.dist-info}/METADATA +2 -2
- {astrbot-4.9.1.dist-info → astrbot-4.10.0.dist-info}/RECORD +45 -41
- {astrbot-4.9.1.dist-info → astrbot-4.10.0.dist-info}/WHEEL +0 -0
- {astrbot-4.9.1.dist-info → astrbot-4.10.0.dist-info}/entry_points.txt +0 -0
- {astrbot-4.9.1.dist-info → astrbot-4.10.0.dist-info}/licenses/LICENSE +0 -0
astrbot/core/config/default.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"""如需修改配置,请在 `data/cmd_config.json` 中修改或者在管理面板中可视化修改。"""
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
from typing import Any, TypedDict
|
|
4
5
|
|
|
5
6
|
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
|
|
6
7
|
|
|
7
|
-
VERSION = "4.
|
|
8
|
+
VERSION = "4.10.0"
|
|
8
9
|
DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db")
|
|
9
10
|
|
|
10
11
|
WEBHOOK_SUPPORTED_PLATFORMS = [
|
|
@@ -61,7 +62,8 @@ DEFAULT_CONFIG = {
|
|
|
61
62
|
"ignore_bot_self_message": False,
|
|
62
63
|
"ignore_at_all": False,
|
|
63
64
|
},
|
|
64
|
-
"
|
|
65
|
+
"provider_sources": [], # provider sources
|
|
66
|
+
"provider": [], # models from provider_sources
|
|
65
67
|
"provider_settings": {
|
|
66
68
|
"enable": True,
|
|
67
69
|
"default_provider_id": "",
|
|
@@ -171,6 +173,22 @@ DEFAULT_CONFIG = {
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
|
|
176
|
+
class ChatProviderTemplate(TypedDict):
|
|
177
|
+
id: str
|
|
178
|
+
provider_source_id: str
|
|
179
|
+
model: str
|
|
180
|
+
modalities: list
|
|
181
|
+
custom_extra_body: dict[str, Any]
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
CHAT_PROVIDER_TEMPLATE = {
|
|
185
|
+
"id": "",
|
|
186
|
+
"provide_source_id": "",
|
|
187
|
+
"model": "",
|
|
188
|
+
"modalities": [],
|
|
189
|
+
"custom_extra_body": {},
|
|
190
|
+
}
|
|
191
|
+
|
|
174
192
|
"""
|
|
175
193
|
AstrBot v3 时代的配置元数据,目前仅承担以下功能:
|
|
176
194
|
|
|
@@ -209,7 +227,7 @@ CONFIG_METADATA_2 = {
|
|
|
209
227
|
"callback_server_host": "0.0.0.0",
|
|
210
228
|
"port": 6196,
|
|
211
229
|
},
|
|
212
|
-
"
|
|
230
|
+
"OneBot v11": {
|
|
213
231
|
"id": "default",
|
|
214
232
|
"type": "aiocqhttp",
|
|
215
233
|
"enable": False,
|
|
@@ -844,6 +862,7 @@ CONFIG_METADATA_2 = {
|
|
|
844
862
|
"metadata": {
|
|
845
863
|
"provider": {
|
|
846
864
|
"type": "list",
|
|
865
|
+
# provider sources templates
|
|
847
866
|
"config_template": {
|
|
848
867
|
"OpenAI": {
|
|
849
868
|
"id": "openai",
|
|
@@ -854,26 +873,49 @@ CONFIG_METADATA_2 = {
|
|
|
854
873
|
"key": [],
|
|
855
874
|
"api_base": "https://api.openai.com/v1",
|
|
856
875
|
"timeout": 120,
|
|
857
|
-
"model_config": {"model": "gpt-4o-mini", "temperature": 0.4},
|
|
858
876
|
"custom_headers": {},
|
|
859
|
-
"custom_extra_body": {},
|
|
860
|
-
"modalities": ["text", "image", "tool_use"],
|
|
861
|
-
"hint": "也兼容所有与 OpenAI API 兼容的服务。",
|
|
862
877
|
},
|
|
863
|
-
"
|
|
864
|
-
"id": "
|
|
865
|
-
"provider": "
|
|
878
|
+
"Google Gemini": {
|
|
879
|
+
"id": "google_gemini",
|
|
880
|
+
"provider": "google",
|
|
881
|
+
"type": "googlegenai_chat_completion",
|
|
882
|
+
"provider_type": "chat_completion",
|
|
883
|
+
"enable": True,
|
|
884
|
+
"key": [],
|
|
885
|
+
"api_base": "https://generativelanguage.googleapis.com/",
|
|
886
|
+
"timeout": 120,
|
|
887
|
+
"gm_resp_image_modal": False,
|
|
888
|
+
"gm_native_search": False,
|
|
889
|
+
"gm_native_coderunner": False,
|
|
890
|
+
"gm_url_context": False,
|
|
891
|
+
"gm_safety_settings": {
|
|
892
|
+
"harassment": "BLOCK_MEDIUM_AND_ABOVE",
|
|
893
|
+
"hate_speech": "BLOCK_MEDIUM_AND_ABOVE",
|
|
894
|
+
"sexually_explicit": "BLOCK_MEDIUM_AND_ABOVE",
|
|
895
|
+
"dangerous_content": "BLOCK_MEDIUM_AND_ABOVE",
|
|
896
|
+
},
|
|
897
|
+
"gm_thinking_config": {"budget": 0, "level": "HIGH"},
|
|
898
|
+
},
|
|
899
|
+
"Anthropic": {
|
|
900
|
+
"id": "anthropic",
|
|
901
|
+
"provider": "anthropic",
|
|
902
|
+
"type": "anthropic_chat_completion",
|
|
903
|
+
"provider_type": "chat_completion",
|
|
904
|
+
"enable": True,
|
|
905
|
+
"key": [],
|
|
906
|
+
"api_base": "https://api.anthropic.com/v1",
|
|
907
|
+
"timeout": 120,
|
|
908
|
+
},
|
|
909
|
+
"Moonshot": {
|
|
910
|
+
"id": "moonshot",
|
|
911
|
+
"provider": "moonshot",
|
|
866
912
|
"type": "openai_chat_completion",
|
|
867
913
|
"provider_type": "chat_completion",
|
|
868
914
|
"enable": True,
|
|
869
|
-
"api_version": "2024-05-01-preview",
|
|
870
915
|
"key": [],
|
|
871
|
-
"api_base": "",
|
|
872
916
|
"timeout": 120,
|
|
873
|
-
"
|
|
917
|
+
"api_base": "https://api.moonshot.cn/v1",
|
|
874
918
|
"custom_headers": {},
|
|
875
|
-
"custom_extra_body": {},
|
|
876
|
-
"modalities": ["text", "image", "tool_use"],
|
|
877
919
|
},
|
|
878
920
|
"xAI": {
|
|
879
921
|
"id": "xai",
|
|
@@ -884,42 +926,52 @@ CONFIG_METADATA_2 = {
|
|
|
884
926
|
"key": [],
|
|
885
927
|
"api_base": "https://api.x.ai/v1",
|
|
886
928
|
"timeout": 120,
|
|
887
|
-
"model_config": {"model": "grok-2-latest", "temperature": 0.4},
|
|
888
929
|
"custom_headers": {},
|
|
889
|
-
"custom_extra_body": {},
|
|
890
930
|
"xai_native_search": False,
|
|
891
|
-
"modalities": ["text", "image", "tool_use"],
|
|
892
931
|
},
|
|
893
|
-
"
|
|
894
|
-
"
|
|
895
|
-
"
|
|
896
|
-
"
|
|
897
|
-
"type": "anthropic_chat_completion",
|
|
932
|
+
"DeepSeek": {
|
|
933
|
+
"id": "deepseek",
|
|
934
|
+
"provider": "deepseek",
|
|
935
|
+
"type": "openai_chat_completion",
|
|
898
936
|
"provider_type": "chat_completion",
|
|
899
937
|
"enable": True,
|
|
900
938
|
"key": [],
|
|
901
|
-
"api_base": "https://api.
|
|
939
|
+
"api_base": "https://api.deepseek.com/v1",
|
|
902
940
|
"timeout": 120,
|
|
903
|
-
"
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
"
|
|
941
|
+
"custom_headers": {},
|
|
942
|
+
},
|
|
943
|
+
"Zhipu": {
|
|
944
|
+
"id": "zhipu",
|
|
945
|
+
"provider": "zhipu",
|
|
946
|
+
"type": "zhipu_chat_completion",
|
|
947
|
+
"provider_type": "chat_completion",
|
|
948
|
+
"enable": True,
|
|
949
|
+
"key": [],
|
|
950
|
+
"timeout": 120,
|
|
951
|
+
"api_base": "https://open.bigmodel.cn/api/paas/v4/",
|
|
952
|
+
"custom_headers": {},
|
|
953
|
+
},
|
|
954
|
+
"Azure OpenAI": {
|
|
955
|
+
"id": "azure_openai",
|
|
956
|
+
"provider": "azure",
|
|
957
|
+
"type": "openai_chat_completion",
|
|
958
|
+
"provider_type": "chat_completion",
|
|
959
|
+
"enable": True,
|
|
960
|
+
"api_version": "2024-05-01-preview",
|
|
961
|
+
"key": [],
|
|
962
|
+
"api_base": "",
|
|
963
|
+
"timeout": 120,
|
|
964
|
+
"custom_headers": {},
|
|
909
965
|
},
|
|
910
966
|
"Ollama": {
|
|
911
|
-
"
|
|
912
|
-
"id": "ollama_default",
|
|
967
|
+
"id": "ollama",
|
|
913
968
|
"provider": "ollama",
|
|
914
969
|
"type": "openai_chat_completion",
|
|
915
970
|
"provider_type": "chat_completion",
|
|
916
971
|
"enable": True,
|
|
917
972
|
"key": ["ollama"], # ollama 的 key 默认是 ollama
|
|
918
|
-
"api_base": "http://
|
|
919
|
-
"model_config": {"model": "llama3.1-8b", "temperature": 0.4},
|
|
973
|
+
"api_base": "http://127.0.0.1:11434/v1",
|
|
920
974
|
"custom_headers": {},
|
|
921
|
-
"custom_extra_body": {},
|
|
922
|
-
"modalities": ["text", "image", "tool_use"],
|
|
923
975
|
},
|
|
924
976
|
"LM Studio": {
|
|
925
977
|
"id": "lm_studio",
|
|
@@ -928,75 +980,33 @@ CONFIG_METADATA_2 = {
|
|
|
928
980
|
"provider_type": "chat_completion",
|
|
929
981
|
"enable": True,
|
|
930
982
|
"key": ["lmstudio"],
|
|
931
|
-
"api_base": "http://
|
|
932
|
-
"model_config": {
|
|
933
|
-
"model": "llama-3.1-8b",
|
|
934
|
-
},
|
|
983
|
+
"api_base": "http://127.0.0.1:1234/v1",
|
|
935
984
|
"custom_headers": {},
|
|
936
|
-
"custom_extra_body": {},
|
|
937
|
-
"modalities": ["text", "image", "tool_use"],
|
|
938
985
|
},
|
|
939
|
-
"
|
|
940
|
-
"id": "
|
|
941
|
-
"provider": "
|
|
986
|
+
"ModelStack": {
|
|
987
|
+
"id": "modelstack",
|
|
988
|
+
"provider": "modelstack",
|
|
942
989
|
"type": "openai_chat_completion",
|
|
943
990
|
"provider_type": "chat_completion",
|
|
944
991
|
"enable": True,
|
|
945
992
|
"key": [],
|
|
946
|
-
"api_base": "https://
|
|
993
|
+
"api_base": "https://modelstack.app/v1",
|
|
947
994
|
"timeout": 120,
|
|
948
|
-
"model_config": {
|
|
949
|
-
"model": "gemini-1.5-flash",
|
|
950
|
-
"temperature": 0.4,
|
|
951
|
-
},
|
|
952
995
|
"custom_headers": {},
|
|
953
|
-
"custom_extra_body": {},
|
|
954
|
-
"modalities": ["text", "image", "tool_use"],
|
|
955
996
|
},
|
|
956
|
-
"
|
|
957
|
-
"id": "
|
|
997
|
+
"Gemini_OpenAI_API": {
|
|
998
|
+
"id": "google_gemini_openai",
|
|
958
999
|
"provider": "google",
|
|
959
|
-
"type": "googlegenai_chat_completion",
|
|
960
|
-
"provider_type": "chat_completion",
|
|
961
|
-
"enable": True,
|
|
962
|
-
"key": [],
|
|
963
|
-
"api_base": "https://generativelanguage.googleapis.com/",
|
|
964
|
-
"timeout": 120,
|
|
965
|
-
"model_config": {
|
|
966
|
-
"model": "gemini-2.0-flash-exp",
|
|
967
|
-
"temperature": 0.4,
|
|
968
|
-
},
|
|
969
|
-
"gm_resp_image_modal": False,
|
|
970
|
-
"gm_native_search": False,
|
|
971
|
-
"gm_native_coderunner": False,
|
|
972
|
-
"gm_url_context": False,
|
|
973
|
-
"gm_safety_settings": {
|
|
974
|
-
"harassment": "BLOCK_MEDIUM_AND_ABOVE",
|
|
975
|
-
"hate_speech": "BLOCK_MEDIUM_AND_ABOVE",
|
|
976
|
-
"sexually_explicit": "BLOCK_MEDIUM_AND_ABOVE",
|
|
977
|
-
"dangerous_content": "BLOCK_MEDIUM_AND_ABOVE",
|
|
978
|
-
},
|
|
979
|
-
"gm_thinking_config": {
|
|
980
|
-
"budget": 0,
|
|
981
|
-
},
|
|
982
|
-
"modalities": ["text", "image", "tool_use"],
|
|
983
|
-
},
|
|
984
|
-
"DeepSeek": {
|
|
985
|
-
"id": "deepseek_default",
|
|
986
|
-
"provider": "deepseek",
|
|
987
1000
|
"type": "openai_chat_completion",
|
|
988
1001
|
"provider_type": "chat_completion",
|
|
989
1002
|
"enable": True,
|
|
990
1003
|
"key": [],
|
|
991
|
-
"api_base": "https://
|
|
1004
|
+
"api_base": "https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
992
1005
|
"timeout": 120,
|
|
993
|
-
"model_config": {"model": "deepseek-chat", "temperature": 0.4},
|
|
994
1006
|
"custom_headers": {},
|
|
995
|
-
"custom_extra_body": {},
|
|
996
|
-
"modalities": ["text", "tool_use"],
|
|
997
1007
|
},
|
|
998
1008
|
"Groq": {
|
|
999
|
-
"id": "
|
|
1009
|
+
"id": "groq",
|
|
1000
1010
|
"provider": "groq",
|
|
1001
1011
|
"type": "groq_chat_completion",
|
|
1002
1012
|
"provider_type": "chat_completion",
|
|
@@ -1004,13 +1014,7 @@ CONFIG_METADATA_2 = {
|
|
|
1004
1014
|
"key": [],
|
|
1005
1015
|
"api_base": "https://api.groq.com/openai/v1",
|
|
1006
1016
|
"timeout": 120,
|
|
1007
|
-
"model_config": {
|
|
1008
|
-
"model": "openai/gpt-oss-20b",
|
|
1009
|
-
"temperature": 0.4,
|
|
1010
|
-
},
|
|
1011
1017
|
"custom_headers": {},
|
|
1012
|
-
"custom_extra_body": {},
|
|
1013
|
-
"modalities": ["text", "tool_use"],
|
|
1014
1018
|
},
|
|
1015
1019
|
"302.AI": {
|
|
1016
1020
|
"id": "302ai",
|
|
@@ -1021,12 +1025,9 @@ CONFIG_METADATA_2 = {
|
|
|
1021
1025
|
"key": [],
|
|
1022
1026
|
"api_base": "https://api.302.ai/v1",
|
|
1023
1027
|
"timeout": 120,
|
|
1024
|
-
"model_config": {"model": "gpt-4.1-mini", "temperature": 0.4},
|
|
1025
1028
|
"custom_headers": {},
|
|
1026
|
-
"custom_extra_body": {},
|
|
1027
|
-
"modalities": ["text", "image", "tool_use"],
|
|
1028
1029
|
},
|
|
1029
|
-
"
|
|
1030
|
+
"SiliconFlow": {
|
|
1030
1031
|
"id": "siliconflow",
|
|
1031
1032
|
"provider": "siliconflow",
|
|
1032
1033
|
"type": "openai_chat_completion",
|
|
@@ -1035,15 +1036,9 @@ CONFIG_METADATA_2 = {
|
|
|
1035
1036
|
"key": [],
|
|
1036
1037
|
"timeout": 120,
|
|
1037
1038
|
"api_base": "https://api.siliconflow.cn/v1",
|
|
1038
|
-
"model_config": {
|
|
1039
|
-
"model": "deepseek-ai/DeepSeek-V3",
|
|
1040
|
-
"temperature": 0.4,
|
|
1041
|
-
},
|
|
1042
1039
|
"custom_headers": {},
|
|
1043
|
-
"custom_extra_body": {},
|
|
1044
|
-
"modalities": ["text", "image", "tool_use"],
|
|
1045
1040
|
},
|
|
1046
|
-
"PPIO
|
|
1041
|
+
"PPIO": {
|
|
1047
1042
|
"id": "ppio",
|
|
1048
1043
|
"provider": "ppio",
|
|
1049
1044
|
"type": "openai_chat_completion",
|
|
@@ -1052,14 +1047,9 @@ CONFIG_METADATA_2 = {
|
|
|
1052
1047
|
"key": [],
|
|
1053
1048
|
"api_base": "https://api.ppinfra.com/v3/openai",
|
|
1054
1049
|
"timeout": 120,
|
|
1055
|
-
"model_config": {
|
|
1056
|
-
"model": "deepseek/deepseek-r1",
|
|
1057
|
-
"temperature": 0.4,
|
|
1058
|
-
},
|
|
1059
1050
|
"custom_headers": {},
|
|
1060
|
-
"custom_extra_body": {},
|
|
1061
1051
|
},
|
|
1062
|
-
"
|
|
1052
|
+
"TokenPony": {
|
|
1063
1053
|
"id": "tokenpony",
|
|
1064
1054
|
"provider": "tokenpony",
|
|
1065
1055
|
"type": "openai_chat_completion",
|
|
@@ -1068,14 +1058,9 @@ CONFIG_METADATA_2 = {
|
|
|
1068
1058
|
"key": [],
|
|
1069
1059
|
"api_base": "https://api.tokenpony.cn/v1",
|
|
1070
1060
|
"timeout": 120,
|
|
1071
|
-
"model_config": {
|
|
1072
|
-
"model": "kimi-k2-instruct-0905",
|
|
1073
|
-
"temperature": 0.7,
|
|
1074
|
-
},
|
|
1075
1061
|
"custom_headers": {},
|
|
1076
|
-
"custom_extra_body": {},
|
|
1077
1062
|
},
|
|
1078
|
-
"
|
|
1063
|
+
"Compshare": {
|
|
1079
1064
|
"id": "compshare",
|
|
1080
1065
|
"provider": "compshare",
|
|
1081
1066
|
"type": "openai_chat_completion",
|
|
@@ -1084,42 +1069,18 @@ CONFIG_METADATA_2 = {
|
|
|
1084
1069
|
"key": [],
|
|
1085
1070
|
"api_base": "https://api.modelverse.cn/v1",
|
|
1086
1071
|
"timeout": 120,
|
|
1087
|
-
"model_config": {
|
|
1088
|
-
"model": "moonshotai/Kimi-K2-Instruct",
|
|
1089
|
-
},
|
|
1090
1072
|
"custom_headers": {},
|
|
1091
|
-
"custom_extra_body": {},
|
|
1092
|
-
"modalities": ["text", "image", "tool_use"],
|
|
1093
1073
|
},
|
|
1094
|
-
"
|
|
1095
|
-
"id": "
|
|
1096
|
-
"provider": "
|
|
1074
|
+
"ModelScope": {
|
|
1075
|
+
"id": "modelscope",
|
|
1076
|
+
"provider": "modelscope",
|
|
1097
1077
|
"type": "openai_chat_completion",
|
|
1098
1078
|
"provider_type": "chat_completion",
|
|
1099
1079
|
"enable": True,
|
|
1100
1080
|
"key": [],
|
|
1101
1081
|
"timeout": 120,
|
|
1102
|
-
"api_base": "https://api.
|
|
1103
|
-
"model_config": {"model": "moonshot-v1-8k", "temperature": 0.4},
|
|
1104
|
-
"custom_headers": {},
|
|
1105
|
-
"custom_extra_body": {},
|
|
1106
|
-
"modalities": ["text", "image", "tool_use"],
|
|
1107
|
-
},
|
|
1108
|
-
"智谱 AI": {
|
|
1109
|
-
"id": "zhipu_default",
|
|
1110
|
-
"provider": "zhipu",
|
|
1111
|
-
"type": "zhipu_chat_completion",
|
|
1112
|
-
"provider_type": "chat_completion",
|
|
1113
|
-
"enable": True,
|
|
1114
|
-
"key": [],
|
|
1115
|
-
"timeout": 120,
|
|
1116
|
-
"api_base": "https://open.bigmodel.cn/api/paas/v4/",
|
|
1117
|
-
"model_config": {
|
|
1118
|
-
"model": "glm-4-flash",
|
|
1119
|
-
},
|
|
1082
|
+
"api_base": "https://api-inference.modelscope.cn/v1",
|
|
1120
1083
|
"custom_headers": {},
|
|
1121
|
-
"custom_extra_body": {},
|
|
1122
|
-
"modalities": ["text", "image", "tool_use"],
|
|
1123
1084
|
},
|
|
1124
1085
|
"Dify": {
|
|
1125
1086
|
"id": "dify_app_default",
|
|
@@ -1134,7 +1095,6 @@ CONFIG_METADATA_2 = {
|
|
|
1134
1095
|
"dify_query_input_key": "astrbot_text_query",
|
|
1135
1096
|
"variables": {},
|
|
1136
1097
|
"timeout": 60,
|
|
1137
|
-
"hint": "请确保你在 AstrBot 里设置的 APP 类型和 Dify 里面创建的应用的类型一致!",
|
|
1138
1098
|
},
|
|
1139
1099
|
"Coze": {
|
|
1140
1100
|
"id": "coze",
|
|
@@ -1165,20 +1125,6 @@ CONFIG_METADATA_2 = {
|
|
|
1165
1125
|
"variables": {},
|
|
1166
1126
|
"timeout": 60,
|
|
1167
1127
|
},
|
|
1168
|
-
"ModelScope": {
|
|
1169
|
-
"id": "modelscope",
|
|
1170
|
-
"provider": "modelscope",
|
|
1171
|
-
"type": "openai_chat_completion",
|
|
1172
|
-
"provider_type": "chat_completion",
|
|
1173
|
-
"enable": True,
|
|
1174
|
-
"key": [],
|
|
1175
|
-
"timeout": 120,
|
|
1176
|
-
"api_base": "https://api-inference.modelscope.cn/v1",
|
|
1177
|
-
"model_config": {"model": "Qwen/Qwen3-32B", "temperature": 0.4},
|
|
1178
|
-
"custom_headers": {},
|
|
1179
|
-
"custom_extra_body": {},
|
|
1180
|
-
"modalities": ["text", "image", "tool_use"],
|
|
1181
|
-
},
|
|
1182
1128
|
"FastGPT": {
|
|
1183
1129
|
"id": "fastgpt",
|
|
1184
1130
|
"provider": "fastgpt",
|
|
@@ -1202,7 +1148,6 @@ CONFIG_METADATA_2 = {
|
|
|
1202
1148
|
"model": "whisper-1",
|
|
1203
1149
|
},
|
|
1204
1150
|
"Whisper(Local)": {
|
|
1205
|
-
"hint": "启用前请 pip 安装 openai-whisper 库(N卡用户大约下载 2GB,主要是 torch 和 cuda,CPU 用户大约下载 1 GB),并且安装 ffmpeg。否则将无法正常转文字。",
|
|
1206
1151
|
"provider": "openai",
|
|
1207
1152
|
"type": "openai_whisper_selfhost",
|
|
1208
1153
|
"provider_type": "speech_to_text",
|
|
@@ -1211,7 +1156,6 @@ CONFIG_METADATA_2 = {
|
|
|
1211
1156
|
"model": "tiny",
|
|
1212
1157
|
},
|
|
1213
1158
|
"SenseVoice(Local)": {
|
|
1214
|
-
"hint": "启用前请 pip 安装 funasr、funasr_onnx、torchaudio、torch、modelscope、jieba 库(默认使用CPU,大约下载 1 GB),并且安装 ffmpeg。否则将无法正常转文字。",
|
|
1215
1159
|
"type": "sensevoice_stt_selfhost",
|
|
1216
1160
|
"provider": "sensevoice",
|
|
1217
1161
|
"provider_type": "speech_to_text",
|
|
@@ -1233,7 +1177,6 @@ CONFIG_METADATA_2 = {
|
|
|
1233
1177
|
"timeout": "20",
|
|
1234
1178
|
},
|
|
1235
1179
|
"Edge TTS": {
|
|
1236
|
-
"hint": "提示:使用这个服务前需要安装有 ffmpeg,并且可以直接在终端调用 ffmpeg 指令。",
|
|
1237
1180
|
"id": "edge_tts",
|
|
1238
1181
|
"provider": "microsoft",
|
|
1239
1182
|
"type": "edge_tts",
|
|
@@ -1449,6 +1392,10 @@ CONFIG_METADATA_2 = {
|
|
|
1449
1392
|
},
|
|
1450
1393
|
},
|
|
1451
1394
|
"items": {
|
|
1395
|
+
"provider_source_id": {
|
|
1396
|
+
"invisible": True,
|
|
1397
|
+
"type": "string",
|
|
1398
|
+
},
|
|
1452
1399
|
"xai_native_search": {
|
|
1453
1400
|
"description": "启用原生搜索功能",
|
|
1454
1401
|
"type": "bool",
|
|
@@ -1819,13 +1766,24 @@ CONFIG_METADATA_2 = {
|
|
|
1819
1766
|
},
|
|
1820
1767
|
},
|
|
1821
1768
|
"gm_thinking_config": {
|
|
1822
|
-
"description": "
|
|
1769
|
+
"description": "Thinking Config",
|
|
1823
1770
|
"type": "object",
|
|
1824
1771
|
"items": {
|
|
1825
1772
|
"budget": {
|
|
1826
|
-
"description": "
|
|
1773
|
+
"description": "Thinking Budget",
|
|
1827
1774
|
"type": "int",
|
|
1828
|
-
"hint": "
|
|
1775
|
+
"hint": "Guides the model on the specific number of thinking tokens to use for reasoning. See: https://ai.google.dev/gemini-api/docs/thinking#set-budget",
|
|
1776
|
+
},
|
|
1777
|
+
"level": {
|
|
1778
|
+
"description": "Thinking Level",
|
|
1779
|
+
"type": "string",
|
|
1780
|
+
"hint": "Recommended for Gemini 3 models and onwards, lets you control reasoning behavior.See: https://ai.google.dev/gemini-api/docs/thinking#thinking-levels",
|
|
1781
|
+
"options": [
|
|
1782
|
+
"MINIMAL",
|
|
1783
|
+
"LOW",
|
|
1784
|
+
"MEDIUM",
|
|
1785
|
+
"HIGH",
|
|
1786
|
+
],
|
|
1829
1787
|
},
|
|
1830
1788
|
},
|
|
1831
1789
|
},
|
|
@@ -2006,7 +1964,6 @@ CONFIG_METADATA_2 = {
|
|
|
2006
1964
|
"id": {
|
|
2007
1965
|
"description": "ID",
|
|
2008
1966
|
"type": "string",
|
|
2009
|
-
"hint": "模型提供商名字。",
|
|
2010
1967
|
},
|
|
2011
1968
|
"type": {
|
|
2012
1969
|
"description": "模型提供商种类",
|
|
@@ -2026,29 +1983,15 @@ CONFIG_METADATA_2 = {
|
|
|
2026
1983
|
"description": "API Key",
|
|
2027
1984
|
"type": "list",
|
|
2028
1985
|
"items": {"type": "string"},
|
|
2029
|
-
"hint": "提供商 API Key。",
|
|
2030
1986
|
},
|
|
2031
1987
|
"api_base": {
|
|
2032
1988
|
"description": "API Base URL",
|
|
2033
1989
|
"type": "string",
|
|
2034
|
-
"hint": "API Base URL 请在模型提供商处获得。如出现 404 报错,尝试在地址末尾加上 /v1",
|
|
2035
1990
|
},
|
|
2036
|
-
"
|
|
2037
|
-
"description": "
|
|
2038
|
-
"type": "
|
|
2039
|
-
"
|
|
2040
|
-
"model": {
|
|
2041
|
-
"description": "模型名称",
|
|
2042
|
-
"type": "string",
|
|
2043
|
-
"hint": "模型名称,如 gpt-4o-mini, deepseek-chat。",
|
|
2044
|
-
},
|
|
2045
|
-
"max_tokens": {
|
|
2046
|
-
"description": "模型最大输出长度(tokens)",
|
|
2047
|
-
"type": "int",
|
|
2048
|
-
},
|
|
2049
|
-
"temperature": {"description": "温度", "type": "float"},
|
|
2050
|
-
"top_p": {"description": "Top P值", "type": "float"},
|
|
2051
|
-
},
|
|
1991
|
+
"model": {
|
|
1992
|
+
"description": "模型 ID",
|
|
1993
|
+
"type": "string",
|
|
1994
|
+
"hint": "模型名称,如 gpt-4o-mini, deepseek-chat。",
|
|
2052
1995
|
},
|
|
2053
1996
|
"dify_api_key": {
|
|
2054
1997
|
"description": "API Key",
|
astrbot/core/core_lifecycle.py
CHANGED
|
@@ -33,6 +33,7 @@ from astrbot.core.star.context import Context
|
|
|
33
33
|
from astrbot.core.star.star_handler import EventType, star_handlers_registry, star_map
|
|
34
34
|
from astrbot.core.umop_config_router import UmopConfigRouter
|
|
35
35
|
from astrbot.core.updator import AstrBotUpdator
|
|
36
|
+
from astrbot.core.utils.llm_metadata import update_llm_metadata
|
|
36
37
|
from astrbot.core.utils.migra_helper import migra
|
|
37
38
|
|
|
38
39
|
from . import astrbot_config, html_renderer
|
|
@@ -185,6 +186,8 @@ class AstrBotCoreLifecycle:
|
|
|
185
186
|
# 初始化关闭控制面板的事件
|
|
186
187
|
self.dashboard_shutdown_event = asyncio.Event()
|
|
187
188
|
|
|
189
|
+
asyncio.create_task(update_llm_metadata())
|
|
190
|
+
|
|
188
191
|
def _load(self) -> None:
|
|
189
192
|
"""加载事件总线和任务并初始化."""
|
|
190
193
|
# 创建一个异步任务来执行事件总线的 dispatch() 方法
|
astrbot/core/db/__init__.py
CHANGED
|
@@ -9,6 +9,8 @@ from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_asyn
|
|
|
9
9
|
|
|
10
10
|
from astrbot.core.db.po import (
|
|
11
11
|
Attachment,
|
|
12
|
+
CommandConfig,
|
|
13
|
+
CommandConflict,
|
|
12
14
|
ConversationV2,
|
|
13
15
|
Persona,
|
|
14
16
|
PlatformMessageHistory,
|
|
@@ -314,6 +316,76 @@ class BaseDatabase(abc.ABC):
|
|
|
314
316
|
"""Clear all preferences for a specific scope ID."""
|
|
315
317
|
...
|
|
316
318
|
|
|
319
|
+
@abc.abstractmethod
|
|
320
|
+
async def get_command_configs(self) -> list[CommandConfig]:
|
|
321
|
+
"""Get all stored command configurations."""
|
|
322
|
+
...
|
|
323
|
+
|
|
324
|
+
@abc.abstractmethod
|
|
325
|
+
async def get_command_config(self, handler_full_name: str) -> CommandConfig | None:
|
|
326
|
+
"""Fetch a single command configuration by handler."""
|
|
327
|
+
...
|
|
328
|
+
|
|
329
|
+
@abc.abstractmethod
|
|
330
|
+
async def upsert_command_config(
|
|
331
|
+
self,
|
|
332
|
+
handler_full_name: str,
|
|
333
|
+
plugin_name: str,
|
|
334
|
+
module_path: str,
|
|
335
|
+
original_command: str,
|
|
336
|
+
*,
|
|
337
|
+
resolved_command: str | None = None,
|
|
338
|
+
enabled: bool | None = None,
|
|
339
|
+
keep_original_alias: bool | None = None,
|
|
340
|
+
conflict_key: str | None = None,
|
|
341
|
+
resolution_strategy: str | None = None,
|
|
342
|
+
note: str | None = None,
|
|
343
|
+
extra_data: dict | None = None,
|
|
344
|
+
auto_managed: bool | None = None,
|
|
345
|
+
) -> CommandConfig:
|
|
346
|
+
"""Create or update a command configuration."""
|
|
347
|
+
...
|
|
348
|
+
|
|
349
|
+
@abc.abstractmethod
|
|
350
|
+
async def delete_command_config(self, handler_full_name: str) -> None:
|
|
351
|
+
"""Delete a single command configuration."""
|
|
352
|
+
...
|
|
353
|
+
|
|
354
|
+
@abc.abstractmethod
|
|
355
|
+
async def delete_command_configs(self, handler_full_names: list[str]) -> None:
|
|
356
|
+
"""Bulk delete command configurations."""
|
|
357
|
+
...
|
|
358
|
+
|
|
359
|
+
@abc.abstractmethod
|
|
360
|
+
async def list_command_conflicts(
|
|
361
|
+
self,
|
|
362
|
+
status: str | None = None,
|
|
363
|
+
) -> list[CommandConflict]:
|
|
364
|
+
"""List recorded command conflict entries."""
|
|
365
|
+
...
|
|
366
|
+
|
|
367
|
+
@abc.abstractmethod
|
|
368
|
+
async def upsert_command_conflict(
|
|
369
|
+
self,
|
|
370
|
+
conflict_key: str,
|
|
371
|
+
handler_full_name: str,
|
|
372
|
+
plugin_name: str,
|
|
373
|
+
*,
|
|
374
|
+
status: str | None = None,
|
|
375
|
+
resolution: str | None = None,
|
|
376
|
+
resolved_command: str | None = None,
|
|
377
|
+
note: str | None = None,
|
|
378
|
+
extra_data: dict | None = None,
|
|
379
|
+
auto_generated: bool | None = None,
|
|
380
|
+
) -> CommandConflict:
|
|
381
|
+
"""Create or update a conflict record."""
|
|
382
|
+
...
|
|
383
|
+
|
|
384
|
+
@abc.abstractmethod
|
|
385
|
+
async def delete_command_conflicts(self, ids: list[int]) -> None:
|
|
386
|
+
"""Delete conflict records."""
|
|
387
|
+
...
|
|
388
|
+
|
|
317
389
|
# @abc.abstractmethod
|
|
318
390
|
# async def insert_llm_message(
|
|
319
391
|
# self,
|