Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
09e95b8d
Commit
09e95b8d
authored
Jun 24, 2024
by
Jonathan Rohde
Browse files
feat(chat): ignore upper/lower case to select document/tag/collection
parent
f54a66b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
src/lib/components/chat/MessageInput/Documents.svelte
src/lib/components/chat/MessageInput/Documents.svelte
+11
-2
No files found.
src/lib/components/chat/MessageInput/Documents.svelte
View file @
09e95b8d
...
...
@@ -43,11 +43,11 @@
];
$: filteredCollections = collections
.filter((collection) =>
collection.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''
))
.filter((collection) =>
findByName(collection, prompt
))
.sort((a, b) => a.name.localeCompare(b.name));
$: filteredDocs = $documents
.filter((doc) =>
doc.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''
))
.filter((doc) =>
findByName(doc, prompt
))
.sort((a, b) => a.title.localeCompare(b.title));
$: filteredItems = [...filteredCollections, ...filteredDocs];
...
...
@@ -58,6 +58,15 @@
console.log(filteredCollections);
}
type ObjectWithName = {
name: string;
};
const findByName = (obj: ObjectWithName, prompt: string) => {
const name = obj.name.toLowerCase();
return name.includes(prompt.toLowerCase().split(' ')?.at(0)?.substring(1) ?? '');
}
export const selectUp = () => {
selectedIdx = Math.max(0, selectedIdx - 1);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment