Skip to content

Commit 93731e4

Browse files
committed
fix: temp chat message continue
1 parent f72e28a commit 93731e4

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

backend/open_webui/utils/middleware.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,14 @@ def extract_attributes(tag_content):
13581358
)
13591359

13601360
tool_calls = []
1361-
content = message.get("content", "") if message else ""
1361+
1362+
last_assistant_message = get_last_assistant_message(form_data["messages"])
1363+
content = (
1364+
message.get("content", "")
1365+
if message
1366+
else last_assistant_message if last_assistant_message else ""
1367+
)
1368+
13621369
content_blocks = [
13631370
{
13641371
"type": "text",

src/lib/components/chat/Messages.svelte

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
<script lang="ts">
22
import { v4 as uuidv4 } from 'uuid';
3-
import { chats, config, settings, user as _user, mobile, currentChatPage } from '$lib/stores';
3+
import {
4+
chats,
5+
config,
6+
settings,
7+
user as _user,
8+
mobile,
9+
currentChatPage,
10+
temporaryChatEnabled
11+
} from '$lib/stores';
412
import { tick, getContext, onMount, createEventDispatcher } from 'svelte';
513
const dispatch = createEventDispatcher();
614
@@ -85,15 +93,17 @@
8593
};
8694
8795
const updateChat = async () => {
88-
history = history;
89-
await tick();
90-
await updateChatById(localStorage.token, chatId, {
91-
history: history,
92-
messages: messages
93-
});
96+
if (!$temporaryChatEnabled) {
97+
history = history;
98+
await tick();
99+
await updateChatById(localStorage.token, chatId, {
100+
history: history,
101+
messages: messages
102+
});
94103
95-
currentChatPage.set(1);
96-
await chats.set(await getChatList(localStorage.token, $currentChatPage));
104+
currentChatPage.set(1);
105+
await chats.set(await getChatList(localStorage.token, $currentChatPage));
106+
}
97107
};
98108
99109
const showPreviousMessage = async (message) => {

0 commit comments

Comments
 (0)