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

release: v0.6.7

nash_suad215b51252f
diff --git a/package-lock.json b/package-lock.json
index a5a51a75..a20882f6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "llm-wiki",
- "version": "0.6.6",
+ "version": "0.6.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "llm-wiki",
- "version": "0.6.6",
+ "version": "0.6.7",
"dependencies": {
"@base-ui/react": "^1.3.0",
"@fontsource-variable/geist": "^5.2.8",
diff --git a/package.json b/package.json
index 25be587a..3a850da4 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "llm-wiki",
"private": true,
- "version": "0.6.6",
+ "version": "0.6.7",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 6ac7123b..f37f714c 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -4561,7 +4561,7 @@ checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
[[package]]
name = "llm-wiki"
-version = "0.6.6"
+version = "0.6.7"
dependencies = [
"arrow-array",
"arrow-schema",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 76fe2326..d91cbf1e 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "llm-wiki"
-version = "0.6.6"
+version = "0.6.7"
description = "LLM Wiki - A personal knowledge base for LLM concepts"
authors = []
edition = "2021"
diff --git a/src-tauri/src/agent/provider.rs b/src-tauri/src/agent/provider.rs
index 5c4e12ed..05ddf870 100644
--- a/src-tauri/src/agent/provider.rs
+++ b/src-tauri/src/agent/provider.rs
@@ -960,7 +960,7 @@ fn apply_anthropic_reasoning(body: &mut Value, config: &LlmConfig) {
let Some(budget) = reasoning_budget(reasoning) else {
return;
};
- if is_claude_47_or_later(&config.model) {
+ if is_claude_46_or_later(&config.model) {
let effort = match reasoning.mode.as_deref() {
Some("low") => "low",
Some("medium") => "medium",
@@ -1001,14 +1001,14 @@ fn apply_google_reasoning(body: &mut Value, config: &LlmConfig) {
}
}
-fn is_claude_47_or_later(model: &str) -> bool {
+fn is_claude_46_or_later(model: &str) -> bool {
let lower = model.to_ascii_lowercase();
["claude-opus-4-", "claude-sonnet-4-", "claude-haiku-4-"]
.iter()
.find_map(|prefix| lower.strip_prefix(prefix))
.and_then(|tail| tail.split(['-', '_', '.']).next())
.and_then(|version| version.parse::<u32>().ok())
- .is_some_and(|version| version >= 7)
+ .is_some_and(|version| version >= 6)
}
fn is_openai_reasoning_model(config: &LlmConfig) -> bool {
@@ -1025,7 +1025,10 @@ fn is_openai_reasoning_model(config: &LlmConfig) -> bool {
fn is_gemini_3(model: &str) -> bool {
let lower = model.to_ascii_lowercase();
- lower.starts_with("gemini-3-") || lower.starts_with("gemini_3_")
+ lower.starts_with("gemini-3-")
+ || lower.starts_with("gemini-3.")
+ || lower.starts_with("gemini_3_")
+ || lower.starts_with("gemini_3.")
}
fn is_gemini_thinking_required(model: &str) -> bool {
@@ -1267,6 +1270,39 @@ mod tests {
);
}
+ #[test]
+ fn claude_46_uses_adaptive_thinking() {
+ let mut cfg = config("anthropic");
+ cfg.model = "claude-sonnet-4-6".to_string();
+ cfg.reasoning = Some(LlmReasoningConfig {
+ mode: Some("medium".to_string()),
+ budget_tokens: None,
+ });
+ let client = LlmClient::new(cfg).unwrap();
+ let body = client.anthropic_like_body("system", "user", &[], false);
+ assert_eq!(body.get("thinking"), Some(&json!({ "type": "adaptive" })));
+ assert_eq!(
+ body.get("output_config"),
+ Some(&json!({ "effort": "medium" }))
+ );
+ }
+
+ #[test]
+ fn gemini_35_uses_thinking_level() {
+ let mut cfg = config("google");
+ cfg.model = "gemini-3.5-flash".to_string();
+ cfg.reasoning = Some(LlmReasoningConfig {
+ mode: Some("medium".to_string()),
+ budget_tokens: None,
+ });
+ let client = LlmClient::new(cfg).unwrap();
+ let body = client.google_body("system", "user", &[]);
+ assert_eq!(
+ body["generationConfig"].get("thinkingConfig"),
+ Some(&json!({ "thinkingLevel": "medium" }))
+ );
+ }
+
#[test]
fn gemini_25_pro_does_not_receive_unsupported_zero_thinking_budget() {
let mut cfg = config("google");
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 232da948..1636b2c7 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "LLM Wiki",
- "version": "0.6.6",
+ "version": "0.6.7",
"identifier": "com.llmwiki.app",
"build": {
"beforeDevCommand": "npm run dev",
diff --git a/src/lib/parsed-source-output.test.ts b/src/lib/parsed-source-output.test.ts
index 1ab56d47..c042ccf1 100644
--- a/src/lib/parsed-source-output.test.ts
+++ b/src/lib/parsed-source-output.test.ts
@@ -2,12 +2,19 @@ import { beforeEach, describe, expect, it, vi } from "vitest"
const mocks = vi.hoisted(() => ({
createDirectory: vi.fn(),
+ deleteFile: vi.fn(),
+ readFile: vi.fn(),
writeFileAtomic: vi.fn(),
}))
vi.mock("@/commands/fs", () => mocks)
-import { parsedMarkdownOutputPath, persistParsedMarkdown } from "./parsed-source-output"
+import {
+ moveParsedMarkdown,
+ parsedMarkdownOutputPath,
+ persistParsedMarkdown,
+ removeParsedMarkdown,
+} from "./parsed-source-output"
describe("parsed source output", () => {
beforeEach(() => vi.clearAllMocks())
@@ -19,6 +26,8 @@ describe("parsed source output", () => {
expect(
parsedMarkdownOutputPath("C:\\Project", "c:\\project\\raw\\sources\\A.DOCX"),
).toBe("C:/Project/raw/parsed/A.DOCX.md")
+ expect(parsedMarkdownOutputPath("/project", "raw/sources/a.pdf"))
+ .toBe("/project/raw/parsed/a.pdf.md")
})
it("rejects sources outside the project and formats that are already text", () => {
@@ -41,4 +50,26 @@ describe("parsed source output", () => {
"# Parsed",
)
})
+
+ it("removes and moves generated copies with their source lifecycle", async () => {
+ mocks.readFile.mockResolvedValue("# Parsed")
+
+ await removeParsedMarkdown("/project", "/project/raw/sources/old/report.pdf")
+ expect(mocks.deleteFile).toHaveBeenCalledWith(
+ "/project/raw/parsed/old/report.pdf.md",
+ )
+
+ mocks.deleteFile.mockClear()
+ await moveParsedMarkdown(
+ "/project",
+ "/project/raw/sources/old/report.pdf",
+ "/project/raw/sources/new/report.pdf",
+ )
+ expect(mocks.readFile).toHaveBeenCalledWith("/project/raw/parsed/old/report.pdf.md")
+ expect(mocks.writeFileAtomic).toHaveBeenCalledWith(
+ "/project/raw/parsed/new/report.pdf.md",
+ "# Parsed",
+ )
+ expect(mocks.deleteFile).toHaveBeenCalledWith("/project/raw/parsed/old/report.pdf.md")
+ })
})
diff --git a/src/lib/parsed-source-output.ts b/src/lib/parsed-source-output.ts
index 80cc0c71..27c4e2cd 100644
--- a/src/lib/parsed-source-output.ts
+++ b/src/lib/parsed-source-output.ts
@@ -1,4 +1,4 @@
-import { createDirectory, writeFileAtomic } from "@/commands/fs"
+import { createDirectory, deleteFile, readFile, writeFileAtomic } from "@/commands/fs"
import { getFileName, getRelativePath, isAbsolutePath, normalizePath } from "@/lib/path-utils"
const PARSED_MARKDOWN_EXTENSIONS = new Set([
@@ -30,8 +30,10 @@ export function parsedMarkdownOutputPath(
const project = normalizePath(projectPath).replace(/\/+$/, "")
const source = normalizePath(sourcePath)
const sourceRoot = `${project}/raw/sources`
- const relative = getRelativePath(source, sourceRoot)
- if (!relative || relative === source || isAbsolutePath(relative)) return null
+ const relative = source.toLowerCase().startsWith("raw/sources/")
+ ? source.slice("raw/sources/".length)
+ : getRelativePath(source, sourceRoot)
+ if (!relative || (relative === source && !source.toLowerCase().startsWith("raw/sources/")) || isAbsolutePath(relative)) return null
if (relative.split("/").some((part) => !part || part === "." || part === "..")) return null
const fileName = getFileName(relative)
@@ -54,3 +56,42 @@ export async function persistParsedMarkdown(
await writeFileAtomic(outputPath, markdown)
return outputPath
}
+
+/** Remove the generated parsed copy for a source. Missing copies are ignored. */
+export async function removeParsedMarkdown(
+ projectPath: string,
+ sourcePath: string,
+): Promise<void> {
+ const outputPath = parsedMarkdownOutputPath(projectPath, sourcePath)
+ if (!outputPath) return
+ try {
+ await deleteFile(outputPath)
+ } catch {
+ // The option may have been disabled when this source was ingested.
+ }
+}
+
+/** Move a generated parsed copy alongside an unchanged source rename. */
+export async function moveParsedMarkdown(
+ projectPath: string,
+ oldSourcePath: string,
+ newSourcePath: string,
+): Promise<void> {
+ const oldOutputPath = parsedMarkdownOutputPath(projectPath, oldSourcePath)
+ const newOutputPath = parsedMarkdownOutputPath(projectPath, newSourcePath)
+ if (!oldOutputPath || !newOutputPath || oldOutputPath === newOutputPath) return
+ let markdown: string
+ try {
+ markdown = await readFile(oldOutputPath)
+ } catch {
+ return
+ }
+ await createDirectory(newOutputPath.slice(0, newOutputPath.lastIndexOf("/")))
+ await writeFileAtomic(newOutputPath, markdown)
+ try {
+ await deleteFile(oldOutputPath)
+ } catch {
+ // The destination is already durable; a stale duplicate is preferable to
+ // failing the authoritative source-path migration.
+ }
+}
diff --git a/src/lib/reasoning-capabilities.test.ts b/src/lib/reasoning-capabilities.test.ts
index 793a1371..52c9a732 100644
--- a/src/lib/reasoning-capabilities.test.ts
+++ b/src/lib/reasoning-capabilities.test.ts
@@ -25,6 +25,8 @@ describe("reasoning capabilities", () => {
.not.toContain("off")
expect(resolveReasoningCapabilities(config("anthropic", "claude-opus-4-7")).modes)
.not.toContain("off")
+ expect(resolveReasoningCapabilities(config("anthropic", "claude-sonnet-4-6")).modes)
+ .not.toContain("custom")
})
it("limits OpenAI reasoning models to representable effort levels", () => {
diff --git a/src/lib/reasoning-capabilities.ts b/src/lib/reasoning-capabilities.ts
index a048fead..3a6c4a2e 100644
--- a/src/lib/reasoning-capabilities.ts
+++ b/src/lib/reasoning-capabilities.ts
@@ -36,8 +36,8 @@ function capabilities(
}
}
-function isClaude47OrLater(model: string): boolean {
- return /claude-(?:opus|sonnet|haiku)-4[-_.]?(?:[7-9]|\d{2,})(?:[-_.]|$)/i.test(model)
+function isClaude46OrLater(model: string): boolean {
+ return /claude-(?:opus|sonnet|haiku)-4[-_.]?(?:[6-9]|\d{2,})(?:[-_.]|$)/i.test(model)
}
function isGemini25Pro(model: string): boolean {
@@ -74,7 +74,7 @@ export function resolveReasoningCapabilities(config: LlmConfig): ReasoningCapabi
}
if (config.provider === "anthropic") {
return capabilities(
- isClaude47OrLater(config.model) ? THINKING_REQUIRED_LEVELS : BUDGET_LEVELS,
+ isClaude46OrLater(config.model) ? THINKING_REQUIRED_LEVELS : BUDGET_LEVELS,
{ min: 1024, max: 32_768 },
)
}
@@ -107,7 +107,7 @@ export function normalizeReasoningForProvider(
}
export function isAdaptiveAnthropicModel(config: LlmConfig): boolean {
- return config.provider === "anthropic" && isClaude47OrLater(config.model)
+ return config.provider === "anthropic" && isClaude46OrLater(config.model)
}
export function isGeminiThinkingLevelModel(config: LlmConfig): boolean {
diff --git a/src/lib/source-lifecycle.test.ts b/src/lib/source-lifecycle.test.ts
index 2b2773da..92abce4a 100644
--- a/src/lib/source-lifecycle.test.ts
+++ b/src/lib/source-lifecycle.test.ts
@@ -306,6 +306,25 @@ describe("source-lifecycle path helpers", () => {
])
})
+ it("does not preprocess files when no usable ingest model is configured", async () => {
+ const queued = await enqueueSourceIngest(
+ { id: "p1", name: "Project", path: "/project" },
+ ["/project/raw/sources/report.pdf"],
+ {
+ provider: "openai",
+ apiKey: "",
+ model: "gpt-5",
+ ollamaUrl: "",
+ customEndpoint: "",
+ maxContextSize: 128_000,
+ },
+ )
+
+ expect(queued).toEqual([])
+ expect(mocks.preprocessFile).not.toHaveBeenCalled()
+ expect(mocks.enqueueBatch).not.toHaveBeenCalled()
+ })
+
it("naturally orders imported folder files before enqueueing ingest tasks", async () => {
mocks.listDirectory.mockResolvedValue([
{ name: "10.md", path: "/external/imported/10.md", is_dir: false },
diff --git a/src/lib/source-lifecycle.ts b/src/lib/source-lifecycle.ts
index d189874b..81106eb5 100644
--- a/src/lib/source-lifecycle.ts
+++ b/src/lib/source-lifecycle.ts
@@ -40,6 +40,7 @@ import { naturalCompare } from "@/lib/natural-sort"
import type { SourceWatchConfig } from "@/stores/wiki-store"
import { useWikiStore } from "@/stores/wiki-store"
import { preprocessSourceFiles } from "@/lib/source-preprocess"
+import { moveParsedMarkdown, removeParsedMarkdown } from "@/lib/parsed-source-output"
export const INGESTABLE_SOURCE_EXTENSIONS = new Set([
"md",
@@ -194,6 +195,11 @@ export async function migrateSourcePath(
summaryMoves.set(oldSummaryRel, newSummaryRel)
}
await moveIngestCacheEntry(pp, oldIdentity, newIdentity, summaryMoves)
+ try {
+ await moveParsedMarkdown(pp, oldSourcePath, newSourcePath)
+ } catch (err) {
+ console.warn("[source-lifecycle] failed to move optional parsed Markdown:", err)
+ }
return writes.length
} catch (err) {
if (newSummaryCreated) {
@@ -243,6 +249,11 @@ export async function enqueueSourceIngest(
llmConfig: LlmConfig,
options: { sourceRoot?: string; rootContext?: string; parsingConcurrency?: number } = {},
): Promise<string[]> {
+ // Extraction can be expensive (OCR and Office parsers in particular).
+ // Do not parse a batch that cannot proceed to ingest because no usable
+ // model is configured. Imported source files remain on disk and can be
+ // queued after the user configures a provider.
+ if (!hasUsableLlm(getTaskLlmConfig("ingest", llmConfig))) return []
const files = sourcePaths
.filter((sourcePath) =>
isIngestableSourcePath(sourcePath) &&
@@ -259,7 +270,6 @@ export async function enqueueSourceIngest(
const parsingConcurrency = options.parsingConcurrency
?? normalizeSourceWatchConfig(useWikiStore.getState().sourceWatchConfig).parsingConcurrency
await preprocessSourceFiles(files.map((file) => file.sourcePath), parsingConcurrency)
- if (!hasUsableLlm(getTaskLlmConfig("ingest", llmConfig))) return []
return enqueueBatch(project.id, files)
}
@@ -415,6 +425,7 @@ export async function deleteSourceFiles(
}
for (const info of sourceInfos) {
+ await removeParsedMarkdown(pp, info.source)
try {
await deleteFile(`${pp}/raw/sources/.cache/${info.fileName}.txt`)
} catch {