From 01520ad44e1a6e56df99833500e8f5dc65826594 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Thu, 22 Feb 2024 11:24:09 -0600 Subject: [PATCH] add content log source --- src/lib/helpers/enums.js | 12 +++++++++--- src/lib/helpers/types.js | 1 + src/lib/scss/custom/pages/_chat.scss | 1 + .../[conversationId]/chat-box.svelte | 2 +- .../contentLogs/content-log-element.svelte | 19 +++++++++++-------- .../[conversationId]/conv-dialogs.svelte | 6 +++--- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/lib/helpers/enums.js b/src/lib/helpers/enums.js index b9c8d69c..1ac7f563 100644 --- a/src/lib/helpers/enums.js +++ b/src/lib/helpers/enums.js @@ -1,11 +1,11 @@ const userRole = { System: "system", + Admin: "admin", User: "user", Client: "client", Function: "function", Assistant: "assistant" }; - export const UserRole = Object.freeze(userRole); const senderAction = { @@ -13,7 +13,6 @@ const senderAction = { TypingOff: 2, MarkSeen: 3 } - export const SenderAction = Object.freeze(senderAction); const richType = { @@ -22,5 +21,12 @@ const richType = { Button: 'button_template', MultiSelect: 'multi-select_template' } +export const RichType = Object.freeze(richType); -export const RichType = Object.freeze(richType); \ No newline at end of file +const contentLogSource = { + UserInput: "user input", + Prompt: "prompt", + FunctionCall: "function call", + AgentResponse: "agent response" +}; +export const ContentLogSource = Object.freeze(contentLogSource); \ No newline at end of file diff --git a/src/lib/helpers/types.js b/src/lib/helpers/types.js index 82df5f20..56ee789b 100644 --- a/src/lib/helpers/types.js +++ b/src/lib/helpers/types.js @@ -264,6 +264,7 @@ IRichContent.prototype.text; * @property {string} conversation_id - The conversation id. * @property {string} name - The sender name. * @property {string} role - The sender role. + * @property {string} source - The log source. * @property {string} content - The log content. * @property {Date} created_at - The log sent time. */ diff --git a/src/lib/scss/custom/pages/_chat.scss b/src/lib/scss/custom/pages/_chat.scss index 9a1ec739..f0ce33e0 100644 --- a/src/lib/scss/custom/pages/_chat.scss +++ b/src/lib/scss/custom/pages/_chat.scss @@ -277,6 +277,7 @@ .chat-input-section { border-top: 1px solid var(--#{$prefix}border-color); + padding: 2vmin 2% 2vmin 2%; } .chat-input { diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte index e8746152..d5324222 100644 --- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte +++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte @@ -630,7 +630,7 @@ -
+

-
+
{@html replaceNewLine(data?.content)}
- {#if !excludedRoles.includes(data.role)} + {#if !excludedSources.includes(data.source)} diff --git a/src/routes/page/conversation/[conversationId]/conv-dialogs.svelte b/src/routes/page/conversation/[conversationId]/conv-dialogs.svelte index 4eb90ff0..f6f3a6c3 100644 --- a/src/routes/page/conversation/[conversationId]/conv-dialogs.svelte +++ b/src/routes/page/conversation/[conversationId]/conv-dialogs.svelte @@ -1,7 +1,7 @@ @@ -47,7 +47,7 @@
{dialog.sender.full_name}

{dialog.text}

- {format(dialog.created_at, 'long-time')} + {utcToLocal(dialog.created_at)}