Skip to content

Commit ef6b1f9

Browse files
committed
fix(bailian): add missing workspaceId tests, fix supportsPromptCache fallback (#420)(#421)
- src/api/providers/__tests__/bailian.spec.ts — add negative tests for Frankfurt and Hong Kong region construction without workspaceId - webview-ui/src/components/settings/providers/Bailian.tsx — align supportsPromptCache checkbox fallback with supportsImages pattern (fall back to defaultInfo.supportsPromptCache)
1 parent 32b64ba commit ef6b1f9

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/api/providers/__tests__/bailian.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,16 @@ describe("BailianHandler", () => {
248248
})
249249

250250
})
251+
it("should throw when Frankfurt region is used without workspaceId", () => {
252+
expect(
253+
() => new BailianHandler({ bailianApiKey: "test-key", bailianRegion: "frankfurt" }),
254+
).toThrow()
255+
})
256+
257+
it("should throw when Hong Kong region is used without workspaceId", () => {
258+
expect(
259+
() => new BailianHandler({ bailianApiKey: "test-key", bailianRegion: "hongkong" }),
260+
).toThrow()
261+
})
262+
263+

webview-ui/src/components/settings/providers/Bailian.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export const Bailian = ({
233233
<div>
234234
<div className="flex items-center gap-1">
235235
<Checkbox
236-
checked={customInfo?.supportsPromptCache ?? false}
236+
checked={customInfo?.supportsPromptCache ?? defaultInfo.supportsPromptCache ?? false}
237237
onChange={handleInputChange("bailianCustomModelInfo", (checked) => {
238238
return {
239239
...(customInfo || makeBase()),

0 commit comments

Comments
 (0)