From 93ab362b6f3c5f2e1e9cc1223e406b7b1426e983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Wed, 22 Jul 2026 21:01:56 +0800 Subject: [PATCH] Add files via upload --- web/static/js/chat.js | 4 ++++ web/static/js/roles.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/web/static/js/chat.js b/web/static/js/chat.js index 5948a767..fecd64dd 100644 --- a/web/static/js/chat.js +++ b/web/static/js/chat.js @@ -4532,6 +4532,10 @@ async function loadConversation(conversationId) { // 更新当前对话ID currentConversationId = conversationId; window._loadedConversationProjectId = conversation.projectId || conversation.project_id || ''; + const conversationRoleName = conversation.roleName || conversation.role_name || ''; + if (typeof window.setCurrentRole === 'function') { + window.setCurrentRole(conversationRoleName || '默认'); + } try { window.currentConversationId = conversationId; } catch (e) { /* ignore */ } diff --git a/web/static/js/roles.js b/web/static/js/roles.js index 79f7af16..31ae16b3 100644 --- a/web/static/js/roles.js +++ b/web/static/js/roles.js @@ -1892,6 +1892,7 @@ function getCurrentRole() { // 暴露函数到全局作用域 if (typeof window !== 'undefined') { window.getCurrentRole = getCurrentRole; + window.setCurrentRole = handleRoleChange; window.toggleRoleSelectionPanel = toggleRoleSelectionPanel; window.closeRoleSelectionPanel = closeRoleSelectionPanel; window.closeRoleSelectModal = closeRoleSelectModal; @@ -1905,6 +1906,7 @@ if (typeof window !== 'undefined') { originalHandleRoleChange(roleName); if (typeof window !== 'undefined') { window.currentSelectedRole = getCurrentRole(); + window.setCurrentRole = handleRoleChange; } }; }