This commit is contained in:
roomote-v0[bot] 2026-05-17 17:58:25 +00:00 • committed by GitHub
commit bfb57bd99d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 102 additions and 0 deletions

View file

@ -59,6 +59,7 @@ import {
StandardTooltip, StandardTooltip,
} from "@src/components/ui" } from "@src/components/ui"
import { Checkbox } from "vscrui"
import { Tab, TabContent, TabHeader, TabList, TabTrigger } from "../common/Tab" import { Tab, TabContent, TabHeader, TabList, TabTrigger } from "../common/Tab"
import { SetCachedStateField, SetExperimentEnabled } from "./types" import { SetCachedStateField, SetExperimentEnabled } from "./types"
import { SectionHeader } from "./SectionHeader" import { SectionHeader } from "./SectionHeader"
@ -201,6 +202,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
includeCurrentTime, includeCurrentTime,
includeCurrentCost, includeCurrentCost,
maxGitStatusFiles, maxGitStatusFiles,
lockApiConfigAcrossModes,
} = cachedState } = cachedState
const apiConfiguration = useMemo(() => cachedState.apiConfiguration ?? {}, [cachedState.apiConfiguration]) const apiConfiguration = useMemo(() => cachedState.apiConfiguration ?? {}, [cachedState.apiConfiguration])
@ -416,6 +418,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
// by the `updateSettings` message. // by the `updateSettings` message.
vscode.postMessage({ type: "upsertApiConfiguration", text: currentApiConfigName, apiConfiguration }) vscode.postMessage({ type: "upsertApiConfiguration", text: currentApiConfigName, apiConfiguration })
vscode.postMessage({ type: "debugSetting", bool: cachedState.debug }) vscode.postMessage({ type: "debugSetting", bool: cachedState.debug })
vscode.postMessage({ type: "lockApiConfigAcrossModes", bool: !!lockApiConfigAcrossModes })
setChangeDetected(false) setChangeDetected(false)
} }
@ -752,6 +755,19 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
}) })
} }
/> />
<div className="flex flex-col gap-1 mt-4 mb-2">
<Checkbox
checked={!!lockApiConfigAcrossModes}
onChange={(checked: boolean) =>
setCachedStateField("lockApiConfigAcrossModes", checked)
}
data-testid="lock-api-config-checkbox">
{t("settings:providers.lockApiConfigAcrossModes")}
</Checkbox>
<div className="text-sm text-vscode-descriptionForeground ml-6">
{t("settings:providers.lockApiConfigAcrossModesDescription")}
</div>
</div>
<ApiOptions <ApiOptions
uriScheme={uriScheme} uriScheme={uriScheme}
apiConfiguration={apiConfiguration} apiConfiguration={apiConfiguration}

View file

@ -10,6 +10,20 @@ import SettingsView from "../SettingsView"
vi.mock("@src/utils/vscode", () => ({ vscode: { postMessage: vi.fn() } })) vi.mock("@src/utils/vscode", () => ({ vscode: { postMessage: vi.fn() } }))
vi.mock("vscrui", () => ({
Checkbox: ({ children, checked, onChange, "data-testid": dataTestId }: any) => (
<label>
<input
type="checkbox"
checked={checked}
onChange={(e) => onChange(e.target.checked)}
data-testid={dataTestId}
/>
{children}
</label>
),
}))
vi.mock("../ApiConfigManager", () => ({ vi.mock("../ApiConfigManager", () => ({
__esModule: true, __esModule: true,
default: ({ currentApiConfigName }: any) => ( default: ({ currentApiConfigName }: any) => (
@ -714,3 +728,39 @@ describe("SettingsView - Duplicate Commands", () => {
) )
}) })
}) })
describe("SettingsView - Lock API Config Across Modes", () => {
beforeEach(() => {
vi.clearAllMocks()
})
it("renders lock API config checkbox unchecked by default on the providers tab", () => {
const { getSettingsContent } = renderSettingsView()
const content = getSettingsContent()
const lockCheckbox = within(content).getByTestId("lock-api-config-checkbox")
expect(lockCheckbox).not.toBeChecked()
})
it("toggles lock API config and sends lockApiConfigAcrossModes message on save", () => {
const { getSettingsContent } = renderSettingsView()
const content = getSettingsContent()
const lockCheckbox = within(content).getByTestId("lock-api-config-checkbox")
// Enable the lock
fireEvent.click(lockCheckbox)
expect(lockCheckbox).toBeChecked()
// Click Save
const saveButton = screen.getByTestId("save-button")
fireEvent.click(saveButton)
expect(vscode.postMessage).toHaveBeenCalledWith(
expect.objectContaining({
type: "lockApiConfigAcrossModes",
bool: true,
}),
)
})
})

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Documentació de {{provider}}", "providerDocumentation": "Documentació de {{provider}}",
"configProfile": "Perfil de configuració", "configProfile": "Perfil de configuració",
"description": "Deseu diferents configuracions d'API per canviar ràpidament entre proveïdors i configuracions.", "description": "Deseu diferents configuracions d'API per canviar ràpidament entre proveïdors i configuracions.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Proveïdor d'API", "apiProvider": "Proveïdor d'API",
"apiProviderDocs": "Documentació del proveïdor", "apiProviderDocs": "Documentació del proveïdor",
"model": "Model", "model": "Model",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}}-Dokumentation", "providerDocumentation": "{{provider}}-Dokumentation",
"configProfile": "Konfigurationsprofil", "configProfile": "Konfigurationsprofil",
"description": "Speichern Sie verschiedene API-Konfigurationen, um schnell zwischen Anbietern und Einstellungen zu wechseln.", "description": "Speichern Sie verschiedene API-Konfigurationen, um schnell zwischen Anbietern und Einstellungen zu wechseln.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API-Anbieter", "apiProvider": "API-Anbieter",
"apiProviderDocs": "Anbieter-Dokumentation", "apiProviderDocs": "Anbieter-Dokumentation",
"model": "Modell", "model": "Modell",

View file

@ -345,6 +345,8 @@
"providerDocumentation": "{{provider}} documentation", "providerDocumentation": "{{provider}} documentation",
"configProfile": "Configuration Profile", "configProfile": "Configuration Profile",
"description": "Save different API configurations to quickly switch between providers and settings.", "description": "Save different API configurations to quickly switch between providers and settings.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API Provider", "apiProvider": "API Provider",
"apiProviderDocs": "Provider Docs", "apiProviderDocs": "Provider Docs",
"model": "Model", "model": "Model",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Documentación de {{provider}}", "providerDocumentation": "Documentación de {{provider}}",
"configProfile": "Perfil de configuración", "configProfile": "Perfil de configuración",
"description": "Guarde diferentes configuraciones de API para cambiar rápidamente entre proveedores y ajustes.", "description": "Guarde diferentes configuraciones de API para cambiar rápidamente entre proveedores y ajustes.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Proveedor de API", "apiProvider": "Proveedor de API",
"apiProviderDocs": "Documentación del Proveedor", "apiProviderDocs": "Documentación del Proveedor",
"model": "Modelo", "model": "Modelo",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Documentation {{provider}}", "providerDocumentation": "Documentation {{provider}}",
"configProfile": "Profil de configuration", "configProfile": "Profil de configuration",
"description": "Enregistrez différentes configurations d'API pour basculer rapidement entre les fournisseurs et les paramètres.", "description": "Enregistrez différentes configurations d'API pour basculer rapidement entre les fournisseurs et les paramètres.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Fournisseur d'API", "apiProvider": "Fournisseur d'API",
"apiProviderDocs": "Documentation du Fournisseur", "apiProviderDocs": "Documentation du Fournisseur",
"model": "Modèle", "model": "Modèle",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}} दस्तावेज़ीकरण", "providerDocumentation": "{{provider}} दस्तावेज़ीकरण",
"configProfile": "कॉन्फिगरेशन प्रोफाइल", "configProfile": "कॉन्फिगरेशन प्रोफाइल",
"description": "विभिन्न API कॉन्फ़िगरेशन सहेजें ताकि प्रदाताओं और सेटिंग्स के बीच त्वरित रूप से स्विच कर सकें।", "description": "विभिन्न API कॉन्फ़िगरेशन सहेजें ताकि प्रदाताओं और सेटिंग्स के बीच त्वरित रूप से स्विच कर सकें।",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API प्रदाता", "apiProvider": "API प्रदाता",
"apiProviderDocs": "प्रदाता डॉक्स", "apiProviderDocs": "प्रदाता डॉक्स",
"model": "मॉडल", "model": "मॉडल",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Dokumentasi {{provider}}", "providerDocumentation": "Dokumentasi {{provider}}",
"configProfile": "Profil Konfigurasi", "configProfile": "Profil Konfigurasi",
"description": "Simpan konfigurasi API yang berbeda untuk beralih dengan cepat antara provider dan pengaturan.", "description": "Simpan konfigurasi API yang berbeda untuk beralih dengan cepat antara provider dan pengaturan.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Provider API", "apiProvider": "Provider API",
"apiProviderDocs": "Dokumentasi Penyedia", "apiProviderDocs": "Dokumentasi Penyedia",
"model": "Model", "model": "Model",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Documentazione {{provider}}", "providerDocumentation": "Documentazione {{provider}}",
"configProfile": "Profilo di configurazione", "configProfile": "Profilo di configurazione",
"description": "Salva diverse configurazioni API per passare rapidamente tra fornitori e impostazioni.", "description": "Salva diverse configurazioni API per passare rapidamente tra fornitori e impostazioni.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Fornitore API", "apiProvider": "Fornitore API",
"apiProviderDocs": "Documentazione del Provider", "apiProviderDocs": "Documentazione del Provider",
"model": "Modello", "model": "Modello",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}}のドキュメント", "providerDocumentation": "{{provider}}のドキュメント",
"configProfile": "設定プロファイル", "configProfile": "設定プロファイル",
"description": "異なるAPI設定を保存して、プロバイダーと設定をすばやく切り替えることができます。", "description": "異なるAPI設定を保存して、プロバイダーと設定をすばやく切り替えることができます。",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "APIプロバイダー", "apiProvider": "APIプロバイダー",
"apiProviderDocs": "プロバイダードキュメント", "apiProviderDocs": "プロバイダードキュメント",
"model": "モデル", "model": "モデル",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}} 문서", "providerDocumentation": "{{provider}} 문서",
"configProfile": "구성 프로필", "configProfile": "구성 프로필",
"description": "다양한 API 구성을 저장하여 제공자와 설정 간에 빠르게 전환할 수 있습니다.", "description": "다양한 API 구성을 저장하여 제공자와 설정 간에 빠르게 전환할 수 있습니다.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API 제공자", "apiProvider": "API 제공자",
"apiProviderDocs": "공급자 문서", "apiProviderDocs": "공급자 문서",
"model": "모델", "model": "모델",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}} documentatie", "providerDocumentation": "{{provider}} documentatie",
"configProfile": "Configuratieprofiel", "configProfile": "Configuratieprofiel",
"description": "Sla verschillende API-configuraties op om snel te wisselen tussen providers en instellingen.", "description": "Sla verschillende API-configuraties op om snel te wisselen tussen providers en instellingen.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API-provider", "apiProvider": "API-provider",
"apiProviderDocs": "Providerdocumentatie", "apiProviderDocs": "Providerdocumentatie",
"model": "Model", "model": "Model",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Dokumentacja {{provider}}", "providerDocumentation": "Dokumentacja {{provider}}",
"configProfile": "Profil konfiguracji", "configProfile": "Profil konfiguracji",
"description": "Zapisz różne konfiguracje API, aby szybko przełączać się między dostawcami i ustawieniami.", "description": "Zapisz różne konfiguracje API, aby szybko przełączać się między dostawcami i ustawieniami.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Dostawca API", "apiProvider": "Dostawca API",
"apiProviderDocs": "Dokumentacja dostawcy", "apiProviderDocs": "Dokumentacja dostawcy",
"model": "Model", "model": "Model",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Documentação do {{provider}}", "providerDocumentation": "Documentação do {{provider}}",
"configProfile": "Perfil de configuração", "configProfile": "Perfil de configuração",
"description": "Salve diferentes configurações de API para alternar rapidamente entre provedores e configurações.", "description": "Salve diferentes configurações de API para alternar rapidamente entre provedores e configurações.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Provedor de API", "apiProvider": "Provedor de API",
"apiProviderDocs": "Documentação do Provedor", "apiProviderDocs": "Documentação do Provedor",
"model": "Modelo", "model": "Modelo",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Документация {{provider}}", "providerDocumentation": "Документация {{provider}}",
"configProfile": "Профиль конфигурации", "configProfile": "Профиль конфигурации",
"description": "Сохраняйте различные конфигурации API для быстрого переключения между провайдерами и настройками.", "description": "Сохраняйте различные конфигурации API для быстрого переключения между провайдерами и настройками.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Провайдер API", "apiProvider": "Провайдер API",
"apiProviderDocs": "Документация провайдера", "apiProviderDocs": "Документация провайдера",
"model": "Модель", "model": "Модель",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}} Dokümantasyonu", "providerDocumentation": "{{provider}} Dokümantasyonu",
"configProfile": "Yapılandırma Profili", "configProfile": "Yapılandırma Profili",
"description": "Sağlayıcılar ve ayarlar arasında hızlıca geçiş yapmak için farklı API yapılandırmalarını kaydedin.", "description": "Sağlayıcılar ve ayarlar arasında hızlıca geçiş yapmak için farklı API yapılandırmalarını kaydedin.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API Sağlayıcı", "apiProvider": "API Sağlayıcı",
"apiProviderDocs": "Sağlayıcı Belgeleri", "apiProviderDocs": "Sağlayıcı Belgeleri",
"model": "Model", "model": "Model",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "Tài liệu {{provider}}", "providerDocumentation": "Tài liệu {{provider}}",
"configProfile": "Hồ sơ cấu hình", "configProfile": "Hồ sơ cấu hình",
"description": "Lưu các cấu hình API khác nhau để nhanh chóng chuyển đổi giữa các nhà cung cấp và cài đặt.", "description": "Lưu các cấu hình API khác nhau để nhanh chóng chuyển đổi giữa các nhà cung cấp và cài đặt.",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "Nhà cung cấp API", "apiProvider": "Nhà cung cấp API",
"apiProviderDocs": "Tài liệu Nhà cung cấp", "apiProviderDocs": "Tài liệu Nhà cung cấp",
"model": "Mẫu", "model": "Mẫu",

View file

@ -283,6 +283,8 @@
"providerDocumentation": "{{provider}} 文档", "providerDocumentation": "{{provider}} 文档",
"configProfile": "配置文件", "configProfile": "配置文件",
"description": "保存多组API配置便于快速切换", "description": "保存多组API配置便于快速切换",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API提供商", "apiProvider": "API提供商",
"apiProviderDocs": "提供商文档", "apiProviderDocs": "提供商文档",
"model": "模型", "model": "模型",

View file

@ -293,6 +293,8 @@
"providerDocumentation": "{{provider}} 說明文件", "providerDocumentation": "{{provider}} 說明文件",
"configProfile": "設定檔", "configProfile": "設定檔",
"description": "儲存不同的 API 設定以快速切換供應商和設定。", "description": "儲存不同的 API 設定以快速切換供應商和設定。",
"lockApiConfigAcrossModes": "Use the same configuration for all modes",
"lockApiConfigAcrossModesDescription": "When enabled, switching modes (e.g. Code, Architect, Ask) will keep the current API configuration instead of switching to a mode-specific one.",
"apiProvider": "API 供應商", "apiProvider": "API 供應商",
"apiProviderDocs": "供應商說明文件", "apiProviderDocs": "供應商說明文件",
"model": "模型", "model": "模型",