Fix OpenClaw configuration options

This commit is contained in:
decolua
2026-02-09 22:36:57 +07:00
parent 102c193112
commit dd043f6ff4
2 changed files with 23 additions and 11 deletions
+10 -4
View File
@@ -518,7 +518,13 @@ codex "your prompt"
### OpenClaw ### OpenClaw
Edit `~/.openclaw/openclaw.json`: **Option 1 — Dashboard (recommended):**
```
Dashboard → CLI Tools → OpenClaw → Select Model → Apply
```
**Option 2 — Manual:** Edit `~/.openclaw/openclaw.json`:
```json ```json
{ {
@@ -532,8 +538,8 @@ Edit `~/.openclaw/openclaw.json`:
"models": { "models": {
"providers": { "providers": {
"9router": { "9router": {
"baseUrl": "http://localhost:20128/v1", "baseUrl": "http://127.0.0.1:20128/v1",
"apiKey": "your-9router-api-key", "apiKey": "sk_9router",
"api": "openai-completions", "api": "openai-completions",
"models": [ "models": [
{ {
@@ -547,7 +553,7 @@ Edit `~/.openclaw/openclaw.json`:
} }
``` ```
**Or use Dashboard:** CLI Tools → OpenClaw → Auto-config > **Note:** OpenClaw only works with local 9Router. Use `127.0.0.1` instead of `localhost` to avoid IPv6 resolution issues.
### Cline / Continue / RooCode ### Cline / Continue / RooCode
@@ -4,8 +4,6 @@ import { useState, useEffect, useRef } from "react";
import { Card, Button, ModelSelectModal, ManualConfigModal } from "@/shared/components"; import { Card, Button, ModelSelectModal, ManualConfigModal } from "@/shared/components";
import Image from "next/image"; import Image from "next/image";
const CLOUD_URL = process.env.NEXT_PUBLIC_CLOUD_URL;
export default function OpenClawToolCard({ export default function OpenClawToolCard({
tool, tool,
isExpanded, isExpanded,
@@ -33,9 +31,8 @@ export default function OpenClawToolCard({
if (!openclawStatus?.installed) return null; if (!openclawStatus?.installed) return null;
const currentProvider = openclawStatus.settings?.models?.providers?.["9router"]; const currentProvider = openclawStatus.settings?.models?.providers?.["9router"];
if (!currentProvider) return "not_configured"; if (!currentProvider) return "not_configured";
const localMatch = currentProvider.baseUrl?.includes("localhost") || currentProvider.baseUrl?.includes("127.0.0.1"); const localMatch = currentProvider.baseUrl?.includes("localhost") || currentProvider.baseUrl?.includes("127.0.0.1") || currentProvider.baseUrl?.includes("0.0.0.0");
const cloudMatch = cloudEnabled && CLOUD_URL && currentProvider.baseUrl?.startsWith(CLOUD_URL); if (localMatch) return "configured";
if (localMatch || cloudMatch) return "configured";
return "other"; return "other";
}; };
@@ -94,13 +91,22 @@ export default function OpenClawToolCard({
} }
}; };
const normalizeLocalhost = (url) => url.replace("://localhost", "://127.0.0.1");
const getLocalBaseUrl = () => {
if (typeof window !== "undefined") {
return normalizeLocalhost(window.location.origin);
}
return "http://127.0.0.1:20128";
};
const getEffectiveBaseUrl = () => { const getEffectiveBaseUrl = () => {
const url = customBaseUrl || baseUrl; const url = customBaseUrl || getLocalBaseUrl();
return url.endsWith("/v1") ? url : `${url}/v1`; return url.endsWith("/v1") ? url : `${url}/v1`;
}; };
const getDisplayUrl = () => { const getDisplayUrl = () => {
const url = customBaseUrl || baseUrl; const url = customBaseUrl || getLocalBaseUrl();
return url.endsWith("/v1") ? url : `${url}/v1`; return url.endsWith("/v1") ? url : `${url}/v1`;
}; };