mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 09:09:53 +00:00
fix: web search
This commit is contained in:
parent
c1971fd8d7
commit
98c18b3032
@ -600,10 +600,14 @@
|
||||
files = model.info.meta.knowledge;
|
||||
}
|
||||
const lastUserMessage = messages.filter((message) => message.role === 'user').at(-1);
|
||||
|
||||
files = [
|
||||
...files,
|
||||
...(lastUserMessage?.files?.filter((item) =>
|
||||
['doc', 'file', 'collection', 'web_search_results'].includes(item.type)
|
||||
) ?? []),
|
||||
...(responseMessage?.files?.filter((item) =>
|
||||
['doc', 'file', 'collection', 'web_search_results'].includes(item.type)
|
||||
) ?? [])
|
||||
].filter(
|
||||
// Remove duplicates
|
||||
@ -844,6 +848,9 @@
|
||||
...files,
|
||||
...(lastUserMessage?.files?.filter((item) =>
|
||||
['doc', 'file', 'collection', 'web_search_results'].includes(item.type)
|
||||
) ?? []),
|
||||
...(responseMessage?.files?.filter((item) =>
|
||||
['doc', 'file', 'collection', 'web_search_results'].includes(item.type)
|
||||
) ?? [])
|
||||
].filter(
|
||||
// Remove duplicates
|
||||
@ -1213,6 +1220,7 @@
|
||||
|
||||
const getWebSearchResults = async (model: string, parentId: string, responseId: string) => {
|
||||
const responseMessage = history.messages[responseId];
|
||||
const userMessage = history.messages[parentId];
|
||||
|
||||
responseMessage.statusHistory = [
|
||||
{
|
||||
@ -1223,7 +1231,7 @@
|
||||
];
|
||||
messages = messages;
|
||||
|
||||
const prompt = history.messages[parentId].content;
|
||||
const prompt = userMessage.content;
|
||||
let searchQuery = await generateSearchQuery(localStorage.token, model, messages, prompt).catch(
|
||||
(error) => {
|
||||
console.log(error);
|
||||
|
Loading…
Reference in New Issue
Block a user