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: queryRefs declared outside if-block to avoid reference error

nash_su9a527b126fba
diff --git a/src/components/chat/chat-panel.tsx b/src/components/chat/chat-panel.tsx
index 6b180ed3..f00d4674 100644
--- a/src/components/chat/chat-panel.tsx
+++ b/src/components/chat/chat-panel.tsx
@@ -159,6 +159,7 @@ export function ChatPanel() {
// Build system prompt with wiki context using graph-enhanced retrieval
const systemMessages: LLMMessage[] = []
+ let queryRefs: { title: string; path: string }[] = []
if (project) {
const dataVersion = useWikiStore.getState().dataVersion
const maxCtx = llmConfig.maxContextSize || 204800
@@ -302,8 +303,7 @@ export function ChatPanel() {
})
lastQueryPages = relevantPages.map((p) => ({ title: p.title, path: p.path }))
- // Capture for passing to finalizeStream
- const queryRefs = [...lastQueryPages]
+ queryRefs = [...lastQueryPages]
}
// ── Conversation history with count limit ────────────────