mirror of
https://github.com/open-webui/open-webui
synced 2025-02-21 12:29:29 +00:00
refac: file handling
This commit is contained in:
parent
8b71ce23bb
commit
8ec3ed1830
@ -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 @@
|
|||||||
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 @@
|
|||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user