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
77 changes: 77 additions & 0 deletions astrbot/core/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,34 @@
"gm_thinking_config": {"budget": 0, "level": "HIGH"},
"proxy": "",
},
"Google Vertex AI": {
"id": "google_vertex_ai",
"provider": "google-vertex-ai",
"type": "googlegenai_chat_completion",
"provider_type": "chat_completion",
"hint": "provider_group.provider.google_vertex_ai.hint",
"enable": True,
"key": [],
"api_base": "https://aiplatform.googleapis.com/v1",
"timeout": 120,
"gm_resp_image_modal": False,
"gm_native_search": False,
"gm_native_coderunner": False,
"gm_url_context": False,
"gm_safety_settings": {
"harassment": "BLOCK_MEDIUM_AND_ABOVE",
"hate_speech": "BLOCK_MEDIUM_AND_ABOVE",
"sexually_explicit": "BLOCK_MEDIUM_AND_ABOVE",
"dangerous_content": "BLOCK_MEDIUM_AND_ABOVE",
},
"gm_thinking_config": {"budget": 0, "level": "HIGH"},
"proxy": "",
"vertex_ai_auth_type": "json",
"vertex_ai_project_id": "",
"vertex_ai_location": "global",
"vertex_ai_credentials_path": "",
"vertex_ai_credentials_json": "",
},
"Anthropic": {
"id": "anthropic",
"provider": "anthropic",
Expand Down Expand Up @@ -1986,6 +2014,55 @@
"items": {},
"hint": "此处添加的键值对将被合并到 OpenAI SDK 的 default_headers 中,用于自定义 HTTP 请求头。",
},
"vertex_ai_auth_type": {
"description": "密钥格式",
"type": "string",
"options": ["json", "api_key"],
"hint": "provider_group.provider.vertex_ai_auth_type.hint",
"condition": {"provider": "google-vertex-ai"},
},
"vertex_ai_api_key": {
"description": "API Key",
"type": "list",
"items": {"type": "string"},
"hint": "provider_group.provider.vertex_ai_api_key.hint",
"condition": {
"provider": "google-vertex-ai",
"vertex_ai_auth_type": "api_key",
},
"button_text": "API Key",
"dialog_title": "API Key",
"prefer_single_item": True,
},
"vertex_ai_project_id": {
"description": "Vertex AI Project ID",
"type": "string",
"hint": "provider_group.provider.vertex_ai_project_id.hint",
"invisible": True,
},
"vertex_ai_location": {
"description": "Vertex AI Location",
"type": "string",
"hint": "provider_group.provider.vertex_ai_location.hint",
"condition": {"provider": "google-vertex-ai"},
},
"vertex_ai_credentials_path": {
"description": "Service Account JSON Path",
"type": "string",
"hint": "provider_group.provider.vertex_ai_credentials_path.hint",
"invisible": True,
},
"vertex_ai_credentials_json": {
"description": "Service Account JSON",
"type": "text",
"editor_mode": True,
"editor_language": "json",
"hint": "provider_group.provider.vertex_ai_credentials_json.hint",
"condition": {
"provider": "google-vertex-ai",
"vertex_ai_auth_type": "json",
},
},
"ollama_disable_thinking": {
"description": "关闭思考模式",
"type": "bool",
Expand Down
3 changes: 2 additions & 1 deletion astrbot/core/provider/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
TTSProvider,
)
from .register import llm_tools, provider_cls_map
from .sources.vertex_ai import normalize_vertex_ai_provider_config


@runtime_checkable
Expand Down Expand Up @@ -515,7 +516,7 @@ def get_merged_provider_config(self, provider_config: dict) -> dict:
# 保持 id 为 provider 的 id,而不是 source 的 id
merged_config["id"] = pc["id"]
pc = merged_config
return pc
return normalize_vertex_ai_provider_config(pc)

def get_provider_config_by_id(
self,
Expand Down
Loading