mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
Merge 86f33de9f3 into 2b1a29d44b
This commit is contained in:
commit
4c23243ace
2 changed files with 26 additions and 4 deletions
|
|
@ -1550,10 +1550,15 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
if prompt is None:
|
||||
raise Exception("No user message found")
|
||||
|
||||
model_rag_template = (
|
||||
model.get("info", {}).get("params", {}).get("rag_template", "")
|
||||
or request.app.state.config.RAG_TEMPLATE
|
||||
)
|
||||
|
||||
if context_string != "":
|
||||
form_data["messages"] = add_or_update_user_message(
|
||||
rag_template(
|
||||
request.app.state.config.RAG_TEMPLATE,
|
||||
model_rag_template,
|
||||
context_string,
|
||||
prompt,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@
|
|||
}
|
||||
|
||||
let system = '';
|
||||
let rag_template = '';
|
||||
let info = {
|
||||
id: '',
|
||||
base_model_id: null,
|
||||
|
|
@ -78,12 +79,14 @@
|
|||
tags: []
|
||||
},
|
||||
params: {
|
||||
system: ''
|
||||
system: '',
|
||||
rag_template: ''
|
||||
}
|
||||
};
|
||||
|
||||
let params = {
|
||||
system: ''
|
||||
let params: {
|
||||
system: '';
|
||||
rag_template: '';
|
||||
};
|
||||
|
||||
let knowledge = [];
|
||||
|
|
@ -207,6 +210,7 @@
|
|||
}
|
||||
|
||||
info.params.system = system.trim() === '' ? null : system;
|
||||
info.params.rag_template = rag_template.trim() === '' ? null : rag_template;
|
||||
info.params.stop = params.stop ? params.stop.split(',').filter((s) => s.trim()) : null;
|
||||
Object.keys(info.params).forEach((key) => {
|
||||
if (info.params[key] === '' || info.params[key] === null) {
|
||||
|
|
@ -254,6 +258,7 @@
|
|||
}
|
||||
|
||||
system = model?.params?.system ?? '';
|
||||
rag_template = model?.params?.rag_template ?? '';
|
||||
|
||||
params = { ...params, ...model?.params };
|
||||
params.stop = params?.stop
|
||||
|
|
@ -644,6 +649,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="my-1">
|
||||
<div class=" text-xs font-semibold mb-2">{$i18n.t('RAG Template')}</div>
|
||||
<div>
|
||||
<Textarea
|
||||
placeholder={$i18n.t(
|
||||
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||
)}
|
||||
bind:value={rag_template}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full justify-between">
|
||||
<div class=" self-center text-xs font-medium">
|
||||
{$i18n.t('Advanced Params')}
|
||||
|
|
|
|||
Loading…
Reference in a new issue