mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-14 22:21:31 +08:00
fix: allow provider switch without proxy, show warning instead of blocking
Remove the hard block that prevented switching to providers requiring proxy (OpenAI format, Copilot, full URL mode) when the proxy is not running. Now the switch proceeds with a warning toast. Also deduplicate the proxy hint info toast so it doesn't appear alongside the warning.
This commit is contained in:
@@ -194,7 +194,8 @@ describe("useProviderActions", () => {
|
||||
expect(settingsApiApplyMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("blocks switching providers that require proxy when proxy is not running", async () => {
|
||||
it("warns but still switches providers that require proxy when proxy is not running", async () => {
|
||||
switchProviderMutateAsync.mockResolvedValueOnce(undefined);
|
||||
const { wrapper } = createWrapper();
|
||||
const provider = createProvider({
|
||||
category: "custom",
|
||||
@@ -211,12 +212,12 @@ describe("useProviderActions", () => {
|
||||
await result.current.switchProvider(provider);
|
||||
});
|
||||
|
||||
expect(switchProviderMutateAsync).not.toHaveBeenCalled();
|
||||
expect(toastWarningMock).toHaveBeenCalledTimes(1);
|
||||
expect(settingsApiGetMock).not.toHaveBeenCalled();
|
||||
expect(switchProviderMutateAsync).toHaveBeenCalledWith(provider.id);
|
||||
});
|
||||
|
||||
it("blocks switching Codex full URL providers when proxy is not running", async () => {
|
||||
it("warns but still switches Codex full URL providers when proxy is not running", async () => {
|
||||
switchProviderMutateAsync.mockResolvedValueOnce(undefined);
|
||||
const { wrapper } = createWrapper();
|
||||
const provider = createProvider({
|
||||
category: "custom",
|
||||
@@ -233,9 +234,8 @@ describe("useProviderActions", () => {
|
||||
await result.current.switchProvider(provider);
|
||||
});
|
||||
|
||||
expect(switchProviderMutateAsync).not.toHaveBeenCalled();
|
||||
expect(toastWarningMock).toHaveBeenCalledTimes(1);
|
||||
expect(settingsApiGetMock).not.toHaveBeenCalled();
|
||||
expect(switchProviderMutateAsync).toHaveBeenCalledWith(provider.id);
|
||||
});
|
||||
|
||||
it("should sync plugin config when switching Claude provider with integration enabled", async () => {
|
||||
|
||||
Reference in New Issue
Block a user