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: LLM responses now match source document language
nash_su49e2ecaf6787
diff --git a/src/components/chat/chat-panel.tsx b/src/components/chat/chat-panel.tsxindex c31bd187..a62c447c 100644--- a/src/components/chat/chat-panel.tsx+++ b/src/components/chat/chat-panel.tsx@@ -101,6 +101,9 @@ export function ChatPanel() {content: ["You are a knowledgeable wiki assistant. Answer questions based on the wiki content provided below.","",+ "## Language Rule",+ "- ALWAYS respond in the same language the user uses. If the user writes in Chinese, respond in Chinese. If in English, respond in English. Match the user's language exactly.",+ "","## Rules","- Answer based ONLY on the numbered wiki pages provided below.","- If the provided pages don't contain enough information, say so honestly.",diff --git a/src/lib/deep-research.ts b/src/lib/deep-research.tsindex b44c69eb..57fde5dd 100644--- a/src/lib/deep-research.ts+++ b/src/lib/deep-research.ts@@ -103,6 +103,10 @@ async function executeResearch(const systemPrompt = ["You are a research assistant. Synthesize the web search results into a comprehensive wiki page.",+ "",+ "## Language Rule",+ "- ALWAYS match the language of the research topic. If the topic is in Chinese, write in Chinese. If in English, write in English.",+ "","- Organize into clear sections with headings","- Cite sources using [N] notation","- Note contradictions or gaps",diff --git a/src/lib/ingest.ts b/src/lib/ingest.tsindex 2e86f502..c33fed12 100644--- a/src/lib/ingest.ts+++ b/src/lib/ingest.ts@@ -8,6 +8,8 @@ import { useReviewStore, type ReviewItem } from "@/stores/review-store"const FILE_BLOCK_REGEX = /---FILE:\s*([^\n-]+?)\s*---\n([\s\S]*?)---END FILE---/g+export const LANGUAGE_RULE = "## Language Rule\n- ALWAYS match the language of the source document. If the source is in Chinese, write in Chinese. If in English, write in English. Wiki page titles, content, and descriptions should all be in the same language as the source material."+/*** Auto-ingest: reads source → LLM analyzes → LLM writes wiki pages, all in one go.* Used when importing new files.@@ -270,6 +272,8 @@ function buildAnalysisPrompt(purpose: string, index: string): string {return ["You are an expert research analyst. Read the source document and produce a structured analysis.","",+ LANGUAGE_RULE,+ "","Your analysis should cover:","","## Key Entities",@@ -319,6 +323,8 @@ function buildGenerationPrompt(schema: string, purpose: string, index: string, sreturn ["You are a wiki maintainer. Based on the analysis provided, generate wiki files.","",+ LANGUAGE_RULE,+ "",`## IMPORTANT: Source File`,`The original source file is: **${sourceFileName}**`,`All wiki pages generated from this source MUST include this filename in their frontmatter \`sources\` field.`,@@ -428,6 +434,8 @@ export async function startIngest(const systemPrompt = ["You are a knowledgeable assistant helping to build a wiki from source documents.","",+ LANGUAGE_RULE,+ "",purpose ? `## Wiki Purpose\n${purpose}` : "",schema ? `## Wiki Schema\n${schema}` : "",index ? `## Current Wiki Index\n${index}` : "",@@ -522,6 +530,8 @@ export async function executeIngestWrites(const systemPrompt = ["You are a wiki generation assistant. Your task is to produce structured wiki file contents.",+ "",+ LANGUAGE_RULE,schema ? `## Wiki Schema\n${schema}` : "",].filter(Boolean)diff --git a/src/lib/lint.ts b/src/lib/lint.tsindex dd9d3cc6..6f6b5838 100644--- a/src/lib/lint.ts+++ b/src/lib/lint.ts@@ -199,6 +199,9 @@ export async function runSemanticLint(const prompt = ["You are a wiki quality analyst. Review the following wiki page summaries and identify issues.","",+ "## Language Rule",+ "- Match the language of the wiki content. If pages are in Chinese, write issues in Chinese. If in English, use English.",+ "","For each issue, output exactly this format:","","---LINT: type | severity | Short title---",