mirror of
https://github.com/open-webui/open-webui
synced 2025-01-18 00:30:51 +00:00
Merge pull request #4813 from jannikstdl/rag-knowledge-status
feat: show rag status when using models with knowledge collections
This commit is contained in:
commit
670672c067
@ -809,7 +809,18 @@
|
||||
|
||||
let files = JSON.parse(JSON.stringify(chatFiles));
|
||||
if (model?.info?.meta?.knowledge ?? false) {
|
||||
// Only initialize and add status if knowledge exists
|
||||
responseMessage.statusHistory = [
|
||||
{
|
||||
action: 'knowledge_search',
|
||||
description: $i18n.t(`Searching Knowledge for "{{searchQuery}}"`, {
|
||||
searchQuery: userMessage.content
|
||||
}),
|
||||
done: false
|
||||
}
|
||||
];
|
||||
files.push(...model.info.meta.knowledge);
|
||||
messages = messages; // Trigger Svelte update
|
||||
}
|
||||
files.push(
|
||||
...(userMessage?.files ?? []).filter((item) =>
|
||||
@ -818,6 +829,8 @@
|
||||
...(responseMessage?.files ?? []).filter((item) => ['web_search_results'].includes(item.type))
|
||||
);
|
||||
|
||||
scrollToBottom();
|
||||
|
||||
eventTarget.dispatchEvent(
|
||||
new CustomEvent('chat:start', {
|
||||
detail: {
|
||||
@ -888,6 +901,12 @@
|
||||
|
||||
if ('citations' in data) {
|
||||
responseMessage.citations = data.citations;
|
||||
// Only remove status if it was initially set
|
||||
if (model?.info?.meta?.knowledge ?? false) {
|
||||
responseMessage.statusHistory = responseMessage.statusHistory.filter(
|
||||
(status) => status.action !== 'knowledge_search'
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -977,7 +996,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
await saveChatHandler(_chatId);
|
||||
if ($chatId == _chatId) {
|
||||
if ($settings.saveChatHistory ?? true) {
|
||||
chat = await updateChatById(localStorage.token, _chatId, {
|
||||
messages: messages,
|
||||
history: history,
|
||||
models: selectedModels,
|
||||
params: params,
|
||||
files: chatFiles
|
||||
});
|
||||
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (res !== null) {
|
||||
const error = await res.json();
|
||||
@ -1044,7 +1076,18 @@
|
||||
|
||||
let files = JSON.parse(JSON.stringify(chatFiles));
|
||||
if (model?.info?.meta?.knowledge ?? false) {
|
||||
// Only initialize and add status if knowledge exists
|
||||
responseMessage.statusHistory = [
|
||||
{
|
||||
action: 'knowledge_search',
|
||||
description: $i18n.t(`Searching Knowledge for "{{searchQuery}}"`, {
|
||||
searchQuery: userMessage.content
|
||||
}),
|
||||
done: false
|
||||
}
|
||||
];
|
||||
files.push(...model.info.meta.knowledge);
|
||||
messages = messages; // Trigger Svelte update
|
||||
}
|
||||
files.push(
|
||||
...(userMessage?.files ?? []).filter((item) =>
|
||||
@ -1184,6 +1227,12 @@
|
||||
|
||||
if (citations) {
|
||||
responseMessage.citations = citations;
|
||||
// Only remove status if it was initially set
|
||||
if (model?.info?.meta?.knowledge ?? false) {
|
||||
responseMessage.statusHistory = responseMessage.statusHistory.filter(
|
||||
(status) => status.action !== 'knowledge_search'
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1238,7 +1287,7 @@
|
||||
}
|
||||
|
||||
if ($chatId == _chatId) {
|
||||
if (!$temporaryChatEnabled) {
|
||||
if ($settings.saveChatHistory ?? true) {
|
||||
chat = await updateChatById(localStorage.token, _chatId, {
|
||||
models: selectedModels,
|
||||
messages: messages,
|
||||
|
@ -473,8 +473,8 @@
|
||||
"Playground": "Testumgebung",
|
||||
"Please carefully review the following warnings:": "",
|
||||
"Positive attitude": "Positive Einstellung",
|
||||
"Previous 30 days": "Vorherige 30 Tage",
|
||||
"Previous 7 days": "Vorherige 7 Tage",
|
||||
"Previous 30 days": "Vorherige 30 Tage",
|
||||
"Profile Image": "Profilbild",
|
||||
"Prompt": "Prompt",
|
||||
"Prompt (e.g. Tell me a fun fact about the Roman Empire)": "Prompt (z. B. \"Erzähle mir eine interessante Tatsache über das Römische Reich\")",
|
||||
@ -535,6 +535,7 @@
|
||||
"Searched {{count}} sites_one": "{{count}} Seite durchsucht",
|
||||
"Searched {{count}} sites_other": "{{count}} Seiten durchsucht",
|
||||
"Searching \"{{searchQuery}}\"": "Suche nach \"{{searchQuery}}\"",
|
||||
"Searching in Knowledge for \"{{searchQuery}}\"": "Suche in Wissen nach \"{{searchQuery}}\"",
|
||||
"Searxng Query URL": "Searxng-Abfrage-URL",
|
||||
"See readme.md for instructions": "Anleitung in readme.md anzeigen",
|
||||
"See what's new": "Entdecken Sie die Neuigkeiten",
|
||||
|
@ -543,6 +543,7 @@
|
||||
"Select a engine": "",
|
||||
"Select a function": "",
|
||||
"Select a model": "",
|
||||
"Searching in Knowledge for \"{{searchQuery}}\"": "",
|
||||
"Select a pipeline": "",
|
||||
"Select a pipeline url": "",
|
||||
"Select a tool": "",
|
||||
|
Loading…
Reference in New Issue
Block a user