|
@ -11,6 +11,7 @@ import { useAppBridge } from "../assets/js/useAppBridge.js"; |
|
|
import { useDataStore } from "@/store/dataList.js"; |
|
|
import { useDataStore } from "@/store/dataList.js"; |
|
|
import { useChatStore } from "../store/chat"; |
|
|
import { useChatStore } from "../store/chat"; |
|
|
import { useEmotionAudioStore } from "../store/emotionAudio"; |
|
|
import { useEmotionAudioStore } from "../store/emotionAudio"; |
|
|
|
|
|
import { useAudioStore } from "../store/audio"; |
|
|
import _ from "lodash"; |
|
|
import _ from "lodash"; |
|
|
|
|
|
|
|
|
import logo from "../assets/img/homePage/logo.png"; |
|
|
import logo from "../assets/img/homePage/logo.png"; |
|
@ -44,19 +45,31 @@ const chatStore = useChatStore(); |
|
|
// 变量 |
|
|
// 变量 |
|
|
// 音频管理 |
|
|
// 音频管理 |
|
|
const emotionAudioStore = useEmotionAudioStore(); |
|
|
const emotionAudioStore = useEmotionAudioStore(); |
|
|
const isVoice = computed(() => emotionAudioStore.isVoiceEnabled); |
|
|
|
|
|
|
|
|
const audioStore = useAudioStore(); |
|
|
|
|
|
// 根据当前页面类型获取对应的音频store |
|
|
|
|
|
const getCurrentAudioStore = () => { |
|
|
|
|
|
return activeTab.value === 'AiEmotion' ? emotionAudioStore : audioStore; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const isVoice = computed(() => { |
|
|
|
|
|
const currentStore = getCurrentAudioStore(); |
|
|
|
|
|
return currentStore.isVoiceEnabled; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
const toggleVoice = () => { |
|
|
const toggleVoice = () => { |
|
|
if (!emotionAudioStore.isVoiceEnabled) { |
|
|
|
|
|
|
|
|
const currentStore = getCurrentAudioStore(); |
|
|
|
|
|
|
|
|
|
|
|
if (!currentStore.isVoiceEnabled) { |
|
|
// 如果语音功能关闭,先开启语音功能 |
|
|
// 如果语音功能关闭,先开启语音功能 |
|
|
emotionAudioStore.toggleVoice(); |
|
|
|
|
|
|
|
|
currentStore.toggleVoice(); |
|
|
} else { |
|
|
} else { |
|
|
// 如果语音功能开启,则切换播放/暂停状态 |
|
|
// 如果语音功能开启,则切换播放/暂停状态 |
|
|
if (emotionAudioStore.currentAudioUrl || emotionAudioStore.ttsUrl) { |
|
|
|
|
|
|
|
|
if (currentStore.currentAudioUrl || currentStore.ttsUrl) { |
|
|
// 有音频时切换播放/暂停 |
|
|
// 有音频时切换播放/暂停 |
|
|
emotionAudioStore.togglePlayPause(); |
|
|
|
|
|
|
|
|
currentStore.togglePlayPause(); |
|
|
} else { |
|
|
} else { |
|
|
// 没有音频时关闭语音功能 |
|
|
// 没有音频时关闭语音功能 |
|
|
emotionAudioStore.toggleVoice(); |
|
|
|
|
|
|
|
|
currentStore.toggleVoice(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
@ -605,8 +618,8 @@ onMounted(async () => { |
|
|
<!-- AI情绪大模型按钮 --> |
|
|
<!-- AI情绪大模型按钮 --> |
|
|
<img :src="activeTab === 'AiEmotion' ? emotionButton01 : emotionButton02 |
|
|
<img :src="activeTab === 'AiEmotion' ? emotionButton01 : emotionButton02 |
|
|
" @click="setActiveTab('AiEmotion', 1)" class="action-btn model-btn" alt="AI情绪大模型" /> |
|
|
" @click="setActiveTab('AiEmotion', 1)" class="action-btn model-btn" alt="AI情绪大模型" /> |
|
|
<img v-if="emotionAudioStore.isVoiceEnabled && !emotionAudioStore.isPlaying" :src="voice" @click="toggleVoice" class="action-btn" /> |
|
|
|
|
|
<img v-else-if="emotionAudioStore.isVoiceEnabled && emotionAudioStore.isPlaying" :src="voice" @click="toggleVoice" class="action-btn" style="opacity: 0.7; animation: pulse 1.5s infinite;" /> |
|
|
|
|
|
|
|
|
<img v-if="getCurrentAudioStore().isVoiceEnabled && !getCurrentAudioStore().isPlaying" :src="voice" @click="toggleVoice" class="action-btn" /> |
|
|
|
|
|
<img v-else-if="getCurrentAudioStore().isVoiceEnabled && getCurrentAudioStore().isPlaying" :src="voice" @click="toggleVoice" class="action-btn" style="opacity: 0.7; animation: pulse 1.5s infinite;" /> |
|
|
<img v-else :src="voiceNoActive" @click="toggleVoice" class="action-btn" /> |
|
|
<img v-else :src="voiceNoActive" @click="toggleVoice" class="action-btn" /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|