fix(tools): fix OpenClaw connection test and multimodal format compatibility
- Use safe .get() for server URL to avoid KeyError - Support both api_key and token in connection test auth - Add OpenAI/Volcano image format (image_url) support - Add aiohttp import in _test_openclaw_connection
This commit is contained in:
@@ -358,11 +358,15 @@ class ToolService:
|
||||
self, custom_config: CustomToolConfig, schema: dict
|
||||
) -> Dict[str, Any]:
|
||||
"""测试 OpenClaw 连接"""
|
||||
import aiohttp
|
||||
try:
|
||||
info = schema.get("info", {})
|
||||
servers = schema.get("servers", [])
|
||||
base_url = servers[0]["url"] if servers else ""
|
||||
token = (custom_config.auth_config or {}).get("token", "")
|
||||
base_url = servers[0].get("url", "") if servers else ""
|
||||
if not base_url:
|
||||
return {"success": False, "message": "OpenClaw 未配置 server URL"}
|
||||
auth = custom_config.auth_config or {}
|
||||
token = auth.get("api_key") or auth.get("token") or ""
|
||||
agent_id = info.get("x-openclaw-agent-id", "main")
|
||||
model = info.get("x-openclaw-default-model", "openclaw")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user