From d481c4697e8541b080d4443c40227e43a01705b8 Mon Sep 17 00:00:00 2001
From: Jicheng Lu <103353@smsassist.com>
Date: Wed, 15 May 2024 10:21:01 -0500
Subject: [PATCH 1/2] use full name
---
src/lib/scss/custom/pages/_chat.scss | 2 +-
src/routes/chat/[agentId]/[conversationId]/chat-box.svelte | 2 +-
.../[agentId]/[conversationId]/contentLogs/content-log.svelte | 4 ++--
.../[agentId]/[conversationId]/stateLogs/state-log.svelte | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lib/scss/custom/pages/_chat.scss b/src/lib/scss/custom/pages/_chat.scss
index 2bd516ec..799c9b35 100644
--- a/src/lib/scss/custom/pages/_chat.scss
+++ b/src/lib/scss/custom/pages/_chat.scss
@@ -353,7 +353,7 @@
flex: 2%;
}
- .log-content {
+ .log-body {
flex: 96%
}
diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
index 6f10c540..df7c6973 100644
--- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
@@ -875,7 +875,7 @@
{agent?.name}
- {currentUser?.user_name || ''}
+ {currentUser?.full_name || ''}
diff --git a/src/routes/chat/[agentId]/[conversationId]/contentLogs/content-log.svelte b/src/routes/chat/[agentId]/[conversationId]/contentLogs/content-log.svelte
index 5a9a9900..5ac0ed00 100644
--- a/src/routes/chat/[agentId]/[conversationId]/contentLogs/content-log.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/contentLogs/content-log.svelte
@@ -121,7 +121,7 @@
-
+
{#each contentLogs as log}
@@ -129,7 +129,7 @@
-
+
{#each agentQueueLogs as log}
diff --git a/src/routes/chat/[agentId]/[conversationId]/stateLogs/state-log.svelte b/src/routes/chat/[agentId]/[conversationId]/stateLogs/state-log.svelte
index d16f2a8c..0c462ff2 100644
--- a/src/routes/chat/[agentId]/[conversationId]/stateLogs/state-log.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/stateLogs/state-log.svelte
@@ -118,7 +118,7 @@
-
+
{#each convStateLogs as log}
@@ -126,7 +126,7 @@
-
+
{#each msgStateLogs as log}
From 947ab688ff006216284b66002aaa10b10e6fbda0 Mon Sep 17 00:00:00 2001
From: Jicheng Lu <103353@smsassist.com>
Date: Wed, 15 May 2024 11:23:44 -0500
Subject: [PATCH 2/2] add conv user
---
src/lib/services/api-endpoints.js | 1 +
src/lib/services/conversation-service.js | 11 +++++++++++
.../chat/[agentId]/[conversationId]/chat-box.svelte | 9 +++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/lib/services/api-endpoints.js b/src/lib/services/api-endpoints.js
index 6202bbc8..42375532 100644
--- a/src/lib/services/api-endpoints.js
+++ b/src/lib/services/api-endpoints.js
@@ -42,6 +42,7 @@ export const endpoints = {
conversationDeletionUrl: `${host}/conversation/{conversationId}`,
conversationDetailUrl: `${host}/conversation/{conversationId}`,
conversationAttachmentUrl: `${host}/conversation/{conversationId}/files/{messageId}`,
+ conversationUserUrl: `${host}/conversation/{conversationId}/user`,
dialogsUrl: `${host}/conversation/{conversationId}/dialogs`,
conversationMessageDeletionUrl: `${host}/conversation/{conversationId}/message/{messageId}`,
diff --git a/src/lib/services/conversation-service.js b/src/lib/services/conversation-service.js
index 63cdb86e..bf092310 100644
--- a/src/lib/services/conversation-service.js
+++ b/src/lib/services/conversation-service.js
@@ -26,6 +26,17 @@ export async function getConversation(id) {
return response.data;
}
+/**
+ * Get conversation user
+ * @param {string} id
+ * @returns {Promise}
+ */
+export async function getConversationUser(id) {
+ let url = replaceUrl(endpoints.conversationUserUrl, {conversationId: id});
+ const response = await axios.get(url);
+ return response.data;
+}
+
/**
* Get conversation list
* @param {import('$types').ConversationFilter} filter
diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
index df7c6973..654949c9 100644
--- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
+++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
@@ -15,7 +15,8 @@
sendMessageToHub,
GetDialogs,
deleteConversationMessage,
- getConversationFiles
+ getConversationFiles,
+ getConversationUser
} from '$lib/services/conversation-service.js';
import 'overlayscrollbars/overlayscrollbars.css';
import { OverlayScrollbars } from 'overlayscrollbars';
@@ -107,6 +108,9 @@
/** @type {import('$types').UserStateDetailModel[]} */
let userAddStates = [];
+ /** @type {import('$types').UserModel} */
+ let conversationUser;
+
/** @type {boolean} */
let isLoadContentLog = false;
let isLoadStateLog = false;
@@ -137,6 +141,7 @@
onMount(async () => {
autoScrollLog = true;
dialogs = await GetDialogs(params.conversationId);
+ conversationUser = await getConversationUser(params.conversationId);
initUserSentMessages(dialogs);
initChatView();
@@ -875,7 +880,7 @@
{agent?.name}
- {currentUser?.full_name || ''}
+ {conversationUser?.full_name || ''}