Skip to content

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: improve resizable panels, widen file tree, add settings page with LLM provider config

nash_sud04198ff40d7
diff --git a/src/components/layout/app-layout.tsx b/src/components/layout/app-layout.tsx
index 372e3e51..769feff7 100644
--- a/src/components/layout/app-layout.tsx
+++ b/src/components/layout/app-layout.tsx
@@ -32,7 +32,7 @@ export function AppLayout() {
<div className="flex h-screen bg-background text-foreground">
<IconSidebar />
<ResizablePanelGroup direction="horizontal" className="flex-1">
- <ResizablePanel defaultSize={20} minSize={15} maxSize={40}>
+ <ResizablePanel defaultSize={25} minSize={15} maxSize={40}>
<FileTree />
</ResizablePanel>
<ResizableHandle withHandle />
diff --git a/src/components/layout/content-area.tsx b/src/components/layout/content-area.tsx
index b0d320d6..6cb2ec34 100644
--- a/src/components/layout/content-area.tsx
+++ b/src/components/layout/content-area.tsx
@@ -8,9 +8,11 @@ import {
ResizableHandle,
} from "@/components/ui/resizable"
import { ChatBar } from "./chat-bar"
+import { SettingsView } from "@/components/settings/settings-view"
export function ContentArea() {
const selectedFile = useWikiStore((s) => s.selectedFile)
+ const activeView = useWikiStore((s) => s.activeView)
const fileContent = useWikiStore((s) => s.fileContent)
const setFileContent = useWikiStore((s) => s.setFileContent)
const chatExpanded = useWikiStore((s) => s.chatExpanded)
@@ -45,6 +47,10 @@ export function ContentArea() {
}
}, [])
+ if (activeView === "settings") {
+ return <SettingsView />
+ }
+
const isMarkdown = selectedFile?.endsWith(".md")
const editorContent = (
diff --git a/src/components/settings/settings-view.tsx b/src/components/settings/settings-view.tsx
new file mode 100644
index 00000000..b7a5212c
--- /dev/null
+++ b/src/components/settings/settings-view.tsx
@@ -0,0 +1,131 @@
+import { useWikiStore } from "@/stores/wiki-store"
+import { Button } from "@/components/ui/button"
+import { Input } from "@/components/ui/input"
+import { Label } from "@/components/ui/label"
+import { useState, useEffect } from "react"
+
+const PROVIDERS = [
+ { value: "openai" as const, label: "OpenAI", models: ["gpt-4o", "gpt-4.1", "gpt-4o-mini"] },
+ { value: "anthropic" as const, label: "Anthropic", models: ["claude-sonnet-4-5-20250514", "claude-opus-4-5-20250514", "claude-haiku-4-5-20251001"] },
+ { value: "google" as const, label: "Google", models: ["gemini-2.5-pro", "gemini-2.5-flash"] },
+ { value: "ollama" as const, label: "Ollama (Local)", models: [] },
+]
+
+export function SettingsView() {
+ const llmConfig = useWikiStore((s) => s.llmConfig)
+ const setLlmConfig = useWikiStore((s) => s.setLlmConfig)
+
+ const [provider, setProvider] = useState(llmConfig.provider)
+ const [apiKey, setApiKey] = useState(llmConfig.apiKey)
+ const [model, setModel] = useState(llmConfig.model)
+ const [ollamaUrl, setOllamaUrl] = useState(llmConfig.ollamaUrl)
+ const [saved, setSaved] = useState(false)
+
+ useEffect(() => {
+ setProvider(llmConfig.provider)
+ setApiKey(llmConfig.apiKey)
+ setModel(llmConfig.model)
+ setOllamaUrl(llmConfig.ollamaUrl)
+ }, [llmConfig])
+
+ const currentProvider = PROVIDERS.find((p) => p.value === provider)
+
+ function handleSave() {
+ setLlmConfig({ provider, apiKey, model, ollamaUrl })
+ setSaved(true)
+ setTimeout(() => setSaved(false), 2000)
+ }
+
+ return (
+ <div className="h-full overflow-auto p-8">
+ <div className="mx-auto max-w-xl">
+ <h2 className="mb-6 text-2xl font-bold">Settings</h2>
+
+ <div className="space-y-6">
+ <div className="space-y-4 rounded-lg border p-4">
+ <h3 className="font-semibold">LLM Provider</h3>
+
+ <div className="space-y-2">
+ <Label>Provider</Label>
+ <div className="flex flex-wrap gap-2">
+ {PROVIDERS.map((p) => (
+ <button
+ key={p.value}
+ onClick={() => {
+ setProvider(p.value)
+ setModel(p.models[0] || "")
+ }}
+ className={`rounded-md border px-3 py-1.5 text-sm transition-colors ${
+ provider === p.value
+ ? "border-primary bg-primary text-primary-foreground"
+ : "border-border hover:bg-accent"
+ }`}
+ >
+ {p.label}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {provider !== "ollama" && (
+ <div className="space-y-2">
+ <Label htmlFor="apiKey">API Key</Label>
+ <Input
+ id="apiKey"
+ type="password"
+ value={apiKey}
+ onChange={(e) => setApiKey(e.target.value)}
+ placeholder={`Enter your ${currentProvider?.label} API key`}
+ />
+ </div>
+ )}
+
+ {provider === "ollama" && (
+ <div className="space-y-2">
+ <Label htmlFor="ollamaUrl">Ollama URL</Label>
+ <Input
+ id="ollamaUrl"
+ value={ollamaUrl}
+ onChange={(e) => setOllamaUrl(e.target.value)}
+ placeholder="http://localhost:11434"
+ />
+ </div>
+ )}
+
+ <div className="space-y-2">
+ <Label htmlFor="model">Model</Label>
+ {currentProvider && currentProvider.models.length > 0 ? (
+ <div className="flex flex-wrap gap-2">
+ {currentProvider.models.map((m) => (
+ <button
+ key={m}
+ onClick={() => setModel(m)}
+ className={`rounded-md border px-3 py-1.5 text-sm transition-colors ${
+ model === m
+ ? "border-primary bg-primary text-primary-foreground"
+ : "border-border hover:bg-accent"
+ }`}
+ >
+ {m}
+ </button>
+ ))}
+ </div>
+ ) : (
+ <Input
+ id="model"
+ value={model}
+ onChange={(e) => setModel(e.target.value)}
+ placeholder="Enter model name (e.g., llama3)"
+ />
+ )}
+ </div>
+ </div>
+
+ <Button onClick={handleSave} className="w-full">
+ {saved ? "Saved!" : "Save Settings"}
+ </Button>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/src/components/ui/resizable.tsx b/src/components/ui/resizable.tsx
index 8b139cc7..401de3f0 100644
--- a/src/components/ui/resizable.tsx
+++ b/src/components/ui/resizable.tsx
@@ -33,13 +33,13 @@ function ResizableHandle({
<ResizablePrimitive.Separator
data-slot="resizable-handle"
className={cn(
- "relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
+ "relative flex w-1 items-center justify-center bg-border/50 ring-offset-background transition-colors hover:bg-primary/20 after:absolute after:inset-y-0 after:left-1/2 after:w-3 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-1 aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-3 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
className
)}
{...props}
>
{withHandle && (
- <div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />
+ <div className="z-10 flex h-8 w-1.5 shrink-0 rounded-full bg-border" />
)}
</ResizablePrimitive.Separator>
)
diff --git a/src/stores/wiki-store.ts b/src/stores/wiki-store.ts
index 57cb2a57..d054e347 100644
--- a/src/stores/wiki-store.ts
+++ b/src/stores/wiki-store.ts
@@ -1,6 +1,13 @@
import { create } from "zustand"
import type { WikiProject, FileNode } from "@/types/wiki"
+interface LlmConfig {
+ provider: "openai" | "anthropic" | "google" | "ollama"
+ apiKey: string
+ model: string
+ ollamaUrl: string
+}
+
interface WikiState {
project: WikiProject | null
fileTree: FileNode[]
@@ -8,6 +15,7 @@ interface WikiState {
fileContent: string
chatExpanded: boolean
activeView: "wiki" | "sources" | "search" | "graph" | "lint" | "settings"
+ llmConfig: LlmConfig
setProject: (project: WikiProject | null) => void
setFileTree: (tree: FileNode[]) => void
@@ -15,6 +23,7 @@ interface WikiState {
setFileContent: (content: string) => void
setChatExpanded: (expanded: boolean) => void
setActiveView: (view: WikiState["activeView"]) => void
+ setLlmConfig: (config: LlmConfig) => void
}
export const useWikiStore = create<WikiState>((set) => ({
@@ -24,6 +33,12 @@ export const useWikiStore = create<WikiState>((set) => ({
fileContent: "",
chatExpanded: false,
activeView: "wiki",
+ llmConfig: {
+ provider: "openai",
+ apiKey: "",
+ model: "",
+ ollamaUrl: "http://localhost:11434",
+ },
setProject: (project) => set({ project }),
setFileTree: (fileTree) => set({ fileTree }),
@@ -31,6 +46,7 @@ export const useWikiStore = create<WikiState>((set) => ({
setFileContent: (fileContent) => set({ fileContent }),
setChatExpanded: (chatExpanded) => set({ chatExpanded }),
setActiveView: (activeView) => set({ activeView }),
+ setLlmConfig: (llmConfig) => set({ llmConfig }),
}))
export type { WikiState }