From a7a36df7052f6ee217fdf16b569fdf16c3236591 Mon Sep 17 00:00:00 2001 From: Acbox Liu Date: Sat, 21 Mar 2026 19:14:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20use=20Twilight=20AI=20SDK=20for=20m?= =?UTF-8?q?odel=20and=20provider=20connectivity=20tes=E2=80=A6=20(#273)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: use Twilight AI SDK for model and provider connectivity testing Replace hand-rolled HTTP probing with the Twilight AI SDK's built-in Provider.Test() and TestModel() methods. - Model test now runs Provider.Test() (connectivity + auth) followed by TestModel() (model availability) via the SDK - Provider test auto-detects client_type from associated models and creates the correct SDK provider for accurate auth header handling - Embedding models use a dedicated /embeddings endpoint probe since the SDK's chat Provider doesn't cover embedding APIs - Latency measurement now covers the full test lifecycle - Add TestStatusModelNotSupported for models not found by the provider - Upgrade twilight-ai to v0.3.3-0.20260321100646-43c789b701dd which includes fallback probing for providers without GET /models/{id} * fix: lint --- .../web/src/components/create-model/index.vue | 4 +- apps/web/src/components/status-dot/index.vue | 2 +- eslint.config.mjs | 10 + go.mod | 2 +- go.sum | 4 +- internal/models/probe.go | 247 ++++++++++-------- internal/models/types.go | 7 +- internal/providers/service.go | 47 ++-- 8 files changed, 186 insertions(+), 137 deletions(-) diff --git a/apps/web/src/components/create-model/index.vue b/apps/web/src/components/create-model/index.vue index 10e01631..3e93cdff 100644 --- a/apps/web/src/components/create-model/index.vue +++ b/apps/web/src/components/create-model/index.vue @@ -63,11 +63,11 @@ class="mt-2" :show-group-headers="false" > -