Merge 86f33de9f3 into 911a114ad4
This commit is contained in:
commit
e8dc6f6f27
|
|
@ -1397,10 +1397,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,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
}
|
||||
|
||||
let system = '';
|
||||
let rag_template = '';
|
||||
let info = {
|
||||
id: '',
|
||||
base_model_id: null,
|
||||
|
|
@ -74,12 +75,14 @@
|
|||
tags: []
|
||||
},
|
||||
params: {
|
||||
system: ''
|
||||
system: '',
|
||||
rag_template: ''
|
||||
}
|
||||
};
|
||||
|
||||
let params = {
|
||||
system: ''
|
||||
let params: {
|
||||
system: '';
|
||||
rag_template: '';
|
||||
};
|
||||
|
||||
let knowledge = [];
|
||||
|
|
@ -203,6 +206,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) {
|
||||
|
|
@ -250,6 +254,7 @@
|
|||
}
|
||||
|
||||
system = model?.params?.system ?? '';
|
||||
rag_template = model?.params?.rag_template ?? '';
|
||||
|
||||
params = { ...params, ...model?.params };
|
||||
params.stop = params?.stop
|
||||
|
|
@ -618,6 +623,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-semibold">
|
||||
{$i18n.t('Advanced Params')}
|
||||
|
|
|
|||
Loading…
Reference in New Issue