From 4ff164825c0a9fd49b92b5d45adf76bf876867bb Mon Sep 17 00:00:00 2001 From: Foshati Date: Sat, 8 Aug 2026 00:59:21 +0330 Subject: [PATCH] feat(admin): replace refresh models with Test Provider button and refresh model list (v1.2.52) --- pyproject.toml | 2 +- src/codefa/api/admin_static/admin.js | 7 ++----- src/codefa/config/admin/provider_manifest.py | 6 ++++++ uv.lock | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e58644f..3b999b2 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "codefa" -version = "1.2.51" +version = "1.2.52" description = "Local proxy connecting coding agents to OpenAI-compatible AI providers" readme = "README.md" requires-python = ">=3.14.0" diff --git a/src/codefa/api/admin_static/admin.js b/src/codefa/api/admin_static/admin.js index c433edd..f67bd85 100755 --- a/src/codefa/api/admin_static/admin.js +++ b/src/codefa/api/admin_static/admin.js @@ -1260,7 +1260,7 @@ function openProviderModal(providerId) { }); const testBtn = byId("modalTestBtn"); - testBtn.textContent = provider.kind === "local" ? "Test" : "Refresh models"; + testBtn.textContent = "Test Provider"; const newTestBtn = testBtn.cloneNode(true); testBtn.parentNode.replaceChild(newTestBtn, testBtn); newTestBtn.addEventListener("click", () => { @@ -1300,10 +1300,7 @@ async function testProviderInModal(providerId, button) { result.models.slice(0, 3).join(", ") || "No models returned", ); showMessage(`Success: Connected to ${providerId}. Found ${result.models.length} models.`, "ok"); - setModelOptions([ - ...state.modelOptions, - ...result.models.map((model) => `${providerId}/${model}`), - ]); + await loadModels(); } else { updateProviderCard(providerId, "offline", result.error_type, result.error_type); showMessage(`Connection failed: ${result.error_type}`, "error"); diff --git a/src/codefa/config/admin/provider_manifest.py b/src/codefa/config/admin/provider_manifest.py index c882fc2..241ddc8 100755 --- a/src/codefa/config/admin/provider_manifest.py +++ b/src/codefa/config/admin/provider_manifest.py @@ -134,6 +134,12 @@ "Ollama API key for direct OpenAI-compatible Cloud access at ollama.com/v1." ), }, + "TOKENROUTER_API_KEY": { + "label": "TokenRouter API Key", + "description": ( + "TokenRouter API key from tokenrouter.com dashboard for OpenAI-compatible gateway access." + ), + }, } diff --git a/uv.lock b/uv.lock index 2007aad..8622fea 100755 --- a/uv.lock +++ b/uv.lock @@ -272,7 +272,7 @@ wheels = [ [[package]] name = "codefa" -version = "1.2.51" +version = "1.2.52" source = { editable = "." } dependencies = [ { name = "aiohttp" },