From 66c80452e31951e810916780eef68137ef72e858 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 11:46:26 +0000 Subject: [PATCH 1/4] Initial plan From 8eba68e47a08834229407ab13d96967c270a5f4a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 11:54:13 +0000 Subject: [PATCH 2/4] Add Restore Default Claude CLI button to settings page Co-authored-by: simon-ami <102378134+simon-ami@users.noreply.github.com> --- public/js/components/claude-config.js | 23 +++++++++++++++++ public/js/store.js | 6 +++++ public/views/settings.html | 11 +++++++- src/utils/claude-config.js | 29 +++++++++++++++++++++ src/webui/index.js | 37 ++++++++++++++++++++++++++- 5 files changed, 104 insertions(+), 2 deletions(-) diff --git a/public/js/components/claude-config.js b/public/js/components/claude-config.js index d240ab0..af5bb00 100644 --- a/public/js/components/claude-config.js +++ b/public/js/components/claude-config.js @@ -9,6 +9,7 @@ window.Components.claudeConfig = () => ({ configPath: '', // Dynamic path from backend models: [], loading: false, + restoring: false, gemini1mSuffix: false, // Model fields that may contain Gemini model names @@ -141,5 +142,27 @@ window.Components.claudeConfig = () => ({ } finally { this.loading = false; } + }, + + async restoreDefaultClaudeConfig() { + this.restoring = true; + const password = Alpine.store('global').webuiPassword; + try { + const { response, newPassword } = await window.utils.request('/api/claude/config/restore', { + method: 'POST', + headers: { 'Content-Type': 'application/json' } + }, password); + if (newPassword) Alpine.store('global').webuiPassword = newPassword; + + if (!response.ok) throw new Error(`HTTP ${response.status}`); + Alpine.store('global').showToast(Alpine.store('global').t('claudeConfigRestored'), 'success'); + + // Reload the config to reflect the changes + await this.fetchConfig(); + } catch (e) { + Alpine.store('global').showToast(Alpine.store('global').t('restoreConfigFailed') + ': ' + e.message, 'error'); + } finally { + this.restoring = false; + } } }); diff --git a/public/js/store.js b/public/js/store.js index e8727ce..2cfef80 100644 --- a/public/js/store.js +++ b/public/js/store.js @@ -157,7 +157,10 @@ document.addEventListener('alpine:init', () => { accountsReloaded: "Accounts reloaded", reloadFailed: "Reload failed", claudeConfigSaved: "Claude configuration saved", + claudeConfigRestored: "Claude CLI restored to defaults", saveConfigFailed: "Failed to save configuration", + restoreConfigFailed: "Failed to restore configuration", + restoreDefault: "Restore Default", claudeActive: "Claude Active", claudeEmpty: "Claude Empty", geminiActive: "Gemini Active", @@ -406,7 +409,10 @@ document.addEventListener('alpine:init', () => { accountsReloaded: "账号配置已重载", reloadFailed: "重载失败", claudeConfigSaved: "Claude 配置已保存", + claudeConfigRestored: "Claude CLI 已恢复默认设置", saveConfigFailed: "保存配置失败", + restoreConfigFailed: "恢复配置失败", + restoreDefault: "恢复默认", claudeActive: "Claude 活跃", claudeEmpty: "Claude 耗尽", geminiActive: "Gemini 活跃", diff --git a/public/views/settings.html b/public/views/settings.html index 1d1e844..180f419 100644 --- a/public/views/settings.html +++ b/public/views/settings.html @@ -523,7 +523,16 @@ -
+
+
+ + + + + +