diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index d167bf1b..663def53 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -1002,10 +1002,11 @@ class ConnectionHandler: # 在llm回复中获取情绪表情,一轮对话只在开头获取一次 if emotion_flag and content is not None and content.strip(): - asyncio.run_coroutine_threadsafe( - textUtils.get_emotion(self, content), - self.loop, - ) + if (self.features or {}).get("emoji", True): + asyncio.run_coroutine_threadsafe( + textUtils.get_emotion(self, content), + self.loop, + ) emotion_flag = False if content is not None and len(content) > 0: diff --git a/main/xiaozhi-server/test/js/config/manager.js b/main/xiaozhi-server/test/js/config/manager.js index 836f5d24..50a0c18a 100644 --- a/main/xiaozhi-server/test/js/config/manager.js +++ b/main/xiaozhi-server/test/js/config/manager.js @@ -66,6 +66,12 @@ export function loadConfig() { } else if (wakewordListInput) { wakewordListInput.value = DEFAULT_WAKE_WORDS; } + + const emojiEnabledInput = document.getElementById('emojiEnabled'); + const savedEmojiEnabled = localStorage.getItem('xz_tester_emojiEnabled'); + if (savedEmojiEnabled !== null && emojiEnabledInput) { + emojiEnabledInput.value = savedEmojiEnabled; + } } // 保存配置 @@ -80,6 +86,10 @@ export function saveConfig() { localStorage.setItem('xz_tester_deviceMac', deviceMacInput.value); localStorage.setItem('xz_tester_deviceName', deviceNameInput.value); localStorage.setItem('xz_tester_clientId', clientIdInput.value); + const emojiEnabledInput = document.getElementById('emojiEnabled'); + if (emojiEnabledInput) { + localStorage.setItem('xz_tester_emojiEnabled', emojiEnabledInput.value); + } if (wakewordEnabledInput) { localStorage.setItem('xz_tester_wakewordEnabled', wakewordEnabledInput.value); } @@ -97,12 +107,14 @@ export function getConfig() { const deviceMac = document.getElementById('deviceMac')?.value.trim() || ''; const deviceName = document.getElementById('deviceName')?.value.trim() || ''; const clientId = document.getElementById('clientId')?.value.trim() || ''; + const emojiEnabled = document.getElementById('emojiEnabled')?.value !== 'false'; return { deviceId: deviceMac, // 使用MAC地址作为deviceId deviceName, deviceMac, - clientId + clientId, + emojiEnabled }; } diff --git a/main/xiaozhi-server/test/js/core/network/websocket.js b/main/xiaozhi-server/test/js/core/network/websocket.js index 468651fd..ee7238c1 100644 --- a/main/xiaozhi-server/test/js/core/network/websocket.js +++ b/main/xiaozhi-server/test/js/core/network/websocket.js @@ -34,7 +34,8 @@ export class WebSocketHandler { device_mac: config.deviceMac, token: config.token, features: { - mcp: true + mcp: true, + emoji: config.emojiEnabled } }; diff --git a/main/xiaozhi-server/test/test_page.html b/main/xiaozhi-server/test/test_page.html index 906d7b2e..bf9ae753 100644 --- a/main/xiaozhi-server/test/test_page.html +++ b/main/xiaozhi-server/test/test_page.html @@ -163,6 +163,15 @@ placeholder="deviceName"> +
+
+ + +
+