refactor(provider): simplify live_config_managed and deduplicate tolerant live config checks

- Change live_config_managed from Option<bool> to bool with #[serde(default)]
- Extract repeated tolerant live config query into check_live_config_exists helper
- Fix duplicate key generation to also check live-only provider IDs
- Fix updateProvider test to match new { provider, originalId } call signature
- Add streaming_responses test type annotation for compiler inference
This commit is contained in:
YoVinchen
2026-03-30 16:23:50 +08:00
parent dbb943852d
commit 98c8255dbb
8 changed files with 261 additions and 12 deletions
+4 -2
View File
@@ -5,6 +5,7 @@ import { describe, it, expect, beforeEach, vi } from "vitest";
import {
resetProviderState,
setCurrentProviderId,
setLiveProviderIds,
setProviders,
} from "../msw/state";
import { emitTauriEvent } from "../msw/tauriMocks";
@@ -239,7 +240,7 @@ describe("App integration with MSW", () => {
});
});
it("duplicates openclaw providers with a generated provider key", async () => {
it("duplicates openclaw providers with a generated key that avoids live-only ids", async () => {
setProviders("openclaw", {
deepseek: {
id: "deepseek",
@@ -256,6 +257,7 @@ describe("App integration with MSW", () => {
},
});
setCurrentProviderId("openclaw", "deepseek");
setLiveProviderIds("openclaw", ["deepseek-copy"]);
const { default: App } = await import("@/App");
renderApp(App);
@@ -272,7 +274,7 @@ describe("App integration with MSW", () => {
await waitFor(() => {
const providerList = screen.getByTestId("provider-list").textContent;
expect(providerList).toContain("deepseek-copy");
expect(providerList).toContain("deepseek-copy-2");
expect(providerList).toContain("DeepSeek copy");
});