Merge pull request #2997 from open-webui/main

dev
This commit is contained in:
Timothy Jaeryang Baek 2024-06-10 18:02:06 -07:00 committed by GitHub
commit 7fb785901e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -365,7 +365,7 @@
return _responses; return _responses;
}; };
const sendPrompt = async (prompt, parentId, modelId = null) => { const sendPrompt = async (prompt, parentId, modelId = null, newChat = true) => {
let _responses = []; let _responses = [];
// If modelId is provided, use it, else use selected model // If modelId is provided, use it, else use selected model
@ -412,7 +412,7 @@
await tick(); await tick();
// Create new chat if only one message in messages // Create new chat if only one message in messages
if (messages.length == 2) { if (newChat && messages.length == 2) {
if ($settings.saveChatHistory ?? true) { if ($settings.saveChatHistory ?? true) {
chat = await createNewChat(localStorage.token, { chat = await createNewChat(localStorage.token, {
id: $chatId, id: $chatId,
@ -1116,9 +1116,9 @@
let userPrompt = userMessage.content; let userPrompt = userMessage.content;
if ((userMessage?.models ?? [...selectedModels]).length == 1) { if ((userMessage?.models ?? [...selectedModels]).length == 1) {
await sendPrompt(userPrompt, userMessage.id); await sendPrompt(userPrompt, userMessage.id, undefined, false);
} else { } else {
await sendPrompt(userPrompt, userMessage.id, message.model); await sendPrompt(userPrompt, userMessage.id, message.model, false);
} }
} }
}; };