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: chat panel visible on all views, @filename click opens file preview
nash_su80abbb4a92ea
diff --git a/src/components/chat/chat-message.tsx b/src/components/chat/chat-message.tsxindex 7fd2faee..3f816406 100644--- a/src/components/chat/chat-message.tsx+++ b/src/components/chat/chat-message.tsx@@ -128,16 +128,26 @@ function processWikiLinks(text: string): string {function SourceRef({ fileName }: { fileName: string }) {const project = useWikiStore((s) => s.project)const setSelectedFile = useWikiStore((s) => s.setSelectedFile)+ const setFileContent = useWikiStore((s) => s.setFileContent)const setActiveView = useWikiStore((s) => s.setActiveView)- const handleClick = useCallback((e: React.MouseEvent) => {+ const handleClick = useCallback(async (e: React.MouseEvent) => {e.preventDefault()e.stopPropagation()if (!project) returnconst path = `${project.path}/raw/sources/${fileName}`- setSelectedFile(path)+ // Switch to wiki view first, then set file and contentsetActiveView("wiki")- }, [project, fileName, setSelectedFile, setActiveView])+ // Small delay to ensure view has switched before setting file+ await new Promise((r) => setTimeout(r, 50))+ setSelectedFile(path)+ try {+ const content = await readFile(path)+ setFileContent(content)+ } catch {+ setFileContent(`Unable to load: ${fileName}`)+ }+ }, [project, fileName, setSelectedFile, setFileContent, setActiveView])return (<buttondiff --git a/src/components/layout/content-area.tsx b/src/components/layout/content-area.tsxindex 822e270c..15fb288a 100644--- a/src/components/layout/content-area.tsx+++ b/src/components/layout/content-area.tsx@@ -25,14 +25,11 @@ export function ContentArea() {const category = getFileCategory(selectedFile)- // Don't try to read binary files as textif (isBinary(category)) {setFileContent("")return}- // For PDF, read_file extracts text on Rust side- // For text/code/data/markdown, read as textreadFile(selectedFile).then(setFileContent).catch((err) => setFileContent(`Error loading file: ${err}`))@@ -57,48 +54,50 @@ export function ContentArea() {}}, [])- if (activeView === "settings") {- return <SettingsView />- }-- if (activeView === "sources") {- return <SourcesView />- }-- if (activeView === "review") {- return <ReviewView />- }-- const category = selectedFile ? getFileCategory(selectedFile) : null-- const editorContent = (- <div className="h-full min-w-0 overflow-auto">- {selectedFile ? (- category === "markdown" ? (- <WikiEditor- key={selectedFile}- content={fileContent}- onSave={handleSave}- />- ) : (- <FilePreview- key={selectedFile}- filePath={selectedFile}- textContent={fileContent}- />+ // Render the main view content based on activeView+ function renderMainContent() {+ switch (activeView) {+ case "settings":+ return <SettingsView />+ case "sources":+ return <SourcesView />+ case "review":+ return <ReviewView />+ default: {+ // Wiki view: show editor or file preview+ const category = selectedFile ? getFileCategory(selectedFile) : null+ return (+ <div className="h-full min-w-0 overflow-auto">+ {selectedFile ? (+ category === "markdown" ? (+ <WikiEditor+ key={selectedFile}+ content={fileContent}+ onSave={handleSave}+ />+ ) : (+ <FilePreview+ key={selectedFile}+ filePath={selectedFile}+ textContent={fileContent}+ />+ )+ ) : (+ <div className="flex h-full items-center justify-center text-muted-foreground">+ Select a file from the tree to view+ </div>+ )}+ </div>)- ) : (- <div className="flex h-full items-center justify-center text-muted-foreground">- Select a file from the tree to view- </div>- )}- </div>- )+ }+ }+ }+ // Chat bar is always visible at the bottom, regardless of activeViewif (!chatExpanded) {return (<div className="flex h-full min-w-0 flex-col overflow-hidden">- <div className="flex-1 overflow-hidden">{editorContent}</div>+ <div className="flex-1 overflow-hidden">{renderMainContent()}</div><ChatBar /></div>)@@ -106,7 +105,7 @@ export function ContentArea() {return (<div className="flex h-full min-w-0 flex-col overflow-hidden">- <div className="flex-1 overflow-hidden">{editorContent}</div>+ <div className="flex-1 overflow-hidden">{renderMainContent()}</div><div className="h-1.5 shrink-0 cursor-row-resize bg-border/40 transition-colors hover:bg-primary/30" /><div className="h-64 shrink-0 overflow-hidden"><ChatBar />