Skip to content

Commit 86ac52d

Browse files
authored
Merge pull request #240 from iceljc/features/refine-chat-window
minor change
2 parents 128959e + 7880091 commit 86ac52d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/routes/chat/[agentId]/[conversationId]/chat-box.svelte

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,17 @@
262262
263263
/** @param {import('$conversationTypes').ChatResponseModel} message */
264264
function sendReceivedNotification(message) {
265+
if (notificationTimeout) {
266+
clearTimeout(notificationTimeout);
267+
}
268+
269+
notificationText = message?.rich_content?.message?.text || message.text || '';
270+
isDisplayNotification = true;
271+
notificationTimeout = setTimeout(() => {
272+
isDisplayNotification = false;
273+
notificationText = '';
274+
}, notificationText?.length > 200 ? 8000 : 3000);
275+
265276
if (isFrame) {
266277
window.parent.postMessage({ action: ChatAction.ReceiveNotification, data: message }, "*");
267278
}
@@ -442,17 +453,6 @@
442453
443454
/** @param {import('$conversationTypes').ChatResponseModel} message */
444455
function onNotificationGenerated(message) {
445-
if (notificationTimeout) {
446-
clearTimeout(notificationTimeout);
447-
}
448-
449-
notificationText = message?.rich_content?.message?.text || message.text || '';
450-
isDisplayNotification = true;
451-
notificationTimeout = setTimeout(() => {
452-
isDisplayNotification = false;
453-
notificationText = '';
454-
}, notificationText?.length > 200 ? 8000 : 3000);
455-
456456
sendReceivedNotification(message);
457457
}
458458

0 commit comments

Comments
 (0)