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
eb2b1ab7
"vscode:/vscode.git/clone" did not exist on "ab9de2090c9ea89c0141a5c142bcbed3e80bb90b"
Commit
eb2b1ab7
authored
Feb 03, 2024
by
Timothy J. Baek
Browse files
feat: query all documents
parent
38584856
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
18 deletions
+27
-18
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+1
-1
src/lib/components/chat/MessageInput/Documents.svelte
src/lib/components/chat/MessageInput/Documents.svelte
+24
-15
src/lib/components/chat/Messages/UserMessage.svelte
src/lib/components/chat/Messages/UserMessage.svelte
+1
-1
src/lib/components/documents/EditDocModal.svelte
src/lib/components/documents/EditDocModal.svelte
+1
-1
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
eb2b1ab7
...
...
@@ -468,7 +468,7 @@
<div class="flex flex-col justify-center -space-y-0.5">
<div class=" dark:text-gray-100 text-sm font-medium line-clamp-1">
#
{file.name}
{file?.title ?? `#$
{file.name}
`}
</div>
<div class=" text-gray-500 text-sm">Collection</div>
...
...
src/lib/components/chat/MessageInput/Documents.svelte
View file @
eb2b1ab7
...
...
@@ -13,34 +13,43 @@
let filteredItems = [];
let filteredDocs = [];
let filteredTags = [];
let collections = [];
$: collections = $documents
.reduce((a, e, i, arr) => {
return [...new Set([...a, ...(e?.content?.tags ?? []).map((tag) => tag.name)])];
}, [])
.map((tag) => ({
name: tag,
$: collections = [
{
name: 'All Documents',
type: 'collection',
collection_names: $documents
.filter((doc) => (doc?.content?.tags ?? []).map((tag) => tag.name).includes(tag))
.map((doc) => doc.collection_name)
}));
title: 'All Documents',
collection_names: $documents.map((doc) => doc.collection_name)
},
...$documents
.reduce((a, e, i, arr) => {
return [...new Set([...a, ...(e?.content?.tags ?? []).map((tag) => tag.name)])];
}, [])
.map((tag) => ({
name: tag,
type: 'collection',
collection_names: $documents
.filter((doc) => (doc?.content?.tags ?? []).map((tag) => tag.name).includes(tag))
.map((doc) => doc.collection_name)
}))
];
$: filteredCollections = collections
.filter((
tag) => tag
.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''))
.filter((
collection) => collection
.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''))
.sort((a, b) => a.name.localeCompare(b.name));
$: filteredDocs = $documents
.filter((
p
) =>
p
.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''))
.filter((
doc
) =>
doc
.name.includes(prompt.split(' ')?.at(0)?.substring(1) ?? ''))
.sort((a, b) => a.title.localeCompare(b.title));
$: filteredItems = [...filteredCollections, ...filteredDocs];
$: if (prompt) {
selectedIdx = 0;
console.log(filteredCollections);
}
export const selectUp = () => {
...
...
@@ -74,7 +83,7 @@
};
</script>
{#if filtered
Doc
s.length > 0 || prompt.split(' ')?.at(0)?.substring(1).startsWith('http')}
{#if filtered
Item
s.length > 0 || prompt.split(' ')?.at(0)?.substring(1).startsWith('http')}
<div class="md:px-2 mb-3 text-left w-full">
<div class="flex w-full rounded-lg border border-gray-100 dark:border-gray-700">
<div class=" bg-gray-100 dark:bg-gray-700 w-10 rounded-l-lg text-center">
...
...
@@ -101,7 +110,7 @@
>
{#if doc.type === 'collection'}
<div class=" font-medium text-black line-clamp-1">
#
{doc.name}
{doc?.title ?? `#$
{doc.name}
`}
</div>
<div class=" text-xs text-gray-600 line-clamp-1">Collection</div>
...
...
src/lib/components/chat/Messages/UserMessage.svelte
View file @
eb2b1ab7
...
...
@@ -140,7 +140,7 @@
<div class="flex flex-col justify-center -space-y-0.5">
<div class=" dark:text-gray-100 text-sm font-medium line-clamp-1">
#
{file.name}
{file?.title ?? `#$
{file.name}
`}
</div>
<div class=" text-gray-500 text-sm">Collection</div>
...
...
src/lib/components/documents/EditDocModal.svelte
View file @
eb2b1ab7
...
...
@@ -37,7 +37,7 @@
};
const addTagHandler = async (tagName) => {
if (!tags.find((tag) => tag.name === tagName)) {
if (!tags.find((tag) => tag.name === tagName)
&& tagName !== ''
) {
tags = [...tags, { name: tagName }];
await tagDocByName(localStorage.token, doc.name, {
...
...
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