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: use native folder picker and fix project creation path
nash_su82023aff65cb
diff --git a/package-lock.json b/package-lock.jsonindex 5f3e035b..afdc99e2 100644--- a/package-lock.json+++ b/package-lock.json@@ -15,6 +15,7 @@"@milkdown/theme-nord": "^7.20.0","@tailwindcss/vite": "^4.2.2","@tauri-apps/api": "^2.10.1",+ "@tauri-apps/plugin-dialog": "^2.7.0","class-variance-authority": "^0.7.1","clsx": "^2.1.1","lucide-react": "^1.7.0",@@ -2778,6 +2779,15 @@"node": ">= 10"}},+ "node_modules/@tauri-apps/plugin-dialog": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-dialog/-/plugin-dialog-2.7.0.tgz",+ "integrity": "sha512-4nS/hfGMGCXiAS3LtVjH9AgsSAPJeG/7R+q8agTFqytjnMa4Zq95Bq8WzVDkckpanX+yyRHXnRtrKXkANKDHvw==",+ "license": "MIT OR Apache-2.0",+ "dependencies": {+ "@tauri-apps/api": "^2.10.1"+ }+ },"node_modules/@ts-morph/common": {"version": "0.27.0","resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.27.0.tgz",diff --git a/package.json b/package.jsonindex 350e62ef..3e0ef589 100644--- a/package.json+++ b/package.json@@ -17,6 +17,7 @@"@milkdown/theme-nord": "^7.20.0","@tailwindcss/vite": "^4.2.2","@tauri-apps/api": "^2.10.1",+ "@tauri-apps/plugin-dialog": "^2.7.0","class-variance-authority": "^0.7.1","clsx": "^2.1.1","lucide-react": "^1.7.0",diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex f9cc4b3a..80f600aa 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -2000,6 +2000,7 @@ dependencies = ["serde_json","tauri","tauri-build",+ "tauri-plugin-dialog","tauri-plugin-opener",]@@ -2278,6 +2279,7 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"dependencies = ["bitflags 2.11.0","block2",+ "libc","objc2","objc2-core-foundation",]@@ -3009,6 +3011,30 @@ dependencies = ["web-sys",]+[[package]]+name = "rfd"+version = "0.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672"+dependencies = [+ "block2",+ "dispatch2",+ "glib-sys",+ "gobject-sys",+ "gtk-sys",+ "js-sys",+ "log",+ "objc2",+ "objc2-app-kit",+ "objc2-core-foundation",+ "objc2-foundation",+ "raw-window-handle",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+ "windows-sys 0.60.2",+]+[[package]]name = "rustc-hash"version = "2.1.2"@@ -3751,6 +3777,48 @@ dependencies = ["walkdir",]+[[package]]+name = "tauri-plugin-dialog"+version = "2.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1fa4150c95ae391946cc8b8f905ab14797427caba3a8a2f79628e956da91809"+dependencies = [+ "log",+ "raw-window-handle",+ "rfd",+ "serde",+ "serde_json",+ "tauri",+ "tauri-plugin",+ "tauri-plugin-fs",+ "thiserror 2.0.18",+ "url",+]++[[package]]+name = "tauri-plugin-fs"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "36e1ec28b79f3d0683f4507e1615c36292c0ea6716668770d4396b9b39871ed8"+dependencies = [+ "anyhow",+ "dunce",+ "glob",+ "log",+ "objc2-foundation",+ "percent-encoding",+ "schemars 0.8.22",+ "serde",+ "serde_json",+ "serde_repr",+ "tauri",+ "tauri-plugin",+ "tauri-utils",+ "thiserror 2.0.18",+ "toml 0.9.12+spec-1.1.0",+ "url",+]+[[package]]name = "tauri-plugin-opener"version = "2.5.3"diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 0f6b22af..6203a927 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -24,6 +24,7 @@ tauri-plugin-opener = "2"serde = { version = "1", features = ["derive"] }serde_json = "1"chrono = { version = "0.4", features = ["clock"] }+tauri-plugin-dialog = "2.7.0"[profile.release]codegen-units = 1diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.jsonindex 4cdbf49a..778bfb5a 100644--- a/src-tauri/capabilities/default.json+++ b/src-tauri/capabilities/default.json@@ -5,6 +5,7 @@"windows": ["main"],"permissions": ["core:default",- "opener:default"+ "opener:default",+ "dialog:default"]}diff --git a/src-tauri/src/commands/project.rs b/src-tauri/src/commands/project.rsindex 289b7912..46c20c3e 100644--- a/src-tauri/src/commands/project.rs+++ b/src-tauri/src/commands/project.rs@@ -7,7 +7,11 @@ use crate::types::wiki::WikiProject;#[tauri::command]pub fn create_project(name: String, path: String) -> Result<WikiProject, String> {- let root = Path::new(&path);+ let root = Path::new(&path).join(&name);++ if root.exists() {+ return Err(format!("Directory already exists: '{}'", root.display()));+ }// Create all required subdirectorieslet dirs = [@@ -182,7 +186,10 @@ related: []"#;write_file_inner(root.join("wiki/overview.md"), overview_content)?;- Ok(WikiProject { name, path })+ Ok(WikiProject {+ name,+ path: root.to_string_lossy().to_string(),+ })}#[tauri::command]diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 3911bf55..60f0f30a 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -5,6 +5,7 @@ mod types;pub fn run() {tauri::Builder::default().plugin(tauri_plugin_opener::init())+ .plugin(tauri_plugin_dialog::init()).invoke_handler(tauri::generate_handler![commands::fs::read_file,commands::fs::write_file,diff --git a/src/App.tsx b/src/App.tsxindex acd0c494..b8d6f78c 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -1,4 +1,5 @@import { useState } from "react"+import { open } from "@tauri-apps/plugin-dialog"import { useWikiStore } from "@/stores/wiki-store"import { listDirectory, openProject } from "@/commands/fs"import { AppLayout } from "@/components/layout/app-layout"@@ -23,10 +24,14 @@ function App() {}async function handleOpenProject() {- const path = window.prompt("Enter the path to an existing wiki project:")- if (!path) return+ const selected = await open({+ directory: true,+ multiple: false,+ title: "Open Wiki Project",+ })+ if (!selected) returntry {- const proj = await openProject(path)+ const proj = await openProject(selected)await handleProjectOpened(proj)} catch (err) {window.alert(`Failed to open project: ${err}`)diff --git a/src/components/project/create-project-dialog.tsx b/src/components/project/create-project-dialog.tsxindex 259e4066..f12e9b1f 100644--- a/src/components/project/create-project-dialog.tsx+++ b/src/components/project/create-project-dialog.tsx@@ -1,10 +1,12 @@import { useState } from "react"+import { open } from "@tauri-apps/plugin-dialog"import {Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter,} from "@/components/ui/dialog"import { Button } from "@/components/ui/button"import { Input } from "@/components/ui/input"import { Label } from "@/components/ui/label"+import { FolderOpen } from "lucide-react"import { createProject } from "@/commands/fs"import type { WikiProject } from "@/types/wiki"@@ -14,12 +16,23 @@ interface CreateProjectDialogProps {onCreated: (project: WikiProject) => void}-export function CreateProjectDialog({ open, onOpenChange, onCreated }: CreateProjectDialogProps) {+export function CreateProjectDialog({ open: isOpen, onOpenChange, onCreated }: CreateProjectDialogProps) {const [name, setName] = useState("")const [path, setPath] = useState("")const [error, setError] = useState("")const [creating, setCreating] = useState(false)+ async function handleBrowse() {+ const selected = await open({+ directory: true,+ multiple: false,+ title: "Select Parent Directory",+ })+ if (selected) {+ setPath(selected)+ }+ }+async function handleCreate() {if (!name.trim() || !path.trim()) {setError("Name and path are required")@@ -41,7 +54,7 @@ export function CreateProjectDialog({ open, onOpenChange, onCreated }: CreatePro}return (- <Dialog open={open} onOpenChange={onOpenChange}>+ <Dialog open={isOpen} onOpenChange={onOpenChange}><DialogContent><DialogHeader><DialogTitle>Create New Wiki Project</DialogTitle>@@ -53,7 +66,12 @@ export function CreateProjectDialog({ open, onOpenChange, onCreated }: CreatePro</div><div className="flex flex-col gap-2"><Label htmlFor="path">Parent Directory</Label>- <Input id="path" value={path} onChange={(e) => setPath(e.target.value)} placeholder="/Users/you/projects" />+ <div className="flex gap-2">+ <Input id="path" value={path} onChange={(e) => setPath(e.target.value)} placeholder="/Users/you/projects" className="flex-1" />+ <Button variant="outline" size="icon" onClick={handleBrowse} type="button">+ <FolderOpen className="h-4 w-4" />+ </Button>+ </div></div>{error && <p className="text-sm text-destructive">{error}</p>}</div>