mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-08 17:59:09 +00:00
core: fix file search limit handling and ensure File module initialization
This commit is contained in:
@@ -250,7 +250,7 @@ export namespace File {
|
||||
log.info("search", { query: input.query })
|
||||
const limit = input.limit ?? 100
|
||||
const result = await state().then((x) => x.files())
|
||||
if (!input.query) return result.dirs.toSorted()
|
||||
if (!input.query) return result.dirs.toSorted().slice(0, limit)
|
||||
const items = [...result.files, ...result.dirs]
|
||||
const sorted = fuzzysort.go(input.query, items, { limit: limit }).map((r) => r.target)
|
||||
log.info("search", { query: input.query, results: sorted.length })
|
||||
|
||||
Reference in New Issue
Block a user