From 6dbb4a0702c62ecb3bc4dcec6f202d9e54e215ee Mon Sep 17 00:00:00 2001
From: Jicheng Lu <103353@smsassist.com>
Date: Wed, 28 Feb 2024 17:36:53 -0600
Subject: [PATCH] add delete log
---
.../[conversationId]/chat-box.svelte | 30 +++++++++++++++++--
.../contentLogs/content-log.svelte | 11 +++++++
.../stateLogs/state-log.svelte | 5 ++++
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
index d7cdfe5f..90fa1b66 100644
--- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
@@ -93,6 +93,10 @@
let isLite = false;
let isFrame = false;
+ /** @type {any} */
+ let contentLogComponent;
+ /** @type {any} */
+ let stateLogComponent;
onMount(async () => {
dialogs = await GetDialogs(params.conversationId);
@@ -532,10 +536,22 @@
const foundIdx = dialogs.findIndex(x => x.message_id === messageId);
if (foundIdx < 0) return false;
dialogs = dialogs.filter((x, idx) => idx < foundIdx);
+ truncateLogs(messageId);
refresh();
return true;
}
+ /** @param {string} messageId */
+ function truncateLogs(messageId) {
+ if (contentLogComponent && contentLogComponent.onDeleteMessage) {
+ contentLogComponent.onDeleteMessage(messageId);
+ }
+
+ if (stateLogComponent && stateLogComponent.onDeleteMessage) {
+ stateLogComponent.onDeleteMessage(messageId);
+ }
+ }
+
/** @param {string} messageId */
function directToLog(messageId) {
if (!!!messageId || isLite) return;
@@ -610,7 +626,12 @@