update:测试页面支持关闭情绪表情功能

This commit is contained in:
3030332422
2026-04-21 11:15:31 +08:00
parent dc2094ea8b
commit 96f0412f94
4 changed files with 29 additions and 6 deletions
+5 -4
View File
@@ -1002,10 +1002,11 @@ class ConnectionHandler:
# 在llm回复中获取情绪表情,一轮对话只在开头获取一次 # 在llm回复中获取情绪表情,一轮对话只在开头获取一次
if emotion_flag and content is not None and content.strip(): if emotion_flag and content is not None and content.strip():
asyncio.run_coroutine_threadsafe( if (self.features or {}).get("emoji", True):
textUtils.get_emotion(self, content), asyncio.run_coroutine_threadsafe(
self.loop, textUtils.get_emotion(self, content),
) self.loop,
)
emotion_flag = False emotion_flag = False
if content is not None and len(content) > 0: if content is not None and len(content) > 0:
+13 -1
View File
@@ -66,6 +66,12 @@ export function loadConfig() {
} else if (wakewordListInput) { } else if (wakewordListInput) {
wakewordListInput.value = DEFAULT_WAKE_WORDS; 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_deviceMac', deviceMacInput.value);
localStorage.setItem('xz_tester_deviceName', deviceNameInput.value); localStorage.setItem('xz_tester_deviceName', deviceNameInput.value);
localStorage.setItem('xz_tester_clientId', clientIdInput.value); localStorage.setItem('xz_tester_clientId', clientIdInput.value);
const emojiEnabledInput = document.getElementById('emojiEnabled');
if (emojiEnabledInput) {
localStorage.setItem('xz_tester_emojiEnabled', emojiEnabledInput.value);
}
if (wakewordEnabledInput) { if (wakewordEnabledInput) {
localStorage.setItem('xz_tester_wakewordEnabled', wakewordEnabledInput.value); localStorage.setItem('xz_tester_wakewordEnabled', wakewordEnabledInput.value);
} }
@@ -97,12 +107,14 @@ export function getConfig() {
const deviceMac = document.getElementById('deviceMac')?.value.trim() || ''; const deviceMac = document.getElementById('deviceMac')?.value.trim() || '';
const deviceName = document.getElementById('deviceName')?.value.trim() || ''; const deviceName = document.getElementById('deviceName')?.value.trim() || '';
const clientId = document.getElementById('clientId')?.value.trim() || ''; const clientId = document.getElementById('clientId')?.value.trim() || '';
const emojiEnabled = document.getElementById('emojiEnabled')?.value !== 'false';
return { return {
deviceId: deviceMac, // 使用MAC地址作为deviceId deviceId: deviceMac, // 使用MAC地址作为deviceId
deviceName, deviceName,
deviceMac, deviceMac,
clientId clientId,
emojiEnabled
}; };
} }
@@ -34,7 +34,8 @@ export class WebSocketHandler {
device_mac: config.deviceMac, device_mac: config.deviceMac,
token: config.token, token: config.token,
features: { features: {
mcp: true mcp: true,
emoji: config.emojiEnabled
} }
}; };
+9
View File
@@ -163,6 +163,15 @@
placeholder="deviceName"> placeholder="deviceName">
</div> </div>
</div> </div>
<div class="config-row">
<div class="config-item">
<label for="emojiEnabled">情绪表情:</label>
<select id="emojiEnabled" class="model-select">
<option value="true">启用</option>
<option value="false">禁用</option>
</select>
</div>
</div>
</div> </div>
</div> </div>