Skip to content

Commit 8d4778a

Browse files
authored
Merge pull request #118 from iceljc/features/refine-chat-window
add chat indication
2 parents 079da88 + ec79dd8 commit 8d4778a

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/lib/helpers/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ IRichContent.prototype.text;
343343
* @typedef {Object} ConversationSenderActionModel
344344
* @property {string} conversation_id - The conversation id.
345345
* @property {number} sender_action - The sender action.
346+
* @property {string} [indication] - The function indication.
346347
*/
347348

348349
/**

src/lib/scss/custom/pages/_chat.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@
295295
margin-top: 0px !important;
296296
margin-bottom: 0px !important;
297297
}
298+
299+
.chat-indication {
300+
font-size: 1em;
301+
}
298302
}
299303

300304
.image-wrap {

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
let text = "";
5757
let editText = "";
5858
let truncateMsgId = "";
59+
let indication = "";
5960
6061
/** @type {string[]} */
6162
let prevSentMsgs = [];
@@ -327,8 +328,10 @@
327328
function onSenderActionGenerated(data) {
328329
if (data?.sender_action == SenderAction.TypingOn) {
329330
isThinking = true;
331+
indication = data.indication || '';
330332
} else if (data?.sender_action == SenderAction.TypingOff) {
331333
isThinking = false;
334+
indication = '';
332335
}
333336
}
334337
@@ -946,9 +949,14 @@
946949
<div class="cicon-wrap float-start">
947950
<img src={PUBLIC_LIVECHAT_ENTRY_ICON} class="rounded-circle avatar-xs" alt="avatar">
948951
</div>
949-
<div class="ctext-wrap float-start" style="display: flex;">
950-
<div class="flex-shrink-0 align-self-center">
951-
<LoadingDots duration={'1s'} size={10} color={'var(--bs-primary)'} />
952+
<div class="msg-container">
953+
<div class="ctext-wrap float-start">
954+
<span class="chat-indication">
955+
{indication}
956+
</span>
957+
<div class="flex-shrink-0 align-self-center" style="display: inline-block;">
958+
<LoadingDots duration={'1s'} size={10} color={'var(--bs-primary)'} />
959+
</div>
952960
</div>
953961
</div>
954962
</div>

0 commit comments

Comments
 (0)