|
@@ -19,6 +19,10 @@ describe("hasUsableLlm", () => {
|
|
|
expect(hasUsableLlm(baseCfg, providers)).toBe(true)
|
|
expect(hasUsableLlm(baseCfg, providers)).toBe(true)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it("accepts hosted provider with default providerConfigs parameter (backward compatibility)", () => {
|
|
|
|
|
+ expect(hasUsableLlm(baseCfg)).toBe(true)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it("rejects hosted provider without apiKey", () => {
|
|
it("rejects hosted provider without apiKey", () => {
|
|
|
const providers: ProviderConfigs = {}
|
|
const providers: ProviderConfigs = {}
|
|
|
expect(hasUsableLlm({ ...baseCfg, apiKey: "" }, providers)).toBe(false)
|
|
expect(hasUsableLlm({ ...baseCfg, apiKey: "" }, providers)).toBe(false)
|
|
@@ -59,6 +63,14 @@ describe("hasUsableLlm", () => {
|
|
|
expect(hasUsableLlm(cfg, providers)).toBe(false)
|
|
expect(hasUsableLlm(cfg, providers)).toBe(false)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it("accepts codex-cli when the preset is enabled", () => {
|
|
|
|
|
+ const providers: ProviderConfigs = {
|
|
|
|
|
+ "codex-cli": { enabled: true },
|
|
|
|
|
+ }
|
|
|
|
|
+ const cfg: LlmConfig = { ...baseCfg, provider: "codex-cli", apiKey: "", model: "gpt-5" }
|
|
|
|
|
+ expect(hasUsableLlm(cfg, providers)).toBe(true)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it("accepts ollama without apiKey when enabled", () => {
|
|
it("accepts ollama without apiKey when enabled", () => {
|
|
|
const providers: ProviderConfigs = {
|
|
const providers: ProviderConfigs = {
|
|
|
"ollama-local": { enabled: true, model: "qwen2.5" },
|
|
"ollama-local": { enabled: true, model: "qwen2.5" },
|
|
@@ -73,6 +85,12 @@ describe("hasUsableLlm", () => {
|
|
|
expect(hasUsableLlm(cfg, providers)).toBe(true)
|
|
expect(hasUsableLlm(cfg, providers)).toBe(true)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it("rejects custom with apiKey but no model", () => {
|
|
|
|
|
+ const providers: ProviderConfigs = {}
|
|
|
|
|
+ const cfg: LlmConfig = { ...baseCfg, provider: "custom", apiKey: "sk-test", model: "", customEndpoint: "https://example.com/v1" }
|
|
|
|
|
+ expect(hasUsableLlm(cfg, providers)).toBe(false)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it("rejects custom without apiKey when no custom-xxx preset is enabled", () => {
|
|
it("rejects custom without apiKey when no custom-xxx preset is enabled", () => {
|
|
|
const providers: ProviderConfigs = {}
|
|
const providers: ProviderConfigs = {}
|
|
|
const cfg: LlmConfig = { ...baseCfg, provider: "custom", apiKey: "", model: "qwen-plus", customEndpoint: "http://localhost:1234/v1" }
|
|
const cfg: LlmConfig = { ...baseCfg, provider: "custom", apiKey: "", model: "qwen-plus", customEndpoint: "http://localhost:1234/v1" }
|