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: search triggers on Enter only, not on every keystroke

nash_su7b87a58e96fb
diff --git a/src/components/search/search-view.tsx b/src/components/search/search-view.tsx
index 2e47b551..7da84407 100644
--- a/src/components/search/search-view.tsx
+++ b/src/components/search/search-view.tsx
@@ -16,8 +16,6 @@ export function SearchView() {
const [query, setQuery] = useState("")
const [results, setResults] = useState<SearchResult[]>([])
const [searching, setSearching] = useState(false)
- const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)
-
const doSearch = useCallback(
async (q: string) => {
if (!project || !q.trim()) {
@@ -38,14 +36,6 @@ export function SearchView() {
[project],
)
- useEffect(() => {
- if (debounceRef.current) clearTimeout(debounceRef.current)
- debounceRef.current = setTimeout(() => doSearch(query), 300)
- return () => {
- if (debounceRef.current) clearTimeout(debounceRef.current)
- }
- }, [query, doSearch])
-
async function handleOpen(result: SearchResult) {
try {
const content = await readFile(result.path)
@@ -66,7 +56,8 @@ export function SearchView() {
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
- placeholder={t("search.placeholder")}
+ onKeyDown={(e) => { if (e.key === "Enter") doSearch(query) }}
+ placeholder={t("search.placeholder") + " (Enter to search)"}
autoFocus
className="w-full rounded-md border bg-background py-2 pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"
/>