fix: align controller with OpenShell and NemoClaw
Merged verified controller compatibility, terminal, and inference UX fixes.
This commit is contained in:
@@ -3,7 +3,7 @@ import { execFile } from "node:child_process"
|
||||
import { existsSync, statSync } from "node:fs"
|
||||
import { readdir, readFile } from "node:fs/promises"
|
||||
import { isIP } from "node:net"
|
||||
import { release } from "node:os"
|
||||
import { platform, release } from "node:os"
|
||||
import { promisify } from "node:util"
|
||||
|
||||
const DEFAULT_OLLAMA_URL = "http://127.0.0.1:11434"
|
||||
@@ -127,7 +127,7 @@ function formatBytes(size: unknown) {
|
||||
|
||||
function modelRowsFromTags(data: any, origin: OllamaProbeCandidate): OllamaModelRow[] {
|
||||
return Array.isArray(data?.models)
|
||||
? data.models.map((item: OllamaTag) => {
|
||||
? data.models.filter((item: OllamaTag) => isChatModelName(item.model || item.name || "")).map((item: OllamaTag) => {
|
||||
const name = item.model || item.name || ""
|
||||
return {
|
||||
id: `${origin.hostKind}:${name}`,
|
||||
@@ -150,6 +150,10 @@ function modelRowsFromTags(data: any, origin: OllamaProbeCandidate): OllamaModel
|
||||
: []
|
||||
}
|
||||
|
||||
function isChatModelName(name: string) {
|
||||
return !/(^|[-_:/.])(embed|embedding|rerank|bge|nomic-embed)([-_:/.]|$)/i.test(name)
|
||||
}
|
||||
|
||||
async function isWslRuntime() {
|
||||
if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) return true
|
||||
const kernelRelease = release().toLowerCase()
|
||||
@@ -253,6 +257,8 @@ function customHostUrl(host: string) {
|
||||
async function buildProbeCandidates() {
|
||||
const candidates: OllamaProbeCandidate[] = []
|
||||
const wsl = await isWslRuntime()
|
||||
const localHostLabel = platform() === "darwin" ? "MAC" : "LINUX"
|
||||
const localSource = platform() === "darwin" ? "mac-localhost" : "localhost"
|
||||
|
||||
addFetchCandidate(candidates, process.env.OPENSHELL_OLLAMA_BASE_URL, "OPENSHELL_OLLAMA_BASE_URL", "custom", "CUSTOM")
|
||||
addFetchCandidate(candidates, process.env.OLLAMA_BASE_URL, "OLLAMA_BASE_URL", "custom", "CUSTOM")
|
||||
@@ -260,7 +266,7 @@ async function buildProbeCandidates() {
|
||||
for (const host of customHostCandidates()) {
|
||||
addFetchCandidate(candidates, customHostUrl(host), "OPENSHELL_OLLAMA_HOSTS", "custom", "CUSTOM")
|
||||
}
|
||||
addFetchCandidate(candidates, DEFAULT_OLLAMA_URL, wsl ? "wsl-localhost" : "localhost", wsl ? "wsl2" : "linux", wsl ? "WSL2" : "LINUX")
|
||||
addFetchCandidate(candidates, DEFAULT_OLLAMA_URL, wsl ? "wsl-localhost" : localSource, wsl ? "wsl2" : "linux", wsl ? "WSL2" : localHostLabel)
|
||||
|
||||
if (wsl) {
|
||||
for (const host of await readWslHostCandidates()) {
|
||||
|
||||
@@ -3,11 +3,15 @@ import { execOpenShell, normalizeSandboxPhase, resolveSandboxRef } from "@/app/l
|
||||
import { listBackupCatalog } from "@/app/lib/backupCatalog"
|
||||
import { getNemoClawDoctorReport } from "@/app/lib/nemoclawCli"
|
||||
|
||||
function stripAnsi(value: string) {
|
||||
return value.replace(/\u001b\[[0-9;]*m/g, "")
|
||||
}
|
||||
|
||||
function parseField(output: string, label: string) {
|
||||
const normalizedLabel = label.toLowerCase()
|
||||
const line = output
|
||||
.split(/\r?\n/)
|
||||
.map((entry) => entry.trim())
|
||||
.map((entry) => stripAnsi(entry).trim())
|
||||
.find((entry) => entry.toLowerCase().startsWith(`${normalizedLabel}:`))
|
||||
|
||||
return line ? line.slice(label.length + 1).trim() : null
|
||||
|
||||
@@ -46,7 +46,7 @@ const providerTypeOptions = [
|
||||
]
|
||||
|
||||
const OLLAMA_PROVIDER_NAME = "ollama-local"
|
||||
const OLLAMA_BASE_URL = "http://host.docker.internal:11434/v1"
|
||||
const OLLAMA_BASE_URL = "http://127.0.0.1:11434/v1"
|
||||
const DEFAULT_VLLM_CONTAINER = "vllm-bigboy"
|
||||
const DEFAULT_VLLM_IMAGE = "nvcr.io/nvidia/vllm:26.03.post1-py3"
|
||||
const DEFAULT_VLLM_MODEL = "vllm-local"
|
||||
@@ -467,6 +467,11 @@ export default function InferenceEndpointPanel() {
|
||||
setProviders(Array.isArray(data.providers) ? data.providers : [])
|
||||
if (data.gateway?.provider) setName(data.gateway.provider)
|
||||
if (data.gateway?.model) setModel(data.gateway.model)
|
||||
if (data.gateway?.provider?.toLowerCase().includes("ollama")) {
|
||||
setType("openai")
|
||||
setBaseUrl(OLLAMA_BASE_URL)
|
||||
setCredentialKey("OLLAMA_API_KEY")
|
||||
}
|
||||
if (data.gateway?.provider && isVllmEndpoint(data.gateway.provider, "")) setType("vllm")
|
||||
} catch (error) {
|
||||
setMessage(error instanceof Error ? error.message : "Failed to load inference configuration")
|
||||
@@ -516,7 +521,7 @@ export default function InferenceEndpointPanel() {
|
||||
setType("openai")
|
||||
setModel(modelName)
|
||||
setBaseUrl(ollamaOpenAiBaseUrl(item))
|
||||
setCredentialKey("OPENAI_API_KEY")
|
||||
setCredentialKey("OLLAMA_API_KEY")
|
||||
setApiKey("")
|
||||
setRoute("gateway")
|
||||
setNoVerify(true)
|
||||
@@ -530,6 +535,7 @@ export default function InferenceEndpointPanel() {
|
||||
setCredentialKey(provider.credentialKeys[0] || "OPENAI_API_KEY")
|
||||
if (provider.name.toLowerCase().includes("ollama")) {
|
||||
setBaseUrl(OLLAMA_BASE_URL)
|
||||
setCredentialKey(provider.credentialKeys[0] || "OLLAMA_API_KEY")
|
||||
setApiKey("")
|
||||
}
|
||||
setMessage(`Loaded ${provider.name}. Enter a model and save to make it active.`)
|
||||
|
||||
@@ -4,7 +4,7 @@ import { HOST_PATH, OPENCLAW_BIN, OPENSHELL_BIN, hostCommandEnv } from "./hostCo
|
||||
import { getDefaultOpenClawInstance, getOpenClawDashboardPortForSandbox, resolveOpenClawInstance } from "./openclawInstances"
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY || "openshell"
|
||||
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY?.trim() || undefined
|
||||
const OPENSHELL_NAMESPACE = "agent-sandbox-system"
|
||||
const SANDBOX_DASHBOARD_REMOTE_PORT = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_REMOTE_PORT || "18789", 10)
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ interface LiveTerminalSession {
|
||||
sandboxId: string
|
||||
dashboardSessionId: string
|
||||
replay?: string
|
||||
transport?: string
|
||||
websocketUrl: string
|
||||
sshHostAlias?: string
|
||||
reconnectKey?: string
|
||||
@@ -184,6 +185,7 @@ function OperatorTerminalInner() {
|
||||
sandboxId: result.sandboxId,
|
||||
dashboardSessionId: result.dashboardSessionId || dashboardSessionId,
|
||||
replay: result.replay,
|
||||
transport: result.transport,
|
||||
websocketUrl: result.websocketUrl,
|
||||
sshHostAlias: result.sshHostAlias,
|
||||
reconnectKey: String(reconnectCounterRef.current),
|
||||
@@ -292,9 +294,10 @@ function OperatorTerminalInner() {
|
||||
|
||||
socket.addEventListener('open', () => {
|
||||
setTerminalState('connected')
|
||||
const transportLabel = liveSession.transport ? ` via ${liveSession.transport}` : ''
|
||||
setTerminalStatus(shouldLaunchHermes
|
||||
? `Live terminal connected for ${liveSession.sandboxId}; launching Hermes…`
|
||||
: `Live terminal connected for ${liveSession.sandboxId}.`)
|
||||
? `Live terminal connected for ${liveSession.sandboxId}${transportLabel}; launching Hermes…`
|
||||
: `Live terminal connected for ${liveSession.sandboxId}${transportLabel}.`)
|
||||
try {
|
||||
fitAddonRef.current?.fit()
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user