mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-31 19:22:15 +08:00
fix(opencode): fix add/remove provider flow and toast messages
- Create separate removeFromLiveConfig API for additive mode apps (remove only removes from live config, not database) - Fix useSwitchProviderMutation to invalidate opencodeLiveProviderIds cache so button state updates correctly after add operation - Show appropriate toast messages: - Add: "已添加到配置" / "Added to config" - Remove: "已从配置移除" / "Removed from config" - Add i18n texts for addToConfigSuccess and removeFromConfigSuccess
This commit is contained in:
@@ -38,6 +38,14 @@ export const providersApi = {
|
||||
return await invoke("delete_provider", { id, app: appId });
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove provider from live config only (for additive mode apps like OpenCode)
|
||||
* Does NOT delete from database - provider remains in the list
|
||||
*/
|
||||
async removeFromLiveConfig(id: string, appId: AppId): Promise<boolean> {
|
||||
return await invoke("remove_provider_from_live_config", { id, app: appId });
|
||||
},
|
||||
|
||||
async switch(id: string, appId: AppId): Promise<boolean> {
|
||||
return await invoke("switch_provider", { id, app: appId });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user