From 848b48b49096b2bf66059a2e629d655c754d7d1a Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Tue, 2 Dec 2025 14:12:24 +0800 Subject: [PATCH] fix: After modifying the dialogue prefix, the embedded page cannot have a conversation (#4411) --- apps/chat/serializers/chat_embed_serializers.py | 1 + apps/chat/template/embed.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/chat/serializers/chat_embed_serializers.py b/apps/chat/serializers/chat_embed_serializers.py index a3f25af7f..7f330f93e 100644 --- a/apps/chat/serializers/chat_embed_serializers.py +++ b/apps/chat/serializers/chat_embed_serializers.py @@ -75,6 +75,7 @@ class ChatEmbedSerializer(serializers.Serializer): 'white_active': 'true' if application_access_token.white_active else 'false', 'is_draggable': is_draggable, 'float_icon': float_icon, + 'prefix': CONFIG.get_chat_path(), 'query': query, 'show_guide': show_guide, 'x_type': float_location.get('x', {}).get('type', 'right'), diff --git a/apps/chat/template/embed.js b/apps/chat/template/embed.js index 3336ed4c3..de8d872ca 100644 --- a/apps/chat/template/embed.js +++ b/apps/chat/template/embed.js @@ -26,9 +26,9 @@ const chatButtonHtml= -const getChatContainerHtml=(protocol,host,token,query)=>{ +const getChatContainerHtml=(protocol,host,token,query,prefix)=>{ return `
- +
@@ -62,7 +62,7 @@ const initChat=(root)=>{ // 添加对话icon root.insertAdjacentHTML("beforeend",chatButtonHtml) // 添加对话框 - root.insertAdjacentHTML('beforeend',getChatContainerHtml('{{protocol}}','{{host}}','{{token}}','{{query}}')) + root.insertAdjacentHTML('beforeend',getChatContainerHtml('{{protocol}}','{{host}}','{{token}}','{{query}}','{{prefix}}')) // 按钮元素 const chat_button=root.querySelector('.maxkb-chat-button') const chat_button_img=root.querySelector('.maxkb-chat-button > img')