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

feat: add content area and collapsible chat bar

nash_su896611171b4e
diff --git a/src/components/layout/chat-bar.tsx b/src/components/layout/chat-bar.tsx
new file mode 100644
index 00000000..94280b3f
--- /dev/null
+++ b/src/components/layout/chat-bar.tsx
@@ -0,0 +1,50 @@
+import { MessageSquare, ChevronUp, ChevronDown } from "lucide-react"
+import { useWikiStore } from "@/stores/wiki-store"
+
+export function ChatBar() {
+ const chatExpanded = useWikiStore((s) => s.chatExpanded)
+ const setChatExpanded = useWikiStore((s) => s.setChatExpanded)
+
+ if (!chatExpanded) {
+ return (
+ <button
+ onClick={() => setChatExpanded(true)}
+ className="flex w-full items-center justify-between border-t px-4 py-2 text-sm text-muted-foreground hover:bg-accent/50"
+ >
+ <span className="flex items-center gap-2">
+ <MessageSquare className="h-4 w-4" />
+ CHAT
+ </span>
+ <ChevronUp className="h-4 w-4" />
+ </button>
+ )
+ }
+
+ return (
+ <div className="flex h-full flex-col">
+ <button
+ onClick={() => setChatExpanded(false)}
+ className="flex w-full items-center justify-between border-b px-4 py-2 text-sm text-muted-foreground hover:bg-accent/50"
+ >
+ <span className="flex items-center gap-2">
+ <MessageSquare className="h-4 w-4" />
+ CHAT
+ </span>
+ <ChevronDown className="h-4 w-4" />
+ </button>
+ <div className="flex-1 overflow-auto p-4">
+ <p className="text-sm text-muted-foreground">
+ Chat will be available in Phase 2 (LLM Integration).
+ </p>
+ </div>
+ <div className="border-t p-3">
+ <input
+ type="text"
+ placeholder="Type a message..."
+ disabled
+ className="w-full rounded-md border bg-muted/50 px-3 py-2 text-sm"
+ />
+ </div>
+ </div>
+ )
+}
diff --git a/src/components/layout/content-area.tsx b/src/components/layout/content-area.tsx
new file mode 100644
index 00000000..0ebe0ca3
--- /dev/null
+++ b/src/components/layout/content-area.tsx
@@ -0,0 +1,42 @@
+import { useEffect } from "react"
+import { useWikiStore } from "@/stores/wiki-store"
+import { readFile } from "@/commands/fs"
+import { ChatBar } from "./chat-bar"
+
+export function ContentArea() {
+ const selectedFile = useWikiStore((s) => s.selectedFile)
+ const fileContent = useWikiStore((s) => s.fileContent)
+ const setFileContent = useWikiStore((s) => s.setFileContent)
+
+ useEffect(() => {
+ if (!selectedFile) {
+ setFileContent("")
+ return
+ }
+ readFile(selectedFile)
+ .then(setFileContent)
+ .catch((err) => setFileContent(`Error loading file: ${err}`))
+ }, [selectedFile, setFileContent])
+
+ return (
+ <div className="flex h-full flex-col">
+ <div className="flex-1 overflow-auto">
+ {selectedFile ? (
+ <div className="p-6">
+ <div className="mb-4 text-xs text-muted-foreground">
+ {selectedFile}
+ </div>
+ <pre className="whitespace-pre-wrap font-mono text-sm">
+ {fileContent}
+ </pre>
+ </div>
+ ) : (
+ <div className="flex h-full items-center justify-center text-muted-foreground">
+ Select a file from the tree to view
+ </div>
+ )}
+ </div>
+ <ChatBar />
+ </div>
+ )
+}