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:
Jason
2026-04-05 09:39:51 +08:00
parent 159279bf44
commit 8d38f0ee4f
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -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 () => {