From e990fe65d866e398d5e202ea17e889e279b77520 Mon Sep 17 00:00:00 2001 From: Josako Date: Tue, 22 Jul 2025 21:27:39 +0200 Subject: [PATCH] - eveai_chat_client update to have different ways of presenting ProgressTracker.vue. Based on progress_tracker_insights in Tenant Make Configuration. --- common/utils/chat_utils.py | 1 + .../CHAT_CLIENT_CUSTOMISATION/1.0.0.yaml | 7 ++ .../assets/vue-components/ChatMessage.vue | 5 ++ .../assets/vue-components/MessageHistory.vue | 20 ++++++ .../assets/vue-components/ProgressTracker.vue | 68 ++++++++++++++++++- eveai_chat_client/templates/chat.html | 1 + eveai_chat_client/views/chat_views.py | 1 + 7 files changed, 102 insertions(+), 1 deletion(-) diff --git a/common/utils/chat_utils.py b/common/utils/chat_utils.py index f7e334c..e881e40 100644 --- a/common/utils/chat_utils.py +++ b/common/utils/chat_utils.py @@ -31,6 +31,7 @@ def get_default_chat_customisation(tenant_customisation=None): 'markdown_background_color': 'transparent', 'markdown_text_color': '#ffffff', 'sidebar_markdown': '', + 'progress_tracker_insights': 'No Information' } # If no tenant customization is provided, return the defaults diff --git a/config/customisations/globals/CHAT_CLIENT_CUSTOMISATION/1.0.0.yaml b/config/customisations/globals/CHAT_CLIENT_CUSTOMISATION/1.0.0.yaml index 4193b6b..2e1da15 100644 --- a/config/customisations/globals/CHAT_CLIENT_CUSTOMISATION/1.0.0.yaml +++ b/config/customisations/globals/CHAT_CLIENT_CUSTOMISATION/1.0.0.yaml @@ -6,6 +6,13 @@ configuration: description: "Sidebar Markdown-formatted Text" type: "text" required: false + "progress_tracker_insights": + name: "Progress Tracker Insights" + description: "Level of information shown by the Progress Tracker" + type: "enum" + allowed_values: ["No Information", "Active Interaction Only", "All Interactions"] + default: "No Information" + required: true "primary_color": name: "Primary Color" description: "Primary Color" diff --git a/eveai_chat_client/static/assets/vue-components/ChatMessage.vue b/eveai_chat_client/static/assets/vue-components/ChatMessage.vue index e08d838..c390023 100644 --- a/eveai_chat_client/static/assets/vue-components/ChatMessage.vue +++ b/eveai_chat_client/static/assets/vue-components/ChatMessage.vue @@ -8,6 +8,7 @@ v-if="message.sender === 'ai' && message.taskId" :task-id="message.taskId" :api-prefix="apiPrefix" + :is-latest-ai-message="isLatestAiMessage" class="message-progress" @specialist-complete="handleSpecialistComplete" @specialist-error="handleSpecialistError" @@ -165,6 +166,10 @@ export default { apiPrefix: { type: String, default: '' + }, + isLatestAiMessage: { + type: Boolean, + default: false } }, emits: ['image-loaded', 'retry-message', 'specialist-complete', 'specialist-error'], diff --git a/eveai_chat_client/static/assets/vue-components/MessageHistory.vue b/eveai_chat_client/static/assets/vue-components/MessageHistory.vue index ee570b8..6771aae 100644 --- a/eveai_chat_client/static/assets/vue-components/MessageHistory.vue +++ b/eveai_chat_client/static/assets/vue-components/MessageHistory.vue @@ -23,6 +23,7 @@ :message="message" :is-submitting-form="isSubmittingForm" :api-prefix="apiPrefix" + :is-latest-ai-message="isLatestAiMessage(message)" @image-loaded="handleImageLoaded" @specialist-complete="$emit('specialist-complete', $event)" @specialist-error="$emit('specialist-error', $event)" @@ -228,6 +229,25 @@ export default { message.content && message.content.toLowerCase().includes(searchTerm) ); + }, + + isLatestAiMessage(message) { + // Only AI messages with taskId can be "latest" + if (message.sender !== 'ai' || !message.taskId) { + return false; + } + + // Find the latest AI message with a taskId by iterating in reverse order + // The latest AI message is the one where the specialist interaction is still active + for (let i = this.messages.length - 1; i >= 0; i--) { + const msg = this.messages[i]; + if (msg.sender === 'ai' && msg.taskId) { + // This is the latest AI message with a taskId + return msg.id === message.id; + } + } + + return false; } } }; diff --git a/eveai_chat_client/static/assets/vue-components/ProgressTracker.vue b/eveai_chat_client/static/assets/vue-components/ProgressTracker.vue index 5188b3e..e602984 100644 --- a/eveai_chat_client/static/assets/vue-components/ProgressTracker.vue +++ b/eveai_chat_client/static/assets/vue-components/ProgressTracker.vue @@ -1,5 +1,6 @@