core: keep file @mentions responsive on first search
This commit is contained in:
parent
8379612c52
commit
0ca507fd00
3 changed files with 28 additions and 6 deletions
|
|
@ -573,14 +573,17 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||
const seen = new Set(open)
|
||||
const pinned: AtOption[] = open.map((path) => ({ type: "file", path, display: path, recent: true }))
|
||||
if (!query.trim()) return [...agents, ...pinned]
|
||||
const pathy = /[./\\]/.test(query)
|
||||
const paths = await files.searchFiles(query)
|
||||
const fileOptions: AtOption[] = paths
|
||||
.filter((path) => !seen.has(path))
|
||||
.map((path) => ({ type: "file", path, display: path }))
|
||||
if (pathy) return fileOptions
|
||||
return [...agents, ...pinned, ...fileOptions]
|
||||
},
|
||||
key: atKey,
|
||||
filterKeys: ["display"],
|
||||
stale: false,
|
||||
groupBy: (item) => {
|
||||
if (item.type === "agent") return "agent"
|
||||
if (item.recent) return "recent"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue