From 45a80118cc48e45b2943e09c67d5daaaf0fc535e Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Thu, 26 Feb 2026 00:35:49 +0530 Subject: [PATCH] Fix CSAT responses not visible agent message bubble - Fix csat form submission in widget - Update vite config to allow cross origin requests --- .../message/CSATResponseDisplay.vue | 80 ++++++++++--------- .../conversation/message/MessageBubble.vue | 8 ++ frontend/vite.config.js | 7 ++ internal/conversation/conversation.go | 3 +- 4 files changed, 61 insertions(+), 37 deletions(-) diff --git a/frontend/apps/main/src/features/conversation/message/CSATResponseDisplay.vue b/frontend/apps/main/src/features/conversation/message/CSATResponseDisplay.vue index e5467504..8f526c80 100644 --- a/frontend/apps/main/src/features/conversation/message/CSATResponseDisplay.vue +++ b/frontend/apps/main/src/features/conversation/message/CSATResponseDisplay.vue @@ -1,25 +1,36 @@ diff --git a/frontend/apps/main/src/features/conversation/message/MessageBubble.vue b/frontend/apps/main/src/features/conversation/message/MessageBubble.vue index a51b9f25..be5dc289 100644 --- a/frontend/apps/main/src/features/conversation/message/MessageBubble.vue +++ b/frontend/apps/main/src/features/conversation/message/MessageBubble.vue @@ -73,6 +73,9 @@ + + + @@ -129,6 +132,7 @@ import { Avatar, AvatarFallback, AvatarImage } from '@shared-ui/components/ui/av import { Letter } from 'vue-letter' import MessageAttachmentPreview from '@main/features/conversation/message/attachment/MessageAttachmentPreview.vue' import MessageEnvelope from './MessageEnvelope.vue' +import CSATResponseDisplay from './CSATResponseDisplay.vue' import api from '@main/api' const props = defineProps({ @@ -165,6 +169,10 @@ const avatarFallback = computed(() => { // Content sanitization - different processing for incoming vs outgoing const sanitizedContent = computed(() => { + if (props.message.meta?.is_csat) { + return t('globals.messages.pleaseRateConversation') + } + let content = props.message.content || '' if (isOutgoing.value) { diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 5f83a98c..ae239e74 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -32,6 +32,7 @@ export default defineConfig(({ mode }) => { // Separate cache per app to avoid stale/conflicting caches. cacheDir: path.resolve(__dirname, `node_modules/.vite-${isWidget ? 'widget' : 'main'}`), server: { + cors: { origin: "*" }, // Allow access to parent dir so shared-ui imports work in dev. fs: { allow: [path.resolve(__dirname)], @@ -40,23 +41,29 @@ export default defineConfig(({ mode }) => { proxy: { '/api': { target: 'http://127.0.0.1:9000', + changeOrigin: true, }, '/widget.js': { target: 'http://127.0.0.1:9000', + changeOrigin: true, }, '/logout': { target: 'http://127.0.0.1:9000', + changeOrigin: true, }, '/uploads': { target: 'http://127.0.0.1:9000', + changeOrigin: true, }, '/ws': { target: 'ws://127.0.0.1:9000', ws: true, + changeOrigin: true, }, '/widget/ws': { target: 'ws://127.0.0.1:9000', ws: true, + changeOrigin: true, } }, }, diff --git a/internal/conversation/conversation.go b/internal/conversation/conversation.go index 951b9c16..4863e45e 100644 --- a/internal/conversation/conversation.go +++ b/internal/conversation/conversation.go @@ -1326,7 +1326,8 @@ func (m *Manager) SendCSATReply(actorUserID int, conversation models.Conversatio message := fmt.Sprintf(csatReplyMessage, csatPublicURL) // Store `is_csat` meta to identify and filter CSAT public url from the message. meta := map[string]interface{}{ - "is_csat": true, + "is_csat": true, + "csat_uuid": csat.UUID, } // Make recipient list.