Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix: use shared custom model protocol picker

BlueSkyID666d0f5976207b4
diff --git a/README.md b/README.md
index 0c3a0088..22f10777 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ Orkas is an open-source, local-first multi-agent desktop app. A super-powered Co
No. Orkas runs on your machine but calls the models you choose through your own API keys (or a local model endpoint). It orchestrates agents and tools — it is not itself a model.
**Can I use local models like Ollama or LM Studio?**
-Yes. Open **Account settings → Models → Chat → Add model → Custom**, select **OpenAI-compatible** or **Anthropic Messages**, and enter the base URL, exact model ID, and API key. Choose the saved model from the task’s model control.
+Yes. Open **Account settings → Models → Chat → Add model → Custom**, select **OpenAI-compatible** or **Anthropic-compatible**, and enter the base URL, exact model ID, and API key. Choose the saved model from the task’s model control.
**Where are my API keys and data stored?**
On your disk. Conversations, files, knowledge bases, agents, and keys stay local; model calls go straight from your machine to the provider and are never proxied or archived by Orkas.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index e3dcdc81..1ab1f316 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -103,7 +103,7 @@ Orkas 是一个开源、本地优先的多智能体桌面应用。一个超强
不是。Orkas 运行在你的机器上,但通过你自己的 API key(或本地模型端点)调用你选择的模型。它编排智能体与工具,本身不是模型。
**能用 Ollama、LM Studio 这类本地模型吗?**
-可以。打开 **账号设置 → 模型 → 对话 → 添加模型 → 自定义**,选择 **OpenAI 兼容** 或 **Anthropic Messages** 协议,填写基础地址、准确模型 ID 和 API key。保存后,在任务输入框的模型控件中选择该模型。
+可以。打开 **账号设置 → 模型 → 对话 → 添加模型 → 自定义**,选择 **OpenAI 兼容** 或 **Anthropic 兼容** 协议,填写基础地址、准确模型 ID 和 API key。保存后,在任务输入框的模型控件中选择该模型。
**我的 API key 和数据存在哪里?**
在你的硬盘上。对话、文件、知识库、智能体和 key 都留在本地;模型调用从你的机器直连服务商,绝不被 Orkas 代理或归档。
diff --git a/src/renderer/locales/ar.json b/src/renderer/locales/ar.json
index 189da08d..d5c83999 100644
--- a/src/renderer/locales/ar.json
+++ b/src/renderer/locales/ar.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "اختر البروتوكول الذي تدعمه بوابتك. بالنسبة إلى Anthropic، أدخل عنوان URL الأساسي للخادم، بما في ذلك بادئة مسار البوابة.",
"settings.custom.protocol": "البروتوكول",
"settings.custom.protocol_openai": "متوافق مع OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "متوافق مع Anthropic",
"settings.custom.label": "التسمية (اختياري)",
"settings.custom.label_placeholder": "مثلًا: بوابة الشركة",
"settings.custom.base_url": "URL الأساسي لـ API",
diff --git a/src/renderer/locales/de.json b/src/renderer/locales/de.json
index ad50ab6a..3bcc2d28 100644
--- a/src/renderer/locales/de.json
+++ b/src/renderer/locales/de.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Wählen Sie das Protokoll Ihres Gateways. Geben Sie für Anthropic die Basis-URL des Servers einschließlich des Gateway-Pfadpräfixes ein.",
"settings.custom.protocol": "Protokoll",
"settings.custom.protocol_openai": "OpenAI-kompatibel",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic-kompatibel",
"settings.custom.label": "Bezeichnung (optional)",
"settings.custom.label_placeholder": "Zum Beispiel: Unternehmensgateway",
"settings.custom.base_url": "API-Basis-URL",
diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.json
index 0a1a2ceb..cbf577c9 100644
--- a/src/renderer/locales/en.json
+++ b/src/renderer/locales/en.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Choose the protocol supported by your gateway. For Anthropic, enter the server base URL, including any gateway prefix.",
"settings.custom.protocol": "Protocol",
"settings.custom.protocol_openai": "OpenAI-compatible",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic-compatible",
"settings.custom.label": "Label (optional)",
"settings.custom.label_placeholder": "For example: company gateway",
"settings.custom.base_url": "API Base URL",
diff --git a/src/renderer/locales/es-419.json b/src/renderer/locales/es-419.json
index 9730dbdd..e248e763 100644
--- a/src/renderer/locales/es-419.json
+++ b/src/renderer/locales/es-419.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Elige el protocolo compatible con tu gateway. Para Anthropic, ingresa la URL base del servidor, incluido el prefijo de ruta del gateway.",
"settings.custom.protocol": "Protocolo",
"settings.custom.protocol_openai": "Compatible con OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Compatible con Anthropic",
"settings.custom.label": "Etiqueta (opcional)",
"settings.custom.label_placeholder": "Por ejemplo: pasarela de la empresa",
"settings.custom.base_url": "URL base de la API",
diff --git a/src/renderer/locales/es.json b/src/renderer/locales/es.json
index 89386dae..b0813e5e 100644
--- a/src/renderer/locales/es.json
+++ b/src/renderer/locales/es.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Elige el protocolo compatible con tu gateway. Para Anthropic, introduce la URL base del servidor, incluido el prefijo de ruta del gateway.",
"settings.custom.protocol": "Protocolo",
"settings.custom.protocol_openai": "Compatible con OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Compatible con Anthropic",
"settings.custom.label": "Etiqueta (opcional)",
"settings.custom.label_placeholder": "Por ejemplo: pasarela de la empresa",
"settings.custom.base_url": "URL base de la API",
diff --git a/src/renderer/locales/fr.json b/src/renderer/locales/fr.json
index c21ecc65..07f3fcf5 100644
--- a/src/renderer/locales/fr.json
+++ b/src/renderer/locales/fr.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Choisissez le protocole pris en charge par votre passerelle. Pour Anthropic, saisissez l’URL de base du serveur, avec le préfixe de chemin de la passerelle.",
"settings.custom.protocol": "Protocole",
"settings.custom.protocol_openai": "Compatible OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Compatible Anthropic",
"settings.custom.label": "Libellé (facultatif)",
"settings.custom.label_placeholder": "Par exemple : passerelle d’entreprise",
"settings.custom.base_url": "URL de base de l’API",
diff --git a/src/renderer/locales/hi.json b/src/renderer/locales/hi.json
index bfa96369..f7518067 100644
--- a/src/renderer/locales/hi.json
+++ b/src/renderer/locales/hi.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "अपने गेटवे का समर्थित प्रोटोकॉल चुनें। Anthropic के लिए गेटवे पथ उपसर्ग सहित सर्वर का आधार URL दर्ज करें।",
"settings.custom.protocol": "प्रोटोकॉल",
"settings.custom.protocol_openai": "OpenAI-संगत",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic-संगत",
"settings.custom.label": "लेबल (वैकल्पिक)",
"settings.custom.label_placeholder": "जैसे: कंपनी गेटवे",
"settings.custom.base_url": "API बेस URL",
diff --git a/src/renderer/locales/id.json b/src/renderer/locales/id.json
index 30af9b74..4dd11a5b 100644
--- a/src/renderer/locales/id.json
+++ b/src/renderer/locales/id.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Pilih protokol yang didukung gateway Anda. Untuk Anthropic, masukkan URL dasar server, termasuk awalan jalur gateway.",
"settings.custom.protocol": "Protokol",
"settings.custom.protocol_openai": "Kompatibel OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Kompatibel Anthropic",
"settings.custom.label": "Label (opsional)",
"settings.custom.label_placeholder": "Sebagai contoh: gerbang perusahaan",
"settings.custom.base_url": "URL Dasar API",
diff --git a/src/renderer/locales/it.json b/src/renderer/locales/it.json
index e96d5f82..1d08659d 100644
--- a/src/renderer/locales/it.json
+++ b/src/renderer/locales/it.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Scegli il protocollo supportato dal gateway. Per Anthropic, inserisci l’URL di base del server, incluso il prefisso del percorso del gateway.",
"settings.custom.protocol": "Protocollo",
"settings.custom.protocol_openai": "Compatibile con OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Compatibile con Anthropic",
"settings.custom.label": "Etichetta (facoltativa)",
"settings.custom.label_placeholder": "Ad esempio: gateway aziendale",
"settings.custom.base_url": "URL di base API",
diff --git a/src/renderer/locales/ja.json b/src/renderer/locales/ja.json
index 1db472dc..7144b547 100644
--- a/src/renderer/locales/ja.json
+++ b/src/renderer/locales/ja.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "ゲートウェイが対応するプロトコルを選択します。Anthropic ではゲートウェイのパス接頭辞を含むサーバーのベース URL を入力してください。",
"settings.custom.protocol": "プロトコル",
"settings.custom.protocol_openai": "OpenAI 互換",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic 互換",
"settings.custom.label": "ラベル(任意)",
"settings.custom.label_placeholder": "例: 会社のゲートウェイ",
"settings.custom.base_url": "API Base URL",
diff --git a/src/renderer/locales/ko.json b/src/renderer/locales/ko.json
index 3995cabf..939446e7 100644
--- a/src/renderer/locales/ko.json
+++ b/src/renderer/locales/ko.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "게이트웨이가 지원하는 프로토콜을 선택하세요. Anthropic은 게이트웨이 경로 접두사를 포함한 서버 기본 URL을 입력하세요.",
"settings.custom.protocol": "프로토콜",
"settings.custom.protocol_openai": "OpenAI 호환",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic 호환",
"settings.custom.label": "라벨(선택 사항)",
"settings.custom.label_placeholder": "예: 회사 게이트웨이",
"settings.custom.base_url": "API Base URL",
diff --git a/src/renderer/locales/pt-pt.json b/src/renderer/locales/pt-pt.json
index e85e1ce4..a5bebc06 100644
--- a/src/renderer/locales/pt-pt.json
+++ b/src/renderer/locales/pt-pt.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Escolha o protocolo suportado pelo seu gateway. Para Anthropic, introduza o URL base do servidor, incluindo o prefixo do caminho do gateway.",
"settings.custom.protocol": "Protocolo",
"settings.custom.protocol_openai": "Compatível com OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Compatível com Anthropic",
"settings.custom.label": "Etiqueta (opcional)",
"settings.custom.label_placeholder": "Por exemplo: gateway da empresa",
"settings.custom.base_url": "URL base da API",
diff --git a/src/renderer/locales/pt.json b/src/renderer/locales/pt.json
index f2396ee8..78e6ee9a 100644
--- a/src/renderer/locales/pt.json
+++ b/src/renderer/locales/pt.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Escolha o protocolo compatível com seu gateway. Para Anthropic, informe a URL base do servidor, incluindo o prefixo do caminho do gateway.",
"settings.custom.protocol": "Protocolo",
"settings.custom.protocol_openai": "Compatível com OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Compatível com Anthropic",
"settings.custom.label": "Etiqueta (opcional)",
"settings.custom.label_placeholder": "Por exemplo: gateway da empresa",
"settings.custom.base_url": "URL base da API",
diff --git a/src/renderer/locales/ru.json b/src/renderer/locales/ru.json
index 9e5316ea..f6bc26c4 100644
--- a/src/renderer/locales/ru.json
+++ b/src/renderer/locales/ru.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Выберите протокол, поддерживаемый шлюзом. Для Anthropic укажите базовый URL сервера, включая префикс пути шлюза.",
"settings.custom.protocol": "Протокол",
"settings.custom.protocol_openai": "Совместимый с OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Совместимый с Anthropic",
"settings.custom.label": "Метка (необязательно)",
"settings.custom.label_placeholder": "Например: шлюз компании",
"settings.custom.base_url": "API Base URL",
diff --git a/src/renderer/locales/th.json b/src/renderer/locales/th.json
index e3ea7349..d0cedaa9 100644
--- a/src/renderer/locales/th.json
+++ b/src/renderer/locales/th.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "เลือกโปรโตคอลที่เกตเวย์รองรับ สำหรับ Anthropic ให้กรอก URL ฐานของเซิร์ฟเวอร์ รวมคำนำหน้าเส้นทางของเกตเวย์",
"settings.custom.protocol": "โปรโตคอล",
"settings.custom.protocol_openai": "เข้ากันได้กับ OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "เข้ากันได้กับ Anthropic",
"settings.custom.label": "ป้ายชื่อ (ไม่บังคับ)",
"settings.custom.label_placeholder": "เช่น: เกตเวย์บริษัท",
"settings.custom.base_url": "URL ฐาน ของ API",
diff --git a/src/renderer/locales/tr.json b/src/renderer/locales/tr.json
index e5f12a51..e1348126 100644
--- a/src/renderer/locales/tr.json
+++ b/src/renderer/locales/tr.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Ağ geçidinizin desteklediği protokolü seçin. Anthropic için ağ geçidi yol öneki dahil sunucunun temel URL’sini girin.",
"settings.custom.protocol": "Protokol",
"settings.custom.protocol_openai": "OpenAI uyumlu",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic uyumlu",
"settings.custom.label": "Etiket (isteğe bağlı)",
"settings.custom.label_placeholder": "Örneğin: şirket ağ geçidi",
"settings.custom.base_url": "API Temel URL'si",
diff --git a/src/renderer/locales/vi.json b/src/renderer/locales/vi.json
index 047e70a8..121d5ebd 100644
--- a/src/renderer/locales/vi.json
+++ b/src/renderer/locales/vi.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "Chọn giao thức được cổng hỗ trợ. Với Anthropic, nhập URL cơ sở của máy chủ, gồm cả tiền tố đường dẫn của cổng.",
"settings.custom.protocol": "Giao thức",
"settings.custom.protocol_openai": "Tương thích OpenAI",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Tương thích Anthropic",
"settings.custom.label": "Nhãn (không bắt buộc)",
"settings.custom.label_placeholder": "Ví dụ: cổng kết nối công ty",
"settings.custom.base_url": "URL cơ sở API",
diff --git a/src/renderer/locales/zh-tw.json b/src/renderer/locales/zh-tw.json
index 4dfa09b0..b2526309 100644
--- a/src/renderer/locales/zh-tw.json
+++ b/src/renderer/locales/zh-tw.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "選擇閘道支援的協定。Anthropic 請填寫服務基礎位址,保留閘道路徑前綴。",
"settings.custom.protocol": "協定",
"settings.custom.protocol_openai": "OpenAI 相容",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic 相容",
"settings.custom.label": "標籤(可選)",
"settings.custom.label_placeholder": "例如:公司閘道",
"settings.custom.base_url": "API 基底 URL",
diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.json
index a3993ce0..0e1e6f3c 100644
--- a/src/renderer/locales/zh.json
+++ b/src/renderer/locales/zh.json
@@ -1621,7 +1621,7 @@
"settings.custom.compat_hint": "选择网关支持的协议。Anthropic 请填写服务基础地址,保留网关路径前缀。",
"settings.custom.protocol": "协议",
"settings.custom.protocol_openai": "OpenAI 兼容",
- "settings.custom.protocol_anthropic": "Anthropic Messages",
+ "settings.custom.protocol_anthropic": "Anthropic 兼容",
"settings.custom.label": "标签(可选)",
"settings.custom.label_placeholder": "例如:公司网关",
"settings.custom.base_url": "API Base URL",
diff --git a/src/renderer/modules/settings.js b/src/renderer/modules/settings.js
index c8f584e5..f30b0aa4 100644
--- a/src/renderer/modules/settings.js
+++ b/src/renderer/modules/settings.js
@@ -1609,12 +1609,9 @@ function _settingsShowCustomModelForm(provider) {
<label>${escapeHtml(t('settings.custom.label'))}</label>
<input type="text" class="custom-label-input form-input" placeholder="${escapeHtml(t('settings.custom.label_placeholder'))}" autocomplete="off" spellcheck="false" />
</div>
- <div class="form-row">
+ <div class="form-row settings-form-row">
<label>${escapeHtml(t('settings.custom.protocol'))}</label>
- <select class="custom-protocol-input form-input">
- <option value="openai">${escapeHtml(t('settings.custom.protocol_openai'))}</option>
- <option value="anthropic">${escapeHtml(t('settings.custom.protocol_anthropic'))}</option>
- </select>
+ <div class="ai-select custom-protocol-input"></div>
</div>
<div class="form-row">
<label>${escapeHtml(t('settings.custom.base_url'))}</label>
@@ -1644,8 +1641,16 @@ function _settingsShowCustomModelForm(provider) {
const maxTokensInput = body.querySelector('.custom-max-tokens-input');
const keyInput = body.querySelector('.custom-key-input');
const msg = body.querySelector('.form-msg');
- protocolInput.addEventListener('change', () => {
- baseUrlInput.placeholder = protocolInput.value === 'anthropic'
+ const protocolSelect = _aiSelectMount(protocolInput, {
+ options: [
+ { value: 'openai', label: t('settings.custom.protocol_openai') },
+ { value: 'anthropic', label: t('settings.custom.protocol_anthropic') },
+ ],
+ value: 'openai',
+ ariaLabel: t('settings.custom.protocol'),
+ });
+ protocolSelect.onChange((value) => {
+ baseUrlInput.placeholder = value === 'anthropic'
? 'https://api.example.com' : 'https://api.example.com/v1';
});
@@ -1661,7 +1666,7 @@ function _settingsShowCustomModelForm(provider) {
const startedAt = Date.now();
const payload = _settingsBuildCustomModelPayload({
label: labelInput.value,
- protocol: protocolInput.value,
+ protocol: protocolSelect.getValue(),
baseUrl: baseUrlInput.value,
model: modelInput.value,
maxTokens: maxTokensInput.value,
@@ -1710,8 +1715,7 @@ function _settingsShowCustomModelForm(provider) {
if (e.key === 'Enter') { next.focus(); e.preventDefault(); }
});
};
- focusNextOnEnter(labelInput, protocolInput);
- focusNextOnEnter(protocolInput, baseUrlInput);
+ focusNextOnEnter(labelInput, protocolInput.querySelector('.ai-select-trigger'));
focusNextOnEnter(baseUrlInput, modelInput);
focusNextOnEnter(modelInput, maxTokensInput);
focusNextOnEnter(maxTokensInput, keyInput);
diff --git a/test/e2e/settings_e2e_modules.spec.ts b/test/e2e/settings_e2e_modules.spec.ts
index 3f3a981c..5c3dbb10 100644
--- a/test/e2e/settings_e2e_modules.spec.ts
+++ b/test/e2e/settings_e2e_modules.spec.ts
@@ -125,8 +125,28 @@ test.describe('settings modules and model guard', () => {
await expect(modal).toHaveClass(/\bopen\b/);
await expect(orkas.page.locator('#settings-add-modal')).not.toHaveClass(/\bopen\b/);
await expect(modal.locator('.custom-key-input')).toHaveAttribute('type', 'password');
- await expect(modal.locator('.custom-protocol-input')).toHaveValue('openai');
- await modal.locator('.custom-protocol-input').selectOption(protocol);
+ const protocolPicker = modal.locator('.custom-protocol-input');
+ const protocolTrigger = protocolPicker.getByRole('combobox', { name: 'Protocol', exact: true });
+ await expect(protocolPicker).toHaveAttribute('data-value', 'openai');
+ await expect(protocolTrigger).toHaveText('OpenAI-compatible');
+ await protocolTrigger.click();
+ const protocolMenu = orkas.page.locator('.ai-select-popover:visible');
+ await expect(protocolMenu.getByRole('option', { name: 'Anthropic-compatible', exact: true })).toBeVisible();
+ await test.info().attach('custom-protocol-menu', {
+ body: await modal.screenshot(), contentType: 'image/png',
+ });
+ await orkas.page.keyboard.press('Escape');
+ await expect(protocolMenu).toHaveCount(0);
+ await expect(modal).toHaveClass(/\bopen\b/);
+ await protocolTrigger.click();
+ if (protocol === 'anthropic') await orkas.page.keyboard.press('ArrowDown');
+ await orkas.page.keyboard.press('Enter');
+ await expect(protocolMenu).toHaveCount(0);
+ await expect(protocolPicker).toHaveAttribute('data-value', protocol);
+ await expect(protocolTrigger).toHaveText(protocol === 'anthropic'
+ ? 'Anthropic-compatible' : 'OpenAI-compatible');
+ await orkas.page.keyboard.press('Tab');
+ await expect(modal.locator('.custom-base-url-input')).toBeFocused();
await expect(modal.locator('.custom-base-url-input')).toHaveAttribute('placeholder',
protocol === 'anthropic' ? 'https://api.example.com' : 'https://api.example.com/v1');
await modal.locator('.custom-label-input').fill('E2E Private Gateway');
diff --git a/test/renderer/settings-add-account.test.ts b/test/renderer/settings-add-account.test.ts
index 430e9aa8..3b44c0c4 100644
--- a/test/renderer/settings-add-account.test.ts
+++ b/test/renderer/settings-add-account.test.ts
@@ -21,6 +21,7 @@ class FakeElement {
textContent = '';
value = '';
type = '';
+ placeholder = '';
title = '';
hidden = false;
disabled = false;
@@ -125,17 +126,21 @@ function loadSettingsClickHarness(
return { ok: true };
});
+ const selects = new Map<FakeElement, any>();
const aiSelectMount = (element: FakeElement, config: Record<string, unknown> = {}) => {
let value = typeof config.value === 'string' ? config.value : '';
- let options: Array<{ value: string }> = [];
+ let options = (config.options || []) as Array<{ value: string; label?: string }>;
let changeHandler: (next: string) => unknown = () => undefined;
- return {
+ element.dataset.value = value;
+ element.setQueryResult('.ai-select-trigger', new FakeElement());
+ const api = {
setOptions(nextOptions: Array<{ value: string }>, next: { value?: string } = {}) {
options = nextOptions || [];
if (typeof next.value === 'string') value = next.value;
if (value && !options.some((option) => option.value === value)) value = '';
element.dataset.value = value;
},
+ close: vi.fn(),
getValue: () => value,
getOptions: () => options,
setAriaLabel() {},
@@ -150,6 +155,8 @@ function loadSettingsClickHarness(
return changeHandler(next);
},
};
+ selects.set(element, api);
+ return api;
};
const monitor = { event: vi.fn(), error: vi.fn(), click: vi.fn() };
@@ -194,11 +201,11 @@ function loadSettingsClickHarness(
}];
_settingsState.modelsCache = {};
`, context);
- return { context, elements, indexHtml, settingsSource: source, invoke, monitor };
+ return { context, elements, indexHtml, settingsSource: source, invoke, monitor, selects };
}
-it('submits the selected Anthropic protocol without losing a gateway prefix', async () => {
- const { context, elements, invoke } = loadSettingsClickHarness();
+it('submits the shared protocol picker selection without losing a gateway prefix', async () => {
+ const { context, elements, invoke, selects } = loadSettingsClickHarness();
const body = elements.get('add-account-body')!;
for (const [selector, value] of Object.entries({
'.custom-label-input': 'Gateway', '.custom-protocol-input': 'anthropic',
@@ -207,6 +214,10 @@ it('submits the selected Anthropic protocol without losing a gateway prefix', as
'.custom-key-input': 'synthetic-form-key', '.form-msg': '',
})) { const field = new FakeElement(); field.value = value; body.setQueryResult(selector, field); }
context._settingsShowCustomModelForm({ id: 'custom', label: 'Custom' });
+ const protocolPicker = selects.get(body.querySelector('.custom-protocol-input')!);
+ expect(protocolPicker.getValue()).toBe('openai');
+ protocolPicker.emitChange('anthropic');
+ expect(body.querySelector('.custom-base-url-input')!.placeholder).toBe('https://api.example.com');
await elements.get('add-account-actions')!.children.at(-1)!.click();
expect(invoke).toHaveBeenCalledWith('auth.addCustomModelEntry', {
label: 'Gateway', protocol: 'anthropic', baseUrl: 'https://gateway.example.test/proxy/v1/messages',