Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
eaa68504
Commit
eaa68504
authored
Feb 22, 2024
by
Timothy J. Baek
Browse files
Update Messages.svelte
parent
c42ac39d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
src/lib/components/chat/Messages.svelte
src/lib/components/chat/Messages.svelte
+20
-8
No files found.
src/lib/components/chat/Messages.svelte
View file @
eaa68504
...
@@ -223,20 +223,32 @@
...
@@ -223,20 +223,32 @@
}, 100);
}, 100);
};
};
const deleteMessageAndDescendants = async (messageId: string) => {
// TODO: change delete behaviour
// const deleteMessageAndDescendants = async (messageId: string) => {
// if (history.messages[messageId]) {
// history.messages[messageId].deleted = true;
// for (const childId of history.messages[messageId].childrenIds) {
// await deleteMessageAndDescendants(childId);
// }
// }
// };
// const triggerDeleteMessageRecursive = async (messageId: string) => {
// await deleteMessageAndDescendants(messageId);
// await updateChatById(localStorage.token, chatId, { history });
// await chats.set(await getChatList(localStorage.token));
// };
const messageDeleteHandler = async (messageId) => {
if (history.messages[messageId]) {
if (history.messages[messageId]) {
history.messages[messageId].deleted = true;
history.messages[messageId].deleted = true;
for (const childId of history.messages[messageId].childrenIds) {
for (const childId of history.messages[messageId].childrenIds) {
await deleteMessageAndDescendants(childId)
;
history.messages[childId].deleted = true
;
}
}
}
}
};
const triggerDeleteMessageRecursive = async (messageId: string) => {
await deleteMessageAndDescendants(messageId);
await updateChatById(localStorage.token, chatId, { history });
await updateChatById(localStorage.token, chatId, { history });
await chats.set(await getChatList(localStorage.token));
};
};
</script>
</script>
...
@@ -255,7 +267,7 @@
...
@@ -255,7 +267,7 @@
>
>
{#if message.role === 'user'}
{#if message.role === 'user'}
<UserMessage
<UserMessage
on:delete={() =>
trig
ge
r
Delete
MessageRecursive
(message.id)}
on:delete={() =>
messa
geDelete
Handler
(message.id)}
user={$user}
user={$user}
{message}
{message}
isFirstMessage={messageIdx === 0}
isFirstMessage={messageIdx === 0}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment