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: rewrite resizable panels for react-resizable-panels v4, add custom LLM provider

nash_sub2087e949c7e
diff --git a/src/components/settings/settings-view.tsx b/src/components/settings/settings-view.tsx
index b7a5212c..a45a9326 100644
--- a/src/components/settings/settings-view.tsx
+++ b/src/components/settings/settings-view.tsx
@@ -9,6 +9,7 @@ const PROVIDERS = [
{ 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: [] },
+ { value: "custom" as const, label: "Custom", models: [] },
]
export function SettingsView() {
@@ -19,6 +20,7 @@ export function SettingsView() {
const [apiKey, setApiKey] = useState(llmConfig.apiKey)
const [model, setModel] = useState(llmConfig.model)
const [ollamaUrl, setOllamaUrl] = useState(llmConfig.ollamaUrl)
+ const [customEndpoint, setCustomEndpoint] = useState(llmConfig.customEndpoint)
const [saved, setSaved] = useState(false)
useEffect(() => {
@@ -26,12 +28,13 @@ export function SettingsView() {
setApiKey(llmConfig.apiKey)
setModel(llmConfig.model)
setOllamaUrl(llmConfig.ollamaUrl)
+ setCustomEndpoint(llmConfig.customEndpoint)
}, [llmConfig])
const currentProvider = PROVIDERS.find((p) => p.value === provider)
function handleSave() {
- setLlmConfig({ provider, apiKey, model, ollamaUrl })
+ setLlmConfig({ provider, apiKey, model, ollamaUrl, customEndpoint })
setSaved(true)
setTimeout(() => setSaved(false), 2000)
}
@@ -67,16 +70,18 @@ export function SettingsView() {
</div>
</div>
- {provider !== "ollama" && (
+ {provider === "custom" && (
<div className="space-y-2">
- <Label htmlFor="apiKey">API Key</Label>
+ <Label htmlFor="customEndpoint">API Endpoint (OpenAI-compatible)</Label>
<Input
- id="apiKey"
- type="password"
- value={apiKey}
- onChange={(e) => setApiKey(e.target.value)}
- placeholder={`Enter your ${currentProvider?.label} API key`}
+ id="customEndpoint"
+ value={customEndpoint}
+ onChange={(e) => setCustomEndpoint(e.target.value)}
+ placeholder="https://your-api.example.com/v1"
/>
+ <p className="text-xs text-muted-foreground">
+ Any OpenAI-compatible API endpoint (e.g., LiteLLM, vLLM, LocalAI, Azure OpenAI)
+ </p>
</div>
)}
@@ -92,30 +97,58 @@ export function SettingsView() {
</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={
+ provider === "custom"
+ ? "Enter API key (if required)"
+ : `Enter your ${currentProvider?.label} API key`
+ }
+ />
+ </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 className="space-y-2">
+ <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
+ value={model}
+ onChange={(e) => setModel(e.target.value)}
+ placeholder="Or type a custom model name"
+ />
</div>
) : (
<Input
id="model"
value={model}
onChange={(e) => setModel(e.target.value)}
- placeholder="Enter model name (e.g., llama3)"
+ placeholder={
+ provider === "ollama"
+ ? "Enter model name (e.g., llama3)"
+ : "Enter model name"
+ }
/>
)}
</div>
diff --git a/src/components/ui/resizable.tsx b/src/components/ui/resizable.tsx
index 401de3f0..1d681346 100644
--- a/src/components/ui/resizable.tsx
+++ b/src/components/ui/resizable.tsx
@@ -1,16 +1,25 @@
-import * as ResizablePrimitive from "react-resizable-panels"
+import {
+ Group,
+ Panel,
+ Separator,
+ type GroupProps,
+ type PanelProps,
+ type SeparatorProps,
+} from "react-resizable-panels"
import { cn } from "@/lib/utils"
function ResizablePanelGroup({
className,
+ direction,
...props
-}: ResizablePrimitive.GroupProps) {
+}: GroupProps & { direction?: "horizontal" | "vertical" }) {
return (
- <ResizablePrimitive.Group
+ <Group
data-slot="resizable-panel-group"
+ orientation={direction ?? "horizontal"}
className={cn(
- "flex h-full w-full aria-[orientation=vertical]:flex-col",
+ "flex h-full w-full data-[orientation=vertical]:flex-col",
className
)}
{...props}
@@ -18,30 +27,30 @@ function ResizablePanelGroup({
)
}
-function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
- return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
+function ResizablePanel({ ...props }: PanelProps) {
+ return <Panel data-slot="resizable-panel" {...props} />
}
function ResizableHandle({
withHandle,
className,
...props
-}: ResizablePrimitive.SeparatorProps & {
+}: SeparatorProps & {
withHandle?: boolean
}) {
return (
- <ResizablePrimitive.Separator
+ <Separator
data-slot="resizable-handle"
className={cn(
- "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",
+ "relative flex w-1.5 cursor-col-resize items-center justify-center bg-border/40 transition-colors hover:bg-primary/20 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=horizontal]:cursor-row-resize",
className
)}
{...props}
>
{withHandle && (
- <div className="z-10 flex h-8 w-1.5 shrink-0 rounded-full bg-border" />
+ <div className="z-10 flex h-8 w-1.5 shrink-0 rounded-full bg-border data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-8" />
)}
- </ResizablePrimitive.Separator>
+ </Separator>
)
}
diff --git a/src/stores/wiki-store.ts b/src/stores/wiki-store.ts
index d054e347..d17e4cff 100644
--- a/src/stores/wiki-store.ts
+++ b/src/stores/wiki-store.ts
@@ -2,10 +2,11 @@ import { create } from "zustand"
import type { WikiProject, FileNode } from "@/types/wiki"
interface LlmConfig {
- provider: "openai" | "anthropic" | "google" | "ollama"
+ provider: "openai" | "anthropic" | "google" | "ollama" | "custom"
apiKey: string
model: string
ollamaUrl: string
+ customEndpoint: string
}
interface WikiState {
@@ -38,6 +39,7 @@ export const useWikiStore = create<WikiState>((set) => ({
apiKey: "",
model: "",
ollamaUrl: "http://localhost:11434",
+ customEndpoint: "",
},
setProject: (project) => set({ project }),