mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-18 17:33:08 +08:00
refactor(proxy): simplify provider selection to use is_current directly
Changes: - Modify provider_router to select provider based on is_current flag instead of is_proxy_target queue - Remove proxy target toggle UI from ProviderCard - Remove proxyPriority and allProviders props from ProviderList - Remove isProxyTarget prop from ProviderHealthBadge - Use start_with_takeover() for auto-start to ensure proper setup This simplifies the proxy architecture by directly using the current provider for proxying, eliminating the need for separate proxy target management. Switching providers now immediately takes effect in proxy mode.
This commit is contained in:
@@ -206,14 +206,17 @@ impl ProviderService {
|
||||
id
|
||||
);
|
||||
|
||||
// Update database is_current (proxy server reads this)
|
||||
// Update database is_current
|
||||
state.db.set_current_provider(app_type.as_str(), id)?;
|
||||
|
||||
// 同时更新 is_proxy_target(代理路由器使用此字段选择供应商)
|
||||
state.db.set_proxy_target_provider(app_type.as_str(), id)?;
|
||||
|
||||
// Update local settings for consistency
|
||||
crate::settings::set_current_provider(&app_type, Some(id))?;
|
||||
|
||||
// Note: No Live config write, no MCP sync
|
||||
// The proxy server will route requests to the new provider
|
||||
// The proxy server will route requests to the new provider via is_proxy_target
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user