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

refactor: compact chat mode selectors

nash_sua48736abc1f8
diff --git a/src/components/chat/chat-input.tsx b/src/components/chat/chat-input.tsx
index 25c37e31..64e4de06 100644
--- a/src/components/chat/chat-input.tsx
+++ b/src/components/chat/chat-input.tsx
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useRef, useState, useCallback } from "react"
-import { BrainCircuit, FileSearch, FileText, Globe2, ImagePlus, Send, Sparkles, Square, X } from "lucide-react"
+import { BrainCircuit, ChevronDown, FileSearch, FileText, Globe2, ImagePlus, Send, Sparkles, Square, X } from "lucide-react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
@@ -811,61 +811,45 @@ export function ChatInput({
</div>
)}
</div>
- <div
- className="inline-flex h-7 items-center rounded-md border border-border/70 bg-muted/30 p-0.5"
- role="radiogroup"
- aria-label={t("chat.retrievalMode")}
+ <label
+ className="relative inline-flex h-7 items-center rounded-md border border-border/70 bg-muted/30 text-xs font-medium text-foreground transition-colors hover:bg-accent/60 focus-within:border-ring/60 focus-within:ring-1 focus-within:ring-ring/30"
title={t("chat.retrievalModeHint")}
>
- <BrainCircuit className="mx-1 h-3.5 w-3.5 text-muted-foreground" />
- {RETRIEVAL_MODE_OPTIONS.map((retrieval) => {
- const active = retrievalMode === retrieval
- return (
- <button
- key={retrieval}
- type="button"
- role="radio"
- aria-checked={active}
- disabled={isStreaming}
- onClick={() => onRetrievalModeChange(retrieval)}
- className={`h-6 rounded px-2 text-xs font-medium transition-colors ${
- active
- ? "bg-background text-foreground shadow-sm"
- : "text-muted-foreground hover:bg-background/60 hover:text-foreground"
- } disabled:pointer-events-none disabled:opacity-50`}
- >
+ <BrainCircuit className="ml-2 h-3.5 w-3.5 shrink-0 text-muted-foreground" />
+ <select
+ value={retrievalMode}
+ onChange={(event) => onRetrievalModeChange(event.target.value as ChatRetrievalMode)}
+ disabled={isStreaming}
+ aria-label={t("chat.retrievalMode")}
+ className="h-full max-w-36 appearance-none bg-transparent py-0 pl-1.5 pr-7 text-xs font-medium outline-none disabled:pointer-events-none disabled:opacity-50"
+ >
+ {RETRIEVAL_MODE_OPTIONS.map((retrieval) => (
+ <option key={retrieval} value={retrieval}>
{t(`chat.retrievalModes.${retrieval}`)}
- </button>
- )
- })}
- </div>
- <div
- className="inline-flex h-7 items-center rounded-md border border-border/70 bg-muted/30 p-0.5"
- role="radiogroup"
- aria-label={t("chat.agentMode")}
+ </option>
+ ))}
+ </select>
+ <ChevronDown className="pointer-events-none absolute right-1.5 h-3.5 w-3.5 text-muted-foreground" />
+ </label>
+ <label
+ className="relative inline-flex h-7 items-center rounded-md border border-border/70 bg-muted/30 text-xs font-medium text-foreground transition-colors hover:bg-accent/60 focus-within:border-ring/60 focus-within:ring-1 focus-within:ring-ring/30"
title={t("chat.agentMode")}
>
- {AGENT_MODE_OPTIONS.map((mode) => {
- const active = agentMode === mode
- return (
- <button
- key={mode}
- type="button"
- role="radio"
- aria-checked={active}
- disabled={isStreaming}
- onClick={() => onAgentModeChange(mode)}
- className={`h-6 rounded px-2 text-xs font-medium transition-colors ${
- active
- ? "bg-background text-foreground shadow-sm"
- : "text-muted-foreground hover:bg-background/60 hover:text-foreground"
- } disabled:pointer-events-none disabled:opacity-50`}
- >
+ <select
+ value={agentMode}
+ onChange={(event) => onAgentModeChange(event.target.value as ChatAgentMode)}
+ disabled={isStreaming}
+ aria-label={t("chat.agentMode")}
+ className="h-full max-w-28 appearance-none bg-transparent py-0 pl-2 pr-7 text-xs font-medium outline-none disabled:pointer-events-none disabled:opacity-50"
+ >
+ {AGENT_MODE_OPTIONS.map((mode) => (
+ <option key={mode} value={mode}>
{agentModeLabel(mode)}
- </button>
- )
- })}
- </div>
+ </option>
+ ))}
+ </select>
+ <ChevronDown className="pointer-events-none absolute right-1.5 h-3.5 w-3.5 text-muted-foreground" />
+ </label>
</div>
{isStreaming ? (
<Button
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 24506088..e5deb14c 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -266,11 +266,11 @@
},
"agentMode": "Agent mode",
"retrievalMode": "Retrieval mode",
- "retrievalModeHint": "Standard keeps the existing behavior. Smart iteratively closes evidence gaps. Faithful answers only from raw source excerpts.",
+ "retrievalModeHint": "Standard keeps the existing behavior. Smart iteratively closes evidence gaps. Raw sources only answers exclusively from original source excerpts.",
"retrievalModes": {
"standard": "Standard retrieval",
"smart": "Smart retrieval",
- "faithful": "Faithful sources"
+ "faithful": "Raw sources only"
},
"agentModes": {
"fast": "Fast",
diff --git a/src/i18n/zh.json b/src/i18n/zh.json
index fd202ae9..2283da5a 100644
--- a/src/i18n/zh.json
+++ b/src/i18n/zh.json
@@ -266,11 +266,11 @@
},
"agentMode": "Agent 模式",
"retrievalMode": "检索模式",
- "retrievalModeHint": "传统检索保持现有行为;智能检索按证据缺口迭代;原文忠实模式只依据原始资料片段回答。",
+ "retrievalModeHint": "传统检索保持现有行为;智能检索按证据缺口迭代;只读原文模式只依据原始资料片段回答。",
"retrievalModes": {
"standard": "传统检索",
"smart": "智能检索",
- "faithful": "原文忠实"
+ "faithful": "只读原文"
},
"agentModes": {
"fast": "快速",