mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-22 00:31:46 +00:00
Merge 15b066cc9c into b867ec9145
This commit is contained in:
commit
bfb57bd99d
20 changed files with 102 additions and 0 deletions
|
|
@ -59,6 +59,7 @@ import {
|
|||
StandardTooltip,
|
||||
} from "@src/components/ui"
|
||||
|
||||
import { Checkbox } from "vscrui"
|
||||
import { Tab, TabContent, TabHeader, TabList, TabTrigger } from "../common/Tab"
|
||||
import { SetCachedStateField, SetExperimentEnabled } from "./types"
|
||||
import { SectionHeader } from "./SectionHeader"
|
||||
|
|
@ -201,6 +202,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
|
|||
includeCurrentTime,
|
||||
includeCurrentCost,
|
||||
maxGitStatusFiles,
|
||||
lockApiConfigAcrossModes,
|
||||
} = cachedState
|
||||
|
||||
const apiConfiguration = useMemo(() => cachedState.apiConfiguration ?? {}, [cachedState.apiConfiguration])
|
||||
|
|
@ -416,6 +418,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
|
|||
// by the `updateSettings` message.
|
||||
vscode.postMessage({ type: "upsertApiConfiguration", text: currentApiConfigName, apiConfiguration })
|
||||
vscode.postMessage({ type: "debugSetting", bool: cachedState.debug })
|
||||
vscode.postMessage({ type: "lockApiConfigAcrossModes", bool: !!lockApiConfigAcrossModes })
|
||||
|
||||
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
|
||||
uriScheme={uriScheme}
|
||||
apiConfiguration={apiConfiguration}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,20 @@ import SettingsView from "../SettingsView"
|
|||
|
||||
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", () => ({
|
||||
__esModule: true,
|
||||
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,
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/ca/settings.json
generated
2
webview-ui/src/i18n/locales/ca/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Documentació de {{provider}}",
|
||||
"configProfile": "Perfil de configuració",
|
||||
"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",
|
||||
"apiProviderDocs": "Documentació del proveïdor",
|
||||
"model": "Model",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/de/settings.json
generated
2
webview-ui/src/i18n/locales/de/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}}-Dokumentation",
|
||||
"configProfile": "Konfigurationsprofil",
|
||||
"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",
|
||||
"apiProviderDocs": "Anbieter-Dokumentation",
|
||||
"model": "Modell",
|
||||
|
|
|
|||
|
|
@ -345,6 +345,8 @@
|
|||
"providerDocumentation": "{{provider}} documentation",
|
||||
"configProfile": "Configuration Profile",
|
||||
"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",
|
||||
"apiProviderDocs": "Provider Docs",
|
||||
"model": "Model",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/es/settings.json
generated
2
webview-ui/src/i18n/locales/es/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Documentación de {{provider}}",
|
||||
"configProfile": "Perfil de configuración",
|
||||
"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",
|
||||
"apiProviderDocs": "Documentación del Proveedor",
|
||||
"model": "Modelo",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/fr/settings.json
generated
2
webview-ui/src/i18n/locales/fr/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Documentation {{provider}}",
|
||||
"configProfile": "Profil de configuration",
|
||||
"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",
|
||||
"apiProviderDocs": "Documentation du Fournisseur",
|
||||
"model": "Modèle",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/hi/settings.json
generated
2
webview-ui/src/i18n/locales/hi/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}} दस्तावेज़ीकरण",
|
||||
"configProfile": "कॉन्फिगरेशन प्रोफाइल",
|
||||
"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 प्रदाता",
|
||||
"apiProviderDocs": "प्रदाता डॉक्स",
|
||||
"model": "मॉडल",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/id/settings.json
generated
2
webview-ui/src/i18n/locales/id/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Dokumentasi {{provider}}",
|
||||
"configProfile": "Profil Konfigurasi",
|
||||
"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",
|
||||
"apiProviderDocs": "Dokumentasi Penyedia",
|
||||
"model": "Model",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/it/settings.json
generated
2
webview-ui/src/i18n/locales/it/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Documentazione {{provider}}",
|
||||
"configProfile": "Profilo di configurazione",
|
||||
"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",
|
||||
"apiProviderDocs": "Documentazione del Provider",
|
||||
"model": "Modello",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/ja/settings.json
generated
2
webview-ui/src/i18n/locales/ja/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}}のドキュメント",
|
||||
"configProfile": "設定プロファイル",
|
||||
"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プロバイダー",
|
||||
"apiProviderDocs": "プロバイダードキュメント",
|
||||
"model": "モデル",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/ko/settings.json
generated
2
webview-ui/src/i18n/locales/ko/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}} 문서",
|
||||
"configProfile": "구성 프로필",
|
||||
"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 제공자",
|
||||
"apiProviderDocs": "공급자 문서",
|
||||
"model": "모델",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/nl/settings.json
generated
2
webview-ui/src/i18n/locales/nl/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}} documentatie",
|
||||
"configProfile": "Configuratieprofiel",
|
||||
"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",
|
||||
"apiProviderDocs": "Providerdocumentatie",
|
||||
"model": "Model",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/pl/settings.json
generated
2
webview-ui/src/i18n/locales/pl/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Dokumentacja {{provider}}",
|
||||
"configProfile": "Profil konfiguracji",
|
||||
"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",
|
||||
"apiProviderDocs": "Dokumentacja dostawcy",
|
||||
"model": "Model",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/pt-BR/settings.json
generated
2
webview-ui/src/i18n/locales/pt-BR/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Documentação do {{provider}}",
|
||||
"configProfile": "Perfil de configuração",
|
||||
"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",
|
||||
"apiProviderDocs": "Documentação do Provedor",
|
||||
"model": "Modelo",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/ru/settings.json
generated
2
webview-ui/src/i18n/locales/ru/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Документация {{provider}}",
|
||||
"configProfile": "Профиль конфигурации",
|
||||
"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",
|
||||
"apiProviderDocs": "Документация провайдера",
|
||||
"model": "Модель",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/tr/settings.json
generated
2
webview-ui/src/i18n/locales/tr/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}} Dokümantasyonu",
|
||||
"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.",
|
||||
"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ı",
|
||||
"apiProviderDocs": "Sağlayıcı Belgeleri",
|
||||
"model": "Model",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/vi/settings.json
generated
2
webview-ui/src/i18n/locales/vi/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "Tài liệu {{provider}}",
|
||||
"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.",
|
||||
"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",
|
||||
"apiProviderDocs": "Tài liệu Nhà cung cấp",
|
||||
"model": "Mẫu",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/zh-CN/settings.json
generated
2
webview-ui/src/i18n/locales/zh-CN/settings.json
generated
|
|
@ -283,6 +283,8 @@
|
|||
"providerDocumentation": "{{provider}} 文档",
|
||||
"configProfile": "配置文件",
|
||||
"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提供商",
|
||||
"apiProviderDocs": "提供商文档",
|
||||
"model": "模型",
|
||||
|
|
|
|||
2
webview-ui/src/i18n/locales/zh-TW/settings.json
generated
2
webview-ui/src/i18n/locales/zh-TW/settings.json
generated
|
|
@ -293,6 +293,8 @@
|
|||
"providerDocumentation": "{{provider}} 說明文件",
|
||||
"configProfile": "設定檔",
|
||||
"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 供應商",
|
||||
"apiProviderDocs": "供應商說明文件",
|
||||
"model": "模型",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue