优化首次启动体验:自动创建默认供应商且设为选中状态

- 新增 importCurrentConfigAsDefault 函数,创建 ID 为 'default' 的特殊供应商
- 默认供应商不生成独立配置文件,直接使用现有 settings.json
- 首次启动时自动导入现有配置为默认供应商,并设为选中状态
- 切换到默认供应商时无需文件操作,直接使用原配置
- 删除默认供应商时保护原配置文件不被误删
- 简化 ImportConfigModal 组件,移除 isEmpty 相关逻辑
- 提升用户体验:无需手动操作,开箱即用
This commit is contained in:
farion1231
2025-08-07 21:28:45 +08:00
parent bbb1868899
commit 0cfd65cb90
5 changed files with 108 additions and 29 deletions

View File

@@ -9,6 +9,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
updateProvider: (provider: Provider) => ipcRenderer.invoke('updateProvider', provider),
switchProvider: (providerId: string) => ipcRenderer.invoke('switchProvider', providerId),
importCurrentConfig: (name: string) => ipcRenderer.invoke('importCurrentConfig', name),
importCurrentConfigAsDefault: () => ipcRenderer.invoke('importCurrentConfigAsDefault'),
getClaudeCodeConfigPath: () => ipcRenderer.invoke('getClaudeCodeConfigPath'),
selectConfigFile: () => ipcRenderer.invoke('selectConfigFile'),
openExternal: (url: string) => ipcRenderer.invoke('openExternal', url)