mirror of
https://github.com/open-webui/open-webui
synced 2025-02-06 13:10:16 +00:00
refac
This commit is contained in:
parent
abe17ab4b5
commit
85f8a80389
@ -763,7 +763,7 @@
|
|||||||
? await getAndUpdateUserLocation(localStorage.token)
|
? await getAndUpdateUserLocation(localStorage.token)
|
||||||
: undefined
|
: undefined
|
||||||
)}${
|
)}${
|
||||||
responseMessage?.userContext ?? null
|
(responseMessage?.userContext ?? null)
|
||||||
? `\n\nUser Context:\n${responseMessage?.userContext ?? ''}`
|
? `\n\nUser Context:\n${responseMessage?.userContext ?? ''}`
|
||||||
: ''
|
: ''
|
||||||
}`
|
}`
|
||||||
@ -812,11 +812,11 @@
|
|||||||
// Only initialize and add status if knowledge exists
|
// Only initialize and add status if knowledge exists
|
||||||
responseMessage.statusHistory = [
|
responseMessage.statusHistory = [
|
||||||
{
|
{
|
||||||
done: false,
|
action: 'knowledge_search',
|
||||||
action: 'rag_search',
|
description: $i18n.t(`Searching Knowledge for "{{searchQuery}}"`, {
|
||||||
description: $i18n.t(`Searching in Knowledge for "{{searchQuery}}"`, {
|
|
||||||
searchQuery: userMessage.content
|
searchQuery: userMessage.content
|
||||||
})
|
}),
|
||||||
|
done: false
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
files.push(...model.info.meta.knowledge);
|
files.push(...model.info.meta.knowledge);
|
||||||
@ -848,7 +848,7 @@
|
|||||||
options: {
|
options: {
|
||||||
...(params ?? $settings.params ?? {}),
|
...(params ?? $settings.params ?? {}),
|
||||||
stop:
|
stop:
|
||||||
params?.stop ?? $settings?.params?.stop ?? undefined
|
(params?.stop ?? $settings?.params?.stop ?? undefined)
|
||||||
? (params?.stop.split(',').map((token) => token.trim()) ?? $settings.params.stop).map(
|
? (params?.stop.split(',').map((token) => token.trim()) ?? $settings.params.stop).map(
|
||||||
(str) => decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"'))
|
(str) => decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"'))
|
||||||
)
|
)
|
||||||
@ -902,9 +902,9 @@
|
|||||||
if ('citations' in data) {
|
if ('citations' in data) {
|
||||||
responseMessage.citations = data.citations;
|
responseMessage.citations = data.citations;
|
||||||
// Only remove status if it was initially set
|
// Only remove status if it was initially set
|
||||||
if (responseMessage.statusHistory) {
|
if (model?.info?.meta?.knowledge ?? false) {
|
||||||
responseMessage.statusHistory = responseMessage.statusHistory.filter(
|
responseMessage.statusHistory = responseMessage.statusHistory.filter(
|
||||||
(status) => status.action !== 'rag_search'
|
(status) => status.action !== 'knowledge_search'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -1079,11 +1079,11 @@
|
|||||||
// Only initialize and add status if knowledge exists
|
// Only initialize and add status if knowledge exists
|
||||||
responseMessage.statusHistory = [
|
responseMessage.statusHistory = [
|
||||||
{
|
{
|
||||||
done: false,
|
action: 'knowledge_search',
|
||||||
action: 'rag_search',
|
description: $i18n.t(`Searching Knowledge for "{{searchQuery}}"`, {
|
||||||
description: $i18n.t(`Searching in Knowledge for "{{searchQuery}}"`, {
|
|
||||||
searchQuery: userMessage.content
|
searchQuery: userMessage.content
|
||||||
})
|
}),
|
||||||
|
done: false
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
files.push(...model.info.meta.knowledge);
|
files.push(...model.info.meta.knowledge);
|
||||||
@ -1114,7 +1114,7 @@
|
|||||||
stream: true,
|
stream: true,
|
||||||
model: model.id,
|
model: model.id,
|
||||||
stream_options:
|
stream_options:
|
||||||
model.info?.meta?.capabilities?.usage ?? false
|
(model.info?.meta?.capabilities?.usage ?? false)
|
||||||
? {
|
? {
|
||||||
include_usage: true
|
include_usage: true
|
||||||
}
|
}
|
||||||
@ -1130,7 +1130,7 @@
|
|||||||
? await getAndUpdateUserLocation(localStorage.token)
|
? await getAndUpdateUserLocation(localStorage.token)
|
||||||
: undefined
|
: undefined
|
||||||
)}${
|
)}${
|
||||||
responseMessage?.userContext ?? null
|
(responseMessage?.userContext ?? null)
|
||||||
? `\n\nUser Context:\n${responseMessage?.userContext ?? ''}`
|
? `\n\nUser Context:\n${responseMessage?.userContext ?? ''}`
|
||||||
: ''
|
: ''
|
||||||
}`
|
}`
|
||||||
@ -1150,7 +1150,7 @@
|
|||||||
text:
|
text:
|
||||||
arr.length - 1 !== idx
|
arr.length - 1 !== idx
|
||||||
? message.content
|
? message.content
|
||||||
: message?.raContent ?? message.content
|
: (message?.raContent ?? message.content)
|
||||||
},
|
},
|
||||||
...message.files
|
...message.files
|
||||||
.filter((file) => file.type === 'image')
|
.filter((file) => file.type === 'image')
|
||||||
@ -1166,12 +1166,12 @@
|
|||||||
content:
|
content:
|
||||||
arr.length - 1 !== idx
|
arr.length - 1 !== idx
|
||||||
? message.content
|
? message.content
|
||||||
: message?.raContent ?? message.content
|
: (message?.raContent ?? message.content)
|
||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
seed: params?.seed ?? $settings?.params?.seed ?? undefined,
|
seed: params?.seed ?? $settings?.params?.seed ?? undefined,
|
||||||
stop:
|
stop:
|
||||||
params?.stop ?? $settings?.params?.stop ?? undefined
|
(params?.stop ?? $settings?.params?.stop ?? undefined)
|
||||||
? (params?.stop.split(',').map((token) => token.trim()) ?? $settings.params.stop).map(
|
? (params?.stop.split(',').map((token) => token.trim()) ?? $settings.params.stop).map(
|
||||||
(str) => decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"'))
|
(str) => decodeURIComponent(JSON.parse('"' + str.replace(/\"/g, '\\"') + '"'))
|
||||||
)
|
)
|
||||||
@ -1228,9 +1228,9 @@
|
|||||||
if (citations) {
|
if (citations) {
|
||||||
responseMessage.citations = citations;
|
responseMessage.citations = citations;
|
||||||
// Only remove status if it was initially set
|
// Only remove status if it was initially set
|
||||||
if (responseMessage.statusHistory) {
|
if (model?.info?.meta?.knowledge ?? false) {
|
||||||
responseMessage.statusHistory = responseMessage.statusHistory.filter(
|
responseMessage.statusHistory = responseMessage.statusHistory.filter(
|
||||||
(status) => status.action !== 'rag_search'
|
(status) => status.action !== 'knowledge_search'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user