mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-18 05:05:09 +02:00
refac
This commit is contained in:
@@ -169,13 +169,20 @@ Based on the user's instruction, update and enhance the existing notes or select
|
||||
: '') +
|
||||
(selectedContent ? `\n<selection>${selectedContent?.text}</selection>` : '');
|
||||
|
||||
// Filter out empty assistant placeholder messages to avoid sending
|
||||
// an empty trailing assistant message as "response prefill", which is
|
||||
// incompatible with enable_thinking in llama.cpp and similar backends.
|
||||
const filteredMessages = messages.filter(
|
||||
(m) => !(m.role === 'assistant' && m.content === '')
|
||||
);
|
||||
|
||||
const chatMessages = JSON.parse(
|
||||
JSON.stringify([
|
||||
{
|
||||
role: 'system',
|
||||
content: `${system}`
|
||||
},
|
||||
...messages
|
||||
...filteredMessages
|
||||
])
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user