Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(model-hub): curated vendor order and gemini preset (#1926)
Max0eddc3b75eb6
diff --git a/tests/test_model_hub_runtime.py b/tests/test_model_hub_runtime.pyindex 24913c6e1..6d4ec20a3 100644--- a/tests/test_model_hub_runtime.py+++ b/tests/test_model_hub_runtime.py@@ -1970,6 +1970,45 @@ def test_openai_compatibility_engine_base_url_uses_configured_api_root(assert payload["openai-compatibility"][0]["base-url"] == expected_base_url+ ("official_base_url", "protocol"),+ [+ pytest.param(entry.official_base_url, entry.protocol, id=entry.id)+ for entry in api_key_vendor_catalog()+ ],+)+def test_catalog_official_base_url_composes_one_probe_endpoint(+ official_base_url: str,+ protocol: str,+) -> None:+ """Every shipped row probes its own API root plus exactly one endpoint.++ A vendor documents its root however it likes: an origin (DeepSeek), an+ origin plus ``/v1`` (most of them), or a versioned compatibility prefix+ (Gemini's ``/v1beta/openai``). The protocol taxonomy states its path from+ the origin instead, so composition has to reach the endpoint without+ repeating a version segment or dropping part of the root — and a row whose+ root shape nobody checked would silently probe an address the vendor 404s.+ """++ taxonomy = runtime_adapter_module._PROTOCOL_OBSERVATION_TAXONOMY[protocol]+ composed = client_module.upstream_api_url(official_base_url, taxonomy.request_path)++ # The root is carried verbatim — nothing rewritten, nothing dropped.+ assert composed.startswith(f"{official_base_url}/")+ # The endpoint's resource is reached: the taxonomy path past its version.+ resource = f"/{taxonomy.request_path.strip('/').split('/', 1)[1]}"+ assert composed.endswith(resource)+ # And one version segment in the whole path, whichever side supplied it.+ segments = urlsplit(composed).path.strip("/").split("/")+ versions = [+ segment+ for segment in segments+ if segment.startswith("v") and segment[1:2].isdigit()+ ]+ assert len(versions) == 1, composed++@pytest.mark.parametrize(("vendor", "protocol", "expected_base_url"),API_KEY_VENDOR_RUNTIME_CASES,diff --git a/ui/src/components/settings/models/AddApiKeyDialog.test.tsx b/ui/src/components/settings/models/AddApiKeyDialog.test.tsxindex 53311ba9e..0ac7bbd1c 100644--- a/ui/src/components/settings/models/AddApiKeyDialog.test.tsx+++ b/ui/src/components/settings/models/AddApiKeyDialog.test.tsx@@ -165,14 +165,14 @@ const vendorOptionName = (id: string) => (id === CUSTOM_VENDOR? i18n.t('settings.models.addKey.field.vendor.custom'): apiKeyVendorPreset(id)?.label ?? id);-/** The order the menu should read in: the shipped catalog A–Z by the name on the- * row, then the entry that is not a vendor. Derived from the file rather than- * listed, so a vendor added to the catalog is expected in its alphabetical- * place instead of wherever the file happens to put it. */+/** The order the menu should read in: the shipped catalog verbatim, then the+ * entry that is not a vendor. The property is menu order == file order, so the+ * ranking itself is asserted nowhere — it is a product decision that belongs in+ * `vibe/data/api_key_vendors.json` alone, and a list restated here would make+ * every reordering a two-file edit while proving nothing the file cannot say.+ * What this does catch is the menu re-deriving an order of its own. */const offeredInOrder = (): string[] => [- ...API_KEY_VENDOR_PRESETS- .map((row) => row.id)- .sort((one, other) => vendorOptionName(one).localeCompare(vendorOptionName(other), 'en', { sensitivity: 'base' })),+ ...API_KEY_VENDOR_PRESETS.map((row) => row.id),CUSTOM_VENDOR,];@@ -1106,8 +1106,8 @@ describe('AddApiKeyDialog · vendor', () => {await user.click(vendorField());const rows = await screen.findAllByRole('option');- // A–Z by the name on the row, with 自定义 at the bottom: it is the absence of- // a vendor, so it belongs after them rather than sorted among them.+ // The catalog's own order, with 自定义 at the bottom: it is the absence of a+ // vendor, so it belongs after them rather than ranked among them.const offered = offeredInOrder();expect(rows).toHaveLength(offered.length);expect(offered.map((id) => rows.indexOf(screen.getByRole('option', { name: vendorOptionName(id) }))))diff --git a/ui/src/components/settings/models/AddApiKeyDialog.tsx b/ui/src/components/settings/models/AddApiKeyDialog.tsxindex 084c53c75..3e9c1ffca 100644--- a/ui/src/components/settings/models/AddApiKeyDialog.tsx+++ b/ui/src/components/settings/models/AddApiKeyDialog.tsx@@ -130,15 +130,17 @@ const ProtocolSegments: React.FC<{};/**- * The 服务商 field's rows: the shipped catalog A–Z by label, then the one entry- * that is not a vendor at all, each carrying its mark.+ * The 服务商 field's rows: the shipped catalog in the order the file ships, then+ * the one entry that is not a vendor at all, each carrying its mark.*- * A–Z because the file's order is the backend's business — whatever it means- * there, on screen it reads as arbitrary, and a name is what a user scans for.- * The comparison is base-sensitivity English so case and accents do not split- * the alphabet. 自定义 sorts nowhere: it is the absence of a vendor, so it sits- * at the end of the vendors rather than inside them, while staying the value the- * field opens on.+ * File order because that order is a curated ranking, not an accident of how the+ * rows were appended: the vendors most users are here to add sit at the top, and+ * a name is only what you scan for once the list is long enough to have lost you.+ * Re-sorting here would put the ranking in a second place and make the catalog's+ * own order unobservable — so this reads the file verbatim, and moving a vendor+ * up the list is an edit to `vibe/data/api_key_vendors.json` and to nothing else.+ * 自定义 ranks nowhere: it is the absence of a vendor, so it sits after all of+ * them rather than inside them, while staying the value the field opens on.** The mark is why the field is no longer a `<select>`. A vendor is recognised by* its logo long before its name is read, and an `<option>` holds text only — so@@ -151,9 +153,7 @@ const ProtocolSegments: React.FC<{const useVendorOptions = (): ComboboxOption[] => {const { t } = useTranslation();return React.useMemo(() => ([- ...API_KEY_VENDOR_PRESETS- .map((preset) => ({ value: preset.id, label: preset.label }))- .sort((one, other) => one.label.localeCompare(other.label, 'en', { sensitivity: 'base' })),+ ...API_KEY_VENDOR_PRESETS.map((preset) => ({ value: preset.id, label: preset.label })),{ value: CUSTOM_VENDOR, label: t('settings.models.addKey.field.vendor.custom') },].map((option) => ({ ...option, icon: <VendorGlyph vendor={option.value} /> }))), [t]);};diff --git a/ui/src/components/settings/models/vendorMarks.ts b/ui/src/components/settings/models/vendorMarks.tsindex 18353182d..35d6918d2 100644--- a/ui/src/components/settings/models/vendorMarks.ts+++ b/ui/src/components/settings/models/vendorMarks.ts@@ -85,6 +85,13 @@ export const VENDOR_MARKS: Record<string, VendorMark | undefined> = {path: 'M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z',ink: [0, 3.43, 24, 17.14],},+ // The four-pointed spark, whose tips ARE the corners of the box it was+ // authored in — so its recorded ink is the whole 24 units, and the rule scales+ // it down to the same 19 of ink every other mark shows.+ gemini: {+ path: 'M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81',+ ink: [0, 0, 24, 24],+ },openai: OPENAI_MARK,anthropic: ANTHROPIC_MARK,};diff --git a/vibe/data/api_key_vendors.json b/vibe/data/api_key_vendors.jsonindex fda5a836c..b76a556db 100644--- a/vibe/data/api_key_vendors.json+++ b/vibe/data/api_key_vendors.json@@ -1,4 +1,28 @@[+ {+ "id": "openai",+ "label": "OpenAI",+ "official_base_url": "https://api.openai.com/v1",+ "protocol": "openai_responses"+ },+ {+ "id": "anthropic",+ "label": "Anthropic",+ "official_base_url": "https://api.anthropic.com",+ "protocol": "anthropic"+ },+ {+ "id": "xai",+ "label": "xAI",+ "official_base_url": "https://api.x.ai/v1",+ "protocol": "openai_chat"+ },+ {+ "id": "gemini",+ "label": "Gemini",+ "official_base_url": "https://generativelanguage.googleapis.com/v1beta/openai",+ "protocol": "openai_chat"+ },{"id": "deepseek","label": "DeepSeek",@@ -17,24 +41,6 @@"official_base_url": "https://api.moonshot.cn/v1","protocol": "openai_chat"},- {- "id": "zhipuai",- "label": "Zhipu AI",- "official_base_url": "https://open.bigmodel.cn/api/paas/v4",- "protocol": "openai_chat"- },- {- "id": "openai",- "label": "OpenAI",- "official_base_url": "https://api.openai.com/v1",- "protocol": "openai_responses"- },- {- "id": "anthropic",- "label": "Anthropic",- "official_base_url": "https://api.anthropic.com",- "protocol": "anthropic"- },{"id": "openrouter","label": "OpenRouter",@@ -42,9 +48,9 @@"protocol": "openai_chat"},{- "id": "groq",- "label": "Groq",- "official_base_url": "https://api.groq.com/openai/v1",+ "id": "zhipuai",+ "label": "Zhipu AI",+ "official_base_url": "https://open.bigmodel.cn/api/paas/v4","protocol": "openai_chat"},{@@ -54,9 +60,9 @@"protocol": "openai_chat"},{- "id": "xai",- "label": "xAI",- "official_base_url": "https://api.x.ai/v1",+ "id": "groq",+ "label": "Groq",+ "official_base_url": "https://api.groq.com/openai/v1","protocol": "openai_chat"},{