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
8ec3ed18
Commit
8ec3ed18
authored
Jul 17, 2024
by
Timothy J. Baek
Browse files
refac: file handling
parent
8b71ce23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
src/lib/components/chat/Chat.svelte
src/lib/components/chat/Chat.svelte
+15
-10
No files found.
src/lib/components/chat/Chat.svelte
View file @
8ec3ed18
...
@@ -706,6 +706,7 @@
...
@@ -706,6 +706,7 @@
let _response = null;
let _response = null;
const responseMessage = history.messages[responseMessageId];
const responseMessage = history.messages[responseMessageId];
const userMessage = history.messages[responseMessage.parentId];
// Wait until history/message have been updated
// Wait until history/message have been updated
await tick();
await tick();
...
@@ -772,11 +773,12 @@
...
@@ -772,11 +773,12 @@
if (model?.info?.meta?.knowledge ?? false) {
if (model?.info?.meta?.knowledge ?? false) {
files.push(...model.info.meta.knowledge);
files.push(...model.info.meta.knowledge);
}
}
if (responseMessage?.files) {
files.push(
files.push(
...(userMessage?.files ?? []).filter((item) =>
...responseMessage?.files.filter((item) => ['web_search_results'].includes(item.type))
['doc', 'file', 'collection'].includes(item.type)
);
),
}
...(responseMessage?.files ?? []).filter((item) => ['web_search_results'].includes(item.type))
);
eventTarget.dispatchEvent(
eventTarget.dispatchEvent(
new CustomEvent('chat:start', {
new CustomEvent('chat:start', {
...
@@ -1006,17 +1008,20 @@
...
@@ -1006,17 +1008,20 @@
const sendPromptOpenAI = async (model, userPrompt, responseMessageId, _chatId) => {
const sendPromptOpenAI = async (model, userPrompt, responseMessageId, _chatId) => {
let _response = null;
let _response = null;
const responseMessage = history.messages[responseMessageId];
const responseMessage = history.messages[responseMessageId];
const userMessage = history.messages[responseMessage.parentId];
let files = JSON.parse(JSON.stringify(chatFiles));
let files = JSON.parse(JSON.stringify(chatFiles));
if (model?.info?.meta?.knowledge ?? false) {
if (model?.info?.meta?.knowledge ?? false) {
files.push(...model.info.meta.knowledge);
files.push(...model.info.meta.knowledge);
}
}
if (responseMessage?.files) {
files.push(
files.push(
...(userMessage?.files ?? []).filter((item) =>
...responseMessage?.files.filter((item) => ['web_search_results'].includes(item.type))
['doc', 'file', 'collection'].includes(item.type)
);
),
}
...(responseMessage?.files ?? []).filter((item) => ['web_search_results'].includes(item.type))
);
scrollToBottom();
scrollToBottom();
...
...
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