LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
fix: disable keyless llm when presets are off
nash_su437197530c21
diff --git a/src/components/settings/preset-resolver.test.ts b/src/components/settings/preset-resolver.test.tsindex 2c0dd264..f8e17cb7 100644--- a/src/components/settings/preset-resolver.test.ts+++ b/src/components/settings/preset-resolver.test.ts@@ -1,6 +1,7 @@import { describe, expect, it } from "vitest"import { LLM_PRESETS } from "./llm-presets"-import { resolveConfig } from "./preset-resolver"+import { disabledLlmConfig, resolveConfig } from "./preset-resolver"+import { hasUsableLlm } from "@/lib/has-usable-llm"import type { LlmConfig } from "@/stores/wiki-store"import type { LlmPreset } from "./llm-presets"@@ -173,3 +174,32 @@ describe("resolveConfig", () => {expect(resolved.localCliIsolation).toBe(false)})})++describe("disabledLlmConfig", () => {+ it("turns a keyless previous provider into an unusable LLM config", () => {+ const cleared = disabledLlmConfig(fallbackConfig({+ provider: "claude-code",+ apiKey: "",+ model: "sonnet",+ }))++ expect(cleared.provider).toBe("openai")+ expect(cleared.apiKey).toBe("")+ expect(hasUsableLlm(cleared)).toBe(false)+ })++ it("does not erase provider-specific saved details from the fallback object shape", () => {+ const cleared = disabledLlmConfig(fallbackConfig({+ provider: "codex-cli",+ model: "gpt-5",+ maxContextSize: 123456,+ customEndpoint: "http://local.test/v1",+ }))++ expect(cleared.model).toBe("gpt-5")+ expect(cleared.maxContextSize).toBe(123456)+ expect(cleared.customEndpoint).toBe("http://local.test/v1")+ expect(cleared.provider).toBe("openai")+ expect(hasUsableLlm(cleared)).toBe(false)+ })+})diff --git a/src/components/settings/preset-resolver.ts b/src/components/settings/preset-resolver.tsindex ac894da7..252abcb4 100644--- a/src/components/settings/preset-resolver.ts+++ b/src/components/settings/preset-resolver.ts@@ -3,6 +3,22 @@ import type { ProviderOverride } from "@/stores/wiki-store"import { AZURE_OPENAI_API_VERSION } from "@/lib/azure-openai"import type { LlmPreset } from "./llm-presets"+/**+ * Build the deliberately unusable sentinel config persisted when every+ * LLM preset is disabled. A keyed provider with an empty key makes+ * hasUsableLlm() return false even if the previously active provider+ * was keyless, such as Ollama, Claude Code CLI, or Codex CLI. The+ * spread keeps saved details available for settings forms; re-enabling+ * a preset reads its real values from providerConfigs[].+ */+export function disabledLlmConfig(fallback: LlmConfig): LlmConfig {+ return {+ ...fallback,+ provider: "openai",+ apiKey: "",+ }+}+/*** Build a full LlmConfig from a preset template + the user's saved* override fields for that preset. Falls back to the preset defaultsdiff --git a/src/components/settings/sections/llm-provider-section.tsx b/src/components/settings/sections/llm-provider-section.tsxindex c04d2024..7d6b9995 100644--- a/src/components/settings/sections/llm-provider-section.tsx+++ b/src/components/settings/sections/llm-provider-section.tsx@@ -4,10 +4,10 @@ import { useTranslation } from "react-i18next"import { invoke } from "@tauri-apps/api/core"import { Input } from "@/components/ui/input"import { Label } from "@/components/ui/label"-import { useWikiStore, type LlmConfig, type ProviderOverride, type ReasoningConfig, type ReasoningMode } from "@/stores/wiki-store"+import { useWikiStore, type ProviderOverride, type ReasoningConfig, type ReasoningMode } from "@/stores/wiki-store"import { LLM_PRESETS, type LlmPreset } from "../llm-presets"import { ContextSizeSelector } from "../context-size-selector"-import { resolveConfig } from "../preset-resolver"+import { disabledLlmConfig, resolveConfig } from "../preset-resolver"import { normalizeEndpoint } from "@/lib/endpoint-normalizer"import { AZURE_OPENAI_API_VERSION } from "@/lib/azure-openai"import { testLlmConnection, testLlmFunction, type ProviderTestResult } from "@/lib/connection-tests"@@ -48,7 +48,7 @@ export function LlmProviderSection() {// the case where the previous provider was a keyless local CLI.// resolveConfig() on re-enable reads from providerConfigs[], not llmConfig,// so the cleared values here do not affect the user's saved settings.- const cleared: LlmConfig = { ...llmConfig, provider: "openai", apiKey: "" }+ const cleared = disabledLlmConfig(llmConfig)setLlmConfig(cleared)await saveLlmConfig(cleared)}