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: polish agent chat workspace UI
nash_su53757d8da3de
diff --git a/src-tauri/src/agent/context.rs b/src-tauri/src/agent/context.rsindex 5ff9026b..9ff2cdf8 100644--- a/src-tauri/src/agent/context.rs+++ b/src-tauri/src/agent/context.rs@@ -93,6 +93,7 @@ fn build_system_context());out.push_str("- Do not create generated files in the user's home folder, Desktop, Downloads, system temp folders, hidden app metadata folders, or skill installation folders.\n");out.push_str("- Treat skill folders as read-only instruction/reference sources. If a skill or script needs output files, pass or choose a path under the Agent workspace above.\n");+ out.push_str("- If the requested visual can be represented as a Mermaid diagram, reply with a ```mermaid fenced code block directly instead of generating an HTML file just to display that diagram.\n");out.push_str("- When using shell.exec, prefer relative output paths because the shell runs from the Agent workspace; use the LLM_WIKI_AGENT_WORKSPACE environment variable when an absolute output path is required.\n");if let Some(overview) = project.overview.as_deref().filter(|v| !v.trim().is_empty()) {diff --git a/src-tauri/src/commands/project.rs b/src-tauri/src/commands/project.rsindex 643ed756..d46ed586 100644--- a/src-tauri/src/commands/project.rs+++ b/src-tauri/src/commands/project.rs@@ -289,6 +289,56 @@ pub fn open_project_folder(app: AppHandle, path: String) -> Result<(), String> {})}+#[tauri::command]+pub fn open_path_in_project(+ app: AppHandle,+ project_path: String,+ target_path: String,+) -> Result<(), String> {+ run_guarded("open_path_in_project", || {+ let root = Path::new(&project_path);+ validate_wiki_project_root(root)?;++ let root_canonical = root+ .canonicalize()+ .map_err(|e| format!("Failed to resolve project path '{}': {}", project_path, e))?;+ let target = Path::new(&target_path);+ let target = if target.is_absolute() {+ target.to_path_buf()+ } else {+ root_canonical.join(target)+ };+ let target_canonical = target.canonicalize().map_err(|e| {+ format!(+ "Failed to resolve target path '{}': {}",+ target.display(),+ e+ )+ })?;++ if !target_canonical.starts_with(&root_canonical) {+ return Err(format!(+ "Refusing to open a path outside the project: '{}'",+ target_canonical.display()+ ));+ }++ let target = target_canonical.to_string_lossy().to_string();+ match app.opener().open_path(target.clone(), None::<&str>) {+ Ok(()) => Ok(()),+ Err(open_err) => app+ .opener()+ .reveal_item_in_dir(target)+ .map_err(|reveal_err| {+ format!(+ "Failed to open project path: {}; reveal fallback also failed: {}",+ open_err, reveal_err+ )+ }),+ }+ })+}+fn validate_wiki_project_root(root: &Path) -> Result<(), String> {if !root.exists() {return Err(format!("Path does not exist: '{}'", root.display()));diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex 2970d78f..05ba2c5e 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -635,6 +635,7 @@ pub fn run() {commands::project::create_project,commands::project::open_project,commands::project::open_project_folder,+ commands::project::open_path_in_project,commands::search::search_project,commands::search::embedding_fetch,commands::external_search::web_search,diff --git a/src/commands/fs.ts b/src/commands/fs.tsindex 33de21eb..b20699c8 100644--- a/src/commands/fs.ts+++ b/src/commands/fs.ts@@ -184,6 +184,10 @@ export async function openProjectFolder(path: string): Promise<void> {return invoke<void>("open_project_folder", { path })}+export async function openPathInProject(projectPath: string, targetPath: string): Promise<void> {+ return invoke<void>("open_path_in_project", { projectPath, targetPath })+}+export async function clipServerStatus(): Promise<string> {return invoke<string>("clip_server_status")}diff --git a/src/components/chat/chat-panel.tsx b/src/components/chat/chat-panel.tsxindex ca7900e7..55b6609b 100644--- a/src/components/chat/chat-panel.tsx+++ b/src/components/chat/chat-panel.tsx@@ -11,7 +11,7 @@ import { useWikiStore } from "@/stores/wiki-store"import { isReasoningOnlyResponseError, streamChat } from "@/lib/llm-client"import { supportsImageInput } from "@/lib/llm-providers"import { executeIngestWrites } from "@/lib/ingest"-import { deleteFile, readFile } from "@/commands/fs"+import { deleteFile, openPathInProject, readFile } from "@/commands/fs"import { getFileName, isAbsolutePath, normalizePath } from "@/lib/path-utils"import { hasConfiguredAnyTxt } from "@/lib/anytxt-search"import type { ChatAgentEvent, ChatAgentStep, ChatUserInputRequest } from "@/lib/chat-agent-types"@@ -80,6 +80,33 @@ export let lastQueryPages: { title: string; path: string }[] = []const AGENT_STREAM_IDLE_TIMEOUT_MS = 8 * 60 * 1000const AGENT_SKILL_STREAM_IDLE_TIMEOUT_MS = 15 * 60 * 1000+function parentDirectory(path: string): string {+ const normalized = normalizePath(path).replace(/\/+$/g, "")+ const idx = normalized.lastIndexOf("/")+ if (idx <= 0) return normalized+ return normalized.slice(0, idx)+}++function commonDirectory(paths: string[]): string | null {+ const directories = paths+ .map(parentDirectory)+ .filter((dir) => dir.trim().length > 0)+ if (directories.length === 0) return null+ const firstParts = directories[0].split("/")+ let commonLength = firstParts.length+ for (const dir of directories.slice(1)) {+ const parts = dir.split("/")+ commonLength = Math.min(commonLength, parts.length)+ for (let i = 0; i < commonLength; i += 1) {+ if (firstParts[i] !== parts[i]) {+ commonLength = i+ break+ }+ }+ }+ return firstParts.slice(0, commonLength).join("/") || null+}+function agentStreamIdleTimeoutMs(options: ChatSendOptions, skillCount: number): number {return skillCount > 0 || options.agentMode === "deep"? AGENT_SKILL_STREAM_IDLE_TIMEOUT_MS@@ -96,7 +123,13 @@ function formatDate(timestamp: number): string {return d.toLocaleDateString([], { month: "short", day: "numeric" })}-function ConversationSidebar() {+function ConversationSidebar({+ onNewConversation,+ onSelectConversation,+}: {+ onNewConversation?: () => void+ onSelectConversation?: (id: string) => void+}) {const { t } = useTranslation()const conversations = useChatStore((s) => s.conversations)const activeConversationId = useChatStore((s) => s.activeConversationId)@@ -120,7 +153,13 @@ function ConversationSidebar() {variant="outline"size="sm"className="w-full gap-2"- onClick={() => createConversation()}+ onClick={() => {+ if (onNewConversation) {+ onNewConversation()+ } else {+ createConversation()+ }+ }}><Plus className="h-3.5 w-3.5" />{t("chat.newChat")}@@ -144,7 +183,13 @@ function ConversationSidebar() {? "bg-primary/10 text-primary": "hover:bg-accent text-foreground"}`}- onClick={() => setActiveConversation(conv.id)}+ onClick={() => {+ if (onSelectConversation) {+ onSelectConversation(conv.id)+ } else {+ setActiveConversation(conv.id)+ }+ }}onMouseEnter={() => setHoveredId(conv.id)}onMouseLeave={() => setHoveredId(null)}>@@ -534,6 +579,15 @@ export function ChatPanel() {setGeneratedOutputPreview(null)}, [activeConversationId, generatedOutputPreviews])+ const openGeneratedOutputDirectory = useCallback(() => {+ if (!project) return+ const directory = commonDirectory(generatedOutputPreviews.map((preview) => preview.path))+ if (!directory) return+ void openPathInProject(project.path, directory).catch((err) => {+ console.error("[chat] failed to open generated output directory:", err)+ })+ }, [generatedOutputPreviews, project])+const handleOpenReferencePreview = useCallback((preview: ChatReferencePreview, relatedPreviews?: ChatReferencePreview[]) => {const isGeneratedOutput = preview.source === "Workspace"|| normalizePath(preview.path).split("/").includes("agent-workspace")@@ -1032,6 +1086,21 @@ export function ChatPanel() {setStreamingConversationId(null)}, [project, setStreaming])+ const handleNewConversation = useCallback(() => {+ handleStop()+ setReferencePreview(null)+ setGeneratedOutputPreviews([])+ setGeneratedOutputPreview(null)+ setApprovingShellMessageId(null)+ dismissedGeneratedOutputsKeyRef.current = null+ createConversation()+ }, [createConversation, handleStop])++ const handleSelectConversation = useCallback((conversationId: string) => {+ useChatStore.getState().setActiveConversation(conversationId)+ setApprovingShellMessageId(null)+ }, [])+const handleRegenerate = useCallback(async () => {if (activeStreaming) return// Find the last user message in active conversation@@ -1050,8 +1119,9 @@ export function ChatPanel() {const updatedActive = store.getActiveMessages()const lastUser = [...updatedActive].reverse().find((m) => m.role === "user")if (lastUser) {+ const activeId = useChatStore.getState().activeConversationIduseChatStore.setState((s) => ({- messages: s.messages.filter((m) => m.id !== lastUser.id),+ messages: s.messages.filter((m) => m.conversationId !== activeId || m.id !== lastUser.id),}))}// Re-send with the original text AND images so a regenerated turn@@ -1157,7 +1227,10 @@ export function ChatPanel() {return (<div className="flex h-full flex-row overflow-hidden">- <ConversationSidebar />+ <ConversationSidebar+ onNewConversation={handleNewConversation}+ onSelectConversation={handleSelectConversation}+ /><div className="flex flex-1 flex-col overflow-hidden">{!activeConversationId ? (@@ -1168,37 +1241,37 @@ export function ChatPanel() {<p className="mt-1 text-xs opacity-60">{t("chat.clickNewChatToBegin")}</p></div></div>- ) : (- <>- <div- ref={scrollContainerRef}- className="flex-1 overflow-y-auto px-3 py-2"- >- <div className="flex flex-col gap-3">- {activeMessages.map((msg, idx) => {- // Check if this is the last assistant message- const isLastAssistant = msg.role === "assistant" &&- !activeMessages.slice(idx + 1).some((m) => m.role === "assistant")- return (- <ChatMessage- key={msg.id}- message={msg}- isLastAssistant={isLastAssistant && !activeStreaming}- onRegenerate={isLastAssistant ? handleRegenerate : undefined}- onOpenReferencePreview={handleOpenReferencePreview}- onApproveShellCommand={- isLastAssistant && approvingShellMessageId !== msg.id- ? handleApproveShellCommand- : undefined- }- onSubmitUserInput={isLastAssistant ? handleSubmitUserInput : undefined}- />- )- })}- {activeStreaming && <StreamingMessage content={streamingContent} agentEvents={activeAgentEvents} />}- <div ref={bottomRef} />+ ) : (+ <>+ <div+ ref={scrollContainerRef}+ className="flex-1 overflow-y-auto px-3 py-2"+ >+ <div className="flex flex-col gap-3">+ {activeMessages.map((msg, idx) => {+ // Check if this is the last assistant message+ const isLastAssistant = msg.role === "assistant" &&+ !activeMessages.slice(idx + 1).some((m) => m.role === "assistant")+ return (+ <ChatMessage+ key={`${msg.conversationId}:${msg.id}:${msg.timestamp}:${idx}`}+ message={msg}+ isLastAssistant={isLastAssistant && !activeStreaming}+ onRegenerate={isLastAssistant ? handleRegenerate : undefined}+ onOpenReferencePreview={handleOpenReferencePreview}+ onApproveShellCommand={+ isLastAssistant && approvingShellMessageId !== msg.id+ ? handleApproveShellCommand+ : undefined+ }+ onSubmitUserInput={isLastAssistant ? handleSubmitUserInput : undefined}+ />+ )+ })}+ {activeStreaming && <StreamingMessage content={streamingContent} agentEvents={activeAgentEvents} />}+ <div ref={bottomRef} />+ </div></div>- </div>{showWriteButton && (<div className="border-t px-3 py-2">@@ -1251,6 +1324,7 @@ export function ChatPanel() {<GeneratedOutputsPaneloutputs={generatedOutputPreviews}onOpen={openGeneratedOutputModal}+ onOpenDirectory={project ? openGeneratedOutputDirectory : undefined}onClose={closeGeneratedOutputsPanel}/>)}@@ -1267,10 +1341,12 @@ export function ChatPanel() {function GeneratedOutputsPanel({outputs,onOpen,+ onOpenDirectory,onClose,}: {outputs: ChatReferencePreview[]onOpen: (preview: ChatReferencePreview) => void+ onOpenDirectory?: () => voidonClose: () => void}) {const { t } = useTranslation()@@ -1284,6 +1360,17 @@ function GeneratedOutputsPanel({{t("chat.generatedOutputCount", { count: outputs.length })}</div></div>+ {onOpenDirectory && (+ <button+ type="button"+ onClick={onOpenDirectory}+ className="shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground"+ title={t("chat.openGeneratedOutputFolder", { defaultValue: "Open output folder" })}+ aria-label={t("chat.openGeneratedOutputFolder", { defaultValue: "Open output folder" })}+ >+ <FolderOpen className="h-3.5 w-3.5" />+ </button>+ )}<buttontype="button"onClick={onClose}diff --git a/src/components/layout/app-layout-visibility.test.ts b/src/components/layout/app-layout-visibility.test.tsindex 3045a847..3f8b2a94 100644--- a/src/components/layout/app-layout-visibility.test.ts+++ b/src/components/layout/app-layout-visibility.test.ts@@ -18,6 +18,13 @@ describe("getAppLayoutVisibility", () => {})})+ it("keeps skills as a standalone management view", () => {+ expect(getAppLayoutVisibility("skills", true)).toEqual({+ showLeftPanel: false,+ hasRightPanel: false,+ })+ })+it("shows the project side panel and optional research panel in workspace views", () => {expect(getAppLayoutVisibility("wiki", false)).toEqual({showLeftPanel: true,diff --git a/src/components/layout/content-area.tsx b/src/components/layout/content-area.tsxindex 234563e9..35273b8d 100644--- a/src/components/layout/content-area.tsx+++ b/src/components/layout/content-area.tsx@@ -1,6 +1,7 @@import { useWikiStore } from "@/stores/wiki-store"import { ChatPanel } from "@/components/chat/chat-panel"import { SettingsView } from "@/components/settings/settings-view"+import { SkillsSection } from "@/components/settings/sections/skills-section"import { SourcesView } from "@/components/sources/sources-view"import { ReviewView } from "@/components/review/review-view"import { LintView } from "@/components/lint/lint-view"@@ -18,6 +19,8 @@ export function ContentArea() {return <PreviewPanel />case "settings":return <SettingsView />+ case "skills":+ return <SkillsView />case "sources":return <SourcesView />case "review":@@ -32,3 +35,13 @@ export function ContentArea() {return <PreviewPanel />}}++function SkillsView() {+ return (+ <div className="h-full overflow-y-auto px-8 py-6">+ <div className="mx-auto max-w-3xl">+ <SkillsSection />+ </div>+ </div>+ )+}diff --git a/src/components/layout/icon-sidebar.tsx b/src/components/layout/icon-sidebar.tsxindex c0575b51..2044d9e3 100644--- a/src/components/layout/icon-sidebar.tsx+++ b/src/components/layout/icon-sidebar.tsx@@ -1,6 +1,6 @@import { useState, useEffect } from "react"import {- FileText, FolderOpen, Search, Network, ClipboardCheck, Settings, ArrowLeftRight, ClipboardList, Globe, MessageSquare,+ FileText, FolderOpen, Search, Network, ClipboardCheck, Settings, ArrowLeftRight, ClipboardList, Globe, MessageSquare, Sparkles,} from "lucide-react"import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"import { useWikiStore } from "@/stores/wiki-store"@@ -126,6 +126,19 @@ export function IconSidebar({ onSwitchProject }: IconSidebarProps) {</TooltipTrigger><TooltipContent side="right">{t("research.title")}</TooltipContent></Tooltip>+ <Tooltip>+ <TooltipTrigger+ onClick={() => setActiveView("skills")}+ className={`relative flex h-10 w-10 items-center justify-center rounded-md transition-colors ${+ activeView === "skills"+ ? "bg-accent text-accent-foreground"+ : "text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground"+ }`}+ >+ <Sparkles className="h-5 w-5" />+ </TooltipTrigger>+ <TooltipContent side="right">{t("nav.skills")}</TooltipContent>+ </Tooltip></div>{/* Bottom: daemon status + settings + switch project */}<div className="flex flex-col items-center gap-1 pb-1">diff --git a/src/components/layout/research-panel-nav.test.ts b/src/components/layout/research-panel-nav.test.tsindex 3d4a905b..bd5f340c 100644--- a/src/components/layout/research-panel-nav.test.ts+++ b/src/components/layout/research-panel-nav.test.ts@@ -14,6 +14,10 @@ describe("research panel nav state", () => {activeView: "wiki",researchPanelOpen: true,})+ expect(nextResearchPanelNavState("skills", false)).toEqual({+ activeView: "wiki",+ researchPanelOpen: true,+ })})it("toggles the panel inside workspace views", () => {@@ -29,6 +33,7 @@ describe("research panel nav state", () => {it("only marks the panel visible outside standalone views", () => {expect(isResearchPanelVisible("chat", true)).toBe(false)+ expect(isResearchPanelVisible("skills", true)).toBe(false)expect(isResearchPanelVisible("settings", true)).toBe(false)expect(isResearchPanelVisible("wiki", true)).toBe(true)})diff --git a/src/components/layout/research-panel-nav.ts b/src/components/layout/research-panel-nav.tsindex a4d8c1f8..fa35ff30 100644--- a/src/components/layout/research-panel-nav.ts+++ b/src/components/layout/research-panel-nav.ts@@ -1,7 +1,7 @@import type { WikiState } from "@/stores/wiki-store"export function isStandaloneView(view: WikiState["activeView"]): boolean {- return view === "chat" || view === "settings"+ return view === "chat" || view === "skills" || view === "settings"}export function isResearchPanelVisible(diff --git a/src/components/mermaid-diagram.tsx b/src/components/mermaid-diagram.tsxindex b2fa8d39..339fff51 100644--- a/src/components/mermaid-diagram.tsx+++ b/src/components/mermaid-diagram.tsx@@ -1,5 +1,5 @@import { Children, isValidElement, useEffect, useRef, useState, type ReactNode } from "react"-import { X, ZoomIn } from "lucide-react"+import { AlertTriangle, X, ZoomIn } from "lucide-react"interface MermaidDiagramProps {code: string@@ -58,14 +58,31 @@ export function MermaidDiagram({ code }: MermaidDiagramProps) {startOnLoad: false,theme: "default",securityLevel: "strict",+ suppressErrorRendering: true,+ })+ mermaid.setParseErrorHandler(() => {+ // The component owns Mermaid parse errors. Do not let Mermaid inject+ // its default "Syntax error in text" block into the document body.})const id = `mermaid-${Math.random().toString(36).slice(2, 10)}`- const { svg: rendered } = await mermaid.render(id, code)- if (!cancelled) {- svgCache.set(code, rendered)- setSvg(rendered)- setError(null)+ const renderHost = document.createElement("div")+ renderHost.style.position = "absolute"+ renderHost.style.left = "-10000px"+ renderHost.style.top = "0"+ renderHost.style.width = "1px"+ renderHost.style.height = "1px"+ renderHost.style.overflow = "hidden"+ containerRef.current?.appendChild(renderHost)+ try {+ const { svg: rendered } = await mermaid.render(id, code, renderHost)+ if (!cancelled) {+ svgCache.set(code, rendered)+ setSvg(rendered)+ setError(null)+ }+ } finally {+ renderHost.remove()}} catch (err) {if (!cancelled) {@@ -96,10 +113,24 @@ export function MermaidDiagram({ code }: MermaidDiagramProps) {}, [expanded])if (error) {+ const summary = summarizeMermaidError(error)return (- <div className="my-2 rounded border border-red-300/60 bg-red-50/50 dark:bg-red-950/20 p-2 text-xs text-red-700 dark:text-red-400">- <p className="font-medium mb-1">Mermaid syntax error</p>- <pre className="whitespace-pre-wrap text-[11px] opacity-70">{error}</pre>+ <div className="my-2 max-w-full rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive">+ <div className="flex items-start gap-2">+ <AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" />+ <div className="min-w-0 flex-1">+ <p className="font-medium">Mermaid diagram could not be rendered</p>+ <p className="mt-0.5 line-clamp-2 text-destructive/80">{summary}</p>+ <details className="mt-1">+ <summary className="cursor-pointer select-none text-[11px] text-destructive/70 hover:text-destructive">+ Show parser details+ </summary>+ <pre className="mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded bg-background/70 p-2 text-[11px] text-muted-foreground">+ {error}+ </pre>+ </details>+ </div>+ </div></div>)}@@ -184,6 +215,18 @@ export function MermaidDiagram({ code }: MermaidDiagramProps) {)}+function summarizeMermaidError(error: string): string {+ const normalized = error+ .replace(/\s*mermaid version\s+[\d.]+/gi, "")+ .replace(/\n{2,}/g, "\n")+ .trim()+ const firstUsefulLine = normalized+ .split("\n")+ .map((line) => line.trim())+ .find((line) => line && !/^error:/i.test(line))+ return firstUsefulLine || "Check the diagram syntax in the Mermaid code block."+}+export function unwrapMermaidPre(children: ReactNode): ReactNode | null {const childNodes = Children.toArray(children)if (childNodes.length !== 1) return nulldiff --git a/src/components/settings/settings-view.tsx b/src/components/settings/settings-view.tsxindex 389adb73..786c6ece 100644--- a/src/components/settings/settings-view.tsx+++ b/src/components/settings/settings-view.tsx@@ -15,7 +15,6 @@ import {Server,Settings,FileText,- Sparkles,} from "lucide-react"import { useTranslation } from "react-i18next"import { invoke } from "@tauri-apps/api/core"@@ -41,7 +40,6 @@ import { ScheduledImportSection } from "./sections/scheduled-import-section"import { SourceWatchSection } from "./sections/source-watch-section"import { MineruSection } from "./sections/mineru-section"import { ApiServerSection } from "./sections/api-server-section"-import { SkillsSection } from "./sections/skills-section"import { GeneralSection } from "./sections/general-section"import { ChangelogSection } from "./sections/changelog-section"import { MaintenanceSection } from "./sections/maintenance-section"@@ -53,7 +51,6 @@ type CategoryId =| "embedding"| "multimodal"| "web-search"- | "skills"| "network"| "source-watch"| "scheduled-import"@@ -80,7 +77,6 @@ const CATEGORIES: Category[] = [{ id: "embedding", labelKey: "settings.categories.embedding", icon: Binary },{ id: "multimodal", labelKey: "settings.categories.multimodal", icon: ImageIcon },{ id: "web-search", labelKey: "settings.categories.webSearch", icon: Globe },- { id: "skills", labelKey: "settings.categories.skills", icon: Sparkles },{ id: "network", labelKey: "settings.categories.network", icon: Network },{ id: "source-watch", labelKey: "settings.categories.sourceWatch", icon: FolderSync },{ id: "scheduled-import", labelKey: "settings.categories.scheduledImport", icon: Clock },@@ -610,8 +606,6 @@ export function SettingsView() {return <MultimodalSection draft={draft} setDraft={setDraft} />case "web-search":return <WebSearchSection />- case "skills":- return <SkillsSection />case "network":return <NetworkSection draft={draft} setDraft={setDraft} />case "source-watch":@@ -695,7 +689,7 @@ export function SettingsView() {{/* Global Save bar hidden for sections that persist inline:- "llm" saves per-row on every edit (independent per-preset state)- "about" has no draft-bound fields */}- {active !== "about" && active !== "llm" && active !== "skills" && (+ {active !== "about" && active !== "llm" && (<div className="shrink-0 border-t bg-background/80 backdrop-blur px-8 py-3"><div className="mx-auto flex max-w-2xl items-center justify-between gap-4"><p className={`text-xs ${saveError ? "text-destructive" : "text-muted-foreground"}`}>diff --git a/src/i18n/en.json b/src/i18n/en.jsonindex e407cdb6..2e870d36 100644--- a/src/i18n/en.json+++ b/src/i18n/en.json@@ -11,6 +11,7 @@"graph": "Graph","lint": "Lint","review": "Review",+ "skills": "Skills","settings": "Settings","switchProject": "Switch Project","updateAvailable": "Update available",@@ -286,7 +287,6 @@"embedding": "Embeddings","multimodal": "Image Captioning","webSearch": "External Information Sources",- "skills": "Skills","network": "Network","sourceWatch": "Source Watch","scheduledImport": "Scheduled Import",diff --git a/src/i18n/zh.json b/src/i18n/zh.jsonindex 63df7612..a511bf7a 100644--- a/src/i18n/zh.json+++ b/src/i18n/zh.json@@ -11,6 +11,7 @@"graph": "关系图","lint": "检查","review": "待审阅",+ "skills": "Skills","settings": "设置","switchProject": "切换项目","updateAvailable": "有可用更新",@@ -286,7 +287,6 @@"embedding": "向量嵌入","multimodal": "图片描述","webSearch": "外部信息源",- "skills": "Skills","network": "网络","sourceWatch": "资料文件夹监控","scheduledImport": "定时导入",diff --git a/src/stores/chat-store.test.ts b/src/stores/chat-store.test.tsindex 74dee93f..3391bfb2 100644--- a/src/stores/chat-store.test.ts+++ b/src/stores/chat-store.test.ts@@ -54,6 +54,37 @@ describe("chat-store conversation isolation", () => {expect(useChatStore.getState().isStreaming).toBe(true)})+ it("creates globally unique message ids across conversations", () => {+ const first = useChatStore.getState().createConversation()+ useChatStore.getState().addMessageToConversation(first, "user", "first")++ const second = useChatStore.getState().createConversation()+ useChatStore.getState().addMessageToConversation(second, "user", "second")++ const ids = useChatStore.getState().messages.map((message) => message.id)+ expect(new Set(ids).size).toBe(ids.length)+ })++ it("removes the last assistant message only from the active conversation", () => {+ useChatStore.setState({+ conversations: [+ { id: "c1", title: "One", createdAt: 1, updatedAt: 1 },+ { id: "c2", title: "Two", createdAt: 2, updatedAt: 2 },+ ],+ activeConversationId: "c2",+ messages: [+ { id: "same", conversationId: "c1", role: "assistant", content: "keep", timestamp: 1 },+ { id: "same", conversationId: "c2", role: "assistant", content: "remove", timestamp: 2 },+ ],+ })++ useChatStore.getState().removeLastAssistantMessage()++ expect(useChatStore.getState().messages).toEqual([+ { id: "same", conversationId: "c1", role: "assistant", content: "keep", timestamp: 1 },+ ])+ })+it("clears stale stream content when creating or switching conversations", () => {const first = useChatStore.getState().createConversation()useChatStore.setState({diff --git a/src/stores/chat-store.ts b/src/stores/chat-store.tsindex 4bd1359e..c829bc89 100644--- a/src/stores/chat-store.ts+++ b/src/stores/chat-store.ts@@ -93,7 +93,7 @@ let messageCounter = 0function nextId(): string {messageCounter += 1- return String(messageCounter)+ return `msg_${Date.now()}_${messageCounter}_${Math.random().toString(36).slice(2, 8)}`}function generateConversationId(): string {@@ -329,7 +329,7 @@ export const useChatStore = create<ChatState>((set, get) => ({if (lastAssistantIdx === -1) return stateconst msgToRemove = activeMessages[activeMessages.length - 1 - lastAssistantIdx]return {- messages: state.messages.filter((m) => m.id !== msgToRemove.id),+ messages: state.messages.filter((m) => m.conversationId !== activeId || m.id !== msgToRemove.id),}}),diff --git a/src/stores/wiki-store.ts b/src/stores/wiki-store.tsindex d474751b..e237158e 100644--- a/src/stores/wiki-store.ts+++ b/src/stores/wiki-store.ts@@ -365,7 +365,7 @@ interface WikiState {* one wiki-relative) still works.*/pendingScrollImageSrc: string | null- activeView: "chat" | "wiki" | "sources" | "search" | "graph" | "lint" | "review" | "settings"+ activeView: "chat" | "wiki" | "sources" | "search" | "graph" | "lint" | "review" | "skills" | "settings"llmConfig: LlmConfig/** Per-provider-preset stored overrides (API key, model, endpoint, …). */providerConfigs: ProviderConfigs