diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 4cf61439a..b696b7867 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -238,43 +238,6 @@ history: history }); }; - - // const messageDeleteHandler = async (messageId) => { - // const message = history.messages[messageId]; - // const parentId = message.parentId; - // const childrenIds = message.childrenIds ?? []; - // const grandchildrenIds = []; - - // // Iterate through childrenIds to find grandchildrenIds - // for (const childId of childrenIds) { - // const childMessage = history.messages[childId]; - // const grandChildrenIds = childMessage.childrenIds ?? []; - - // for (const grandchildId of grandchildrenIds) { - // const childMessage = history.messages[grandchildId]; - // childMessage.parentId = parentId; - // } - // grandchildrenIds.push(...grandChildrenIds); - // } - - // history.messages[parentId].childrenIds.push(...grandchildrenIds); - // history.messages[parentId].childrenIds = history.messages[parentId].childrenIds.filter( - // (id) => id !== messageId - // ); - - // // Select latest message - // let currentMessageId = grandchildrenIds.at(-1); - // if (currentMessageId) { - // let messageChildrenIds = history.messages[currentMessageId].childrenIds; - // while (messageChildrenIds.length !== 0) { - // currentMessageId = messageChildrenIds.at(-1); - // messageChildrenIds = history.messages[currentMessageId].childrenIds; - // } - // history.currentId = currentMessageId; - // } - - // await updateChatById(localStorage.token, chatId, { messages, history }); - // };
@@ -297,10 +260,10 @@ }} /> {:else} -
+
{#key chatId} {#each messages as message, messageIdx} -
+
+
{/if} {/key}
diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index c52905476..18ee9f541 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -31,7 +31,9 @@ >
-
{@html highlightedCode || code}