Autopoll Ollama models for inference endpoints

This commit is contained in:
Codex
2026-04-24 17:55:37 +00:00
parent ecaefcf7c8
commit ee971a3035
3 changed files with 174 additions and 3 deletions
+6
View File
@@ -7,6 +7,7 @@ const createRoutePath = path.join(root, 'app/api/sandbox/create/route.ts')
const deleteRoutePath = path.join(root, 'app/api/sandbox/delete/route.ts')
const telemetryRoutePath = path.join(root, 'app/api/telemetry/real/route.ts')
const inferenceRoutePath = path.join(root, 'app/api/inference/route.ts')
const ollamaModelsRoutePath = path.join(root, 'app/api/ollama/models/route.ts')
const hookPath = path.join(root, 'app/hooks/useSandboxInventory.ts')
const pagePath = path.join(root, 'app/page.tsx')
const configPanelPath = path.join(root, 'app/components/ConfigurationPanel.tsx')
@@ -16,6 +17,7 @@ const createRouteSource = await readFile(createRoutePath, 'utf8')
const deleteRouteSource = await readFile(deleteRoutePath, 'utf8')
const telemetryRouteSource = await readFile(telemetryRoutePath, 'utf8')
const inferenceRouteSource = await readFile(inferenceRoutePath, 'utf8')
const ollamaModelsRouteSource = await readFile(ollamaModelsRoutePath, 'utf8')
const hookSource = await readFile(hookPath, 'utf8')
const pageSource = await readFile(pagePath, 'utf8')
const configPanelSource = await readFile(configPanelPath, 'utf8')
@@ -53,6 +55,10 @@ assert.match(inferenceRouteSource, /\["provider", "update", name\]/, 'inference
assert.match(inferenceRouteSource, /\["inference", "set", "--provider", name, "--model", model\]/, 'inference route must set the active OpenShell inference route')
assert.match(inferenceRouteSource, /OPENAI_BASE_URL=\$\{baseUrl\}/, 'inference route must pass endpoint URL as provider config')
assert.match(inferencePanelSource, /INFERENCE ENDPOINTS/, 'settings UI must expose inference endpoint configuration')
assert.match(inferencePanelSource, /\/api\/ollama\/models/, 'settings UI must poll local Ollama models')
assert.match(inferencePanelSource, /window\.setInterval\(\(\) => loadOllamaModels\(\{ silent: true \}\), 10000\)/, 'settings UI must autopoll Ollama while selected')
assert.match(ollamaModelsRouteSource, /\/api\/tags/, 'Ollama models route must query the Ollama tags API')
assert.match(ollamaModelsRouteSource, /OLLAMA_BASE_URL/, 'Ollama models route must support a configurable Ollama base URL')
assert.match(pageSource, /<InferenceEndpointPanel \/>/, 'settings view must render inference endpoint panel')
assert.match(pageSource, /fetch\('\/api\/sandbox\/delete'/, 'destroy workflow must call the real sandbox delete endpoint')