diff --git a/packages/client/src/components/hermes/chat/ChatInput.vue b/packages/client/src/components/hermes/chat/ChatInput.vue index fa27785..4a020bc 100644 --- a/packages/client/src/components/hermes/chat/ChatInput.vue +++ b/packages/client/src/components/hermes/chat/ChatInput.vue @@ -4,7 +4,7 @@ import { useChatStore } from '@/stores/hermes/chat' import { useAppStore } from '@/stores/hermes/app' import { useProfilesStore } from '@/stores/hermes/profiles' import { fetchContextLength } from '@/api/hermes/sessions' -import { NButton, NTooltip } from 'naive-ui' +import { NButton, NTooltip, NSwitch } from 'naive-ui' import { computed, ref, onMounted, watch } from 'vue' import { useI18n } from 'vue-i18n' @@ -18,6 +18,26 @@ const isDragging = ref(false) const dragCounter = ref(0) const isComposing = ref(false) +// 自动播放语音开关 +const autoPlaySpeech = ref(false) + +// 从 localStorage 读取设置 +onMounted(() => { + const saved = localStorage.getItem('autoPlaySpeech') + if (saved !== null) { + autoPlaySpeech.value = saved === 'true' + // 同步到 chat store + chatStore.setAutoPlaySpeech(autoPlaySpeech.value) + } +}) + +// 监听变化并保存 +watch(autoPlaySpeech, (value) => { + localStorage.setItem('autoPlaySpeech', String(value)) + // 通知 chat store + chatStore.setAutoPlaySpeech(value) +}) + const canSend = computed(() => inputText.value.trim() || attachments.value.length > 0) // --- Context info --- @@ -195,7 +215,7 @@ function isImage(type: string): boolean {