From a946725bc70ff0075a550ae36831c40c2317b260 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 10 Aug 2026 08:16:18 +0000 Subject: [PATCH] =?UTF-8?q?v4.1:=20=E4=BF=AE=20models=20schema=20(baseUrl?= =?UTF-8?q?=20=E4=B8=8D=E6=98=AF=20baseURL,=20models=20=E4=B8=BA=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E6=95=B0=E7=BB=84=E5=90=AB=20id/name/api/cost/context?= =?UTF-8?q?Window)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 0183f5c..102eaf4 100755 --- a/install.sh +++ b/install.sh @@ -768,17 +768,30 @@ if provider == "openai-compat" and (baseurl or apikey or model): print("WARN: models.providers.openai-compat unexpected type; skipped") else: if baseurl: - p["baseURL"] = baseurl - changed.append("models.providers.openai-compat.baseURL") + p["baseUrl"] = baseurl + p.pop("baseURL", None) + changed.append("models.providers.openai-compat.baseUrl") if apikey: p["apiKey"] = apikey changed.append("models.providers.openai-compat.apiKey") + p.setdefault("api", "openai-completions") + p.setdefault("timeoutSeconds", 300) if model: models = p.get("models") if not isinstance(models, list): models = [] - if model not in models: - models.append(model) + models = [m for m in models if isinstance(m, dict)] + if not any(m.get("id") == model for m in models): + models.append({ + "id": model, + "name": model, + "api": "openai-completions", + "reasoning": False, + "input": ["text"], + "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}, + "contextWindow": 128000, + "maxTokens": 8192, + }) p["models"] = models changed.append("models.providers.openai-compat.models") agents_root = node(cfg, "agents") @@ -796,6 +809,26 @@ elif provider == "anthropic" and (apikey or model): if apikey: p["apiKey"] = apikey changed.append("models.providers.anthropic.apiKey") + p.setdefault("api", "anthropic-messages") + p.setdefault("timeoutSeconds", 300) + if model: + ams = p.get("models") + if not isinstance(ams, list): + ams = [] + ams = [m for m in ams if isinstance(m, dict)] + if not any(m.get("id") == model for m in ams): + ams.append({ + "id": model, + "name": model, + "api": "anthropic-messages", + "reasoning": True, + "input": ["text", "image"], + "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}, + "contextWindow": 200000, + "maxTokens": 8192, + }) + p["models"] = ams + changed.append("models.providers.anthropic.models") if model: agents_root = node(cfg, "agents") adef = node(agents_root, "defaults") if agents_root is not None else None @@ -1058,7 +1091,7 @@ if provs: print(" 模型 Provider:") for name,p in provs.items(): if not isinstance(p,dict): continue - print(f" [{name}] baseURL={p.get('baseURL','(默认)')} key={mask(p.get('apiKey',''))}") + print(f" [{name}] baseUrl={p.get('baseUrl',p.get('baseURL','(默认)'))} key={mask(p.get('apiKey',''))}") ms=p.get("models") if isinstance(ms,list) and ms: print(f" models={', '.join(map(str,ms[:5]))}") else: