Add Restore Default Claude CLI button to settings page

Co-authored-by: simon-ami <102378134+simon-ami@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-11 11:54:13 +00:00
parent 66c80452e3
commit 8eba68e47a
5 changed files with 104 additions and 2 deletions

View File

@@ -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;
}
}
});