Browse Source

Merge branch 'songjie/feature-20250628160649-上线前优化' into milestone-20250710-上线前优化

dev
宋杰 2 days ago
parent
commit
d398e6ac10
  1. 52
      src/views/AiEmotion.vue
  2. 2
      src/views/components/emoEnergyConverter.vue

52
src/views/AiEmotion.vue

@ -1664,6 +1664,13 @@ const playNextAudio = () => {
emotionAudioStore.nowSound = null; emotionAudioStore.nowSound = null;
isCallingPlayNext = false; isCallingPlayNext = false;
//
const currentStock = emotionStore.activeStock;
if (currentStock) {
console.log('所有音频播放完成,重置当前股票音频状态:', currentStock.stockInfo?.name);
setStockAudioState(currentStock, { isPlaying: false, isPaused: false });
}
// //
if ( if (
audioInfo.onComplete && audioInfo.onComplete &&
@ -1681,6 +1688,13 @@ const playNextAudio = () => {
emotionAudioStore.playbackPosition = 0; emotionAudioStore.playbackPosition = 0;
isAudioPlaying.value = false; isAudioPlaying.value = false;
isPlayingQueueAudio.value = false; isPlayingQueueAudio.value = false;
//
const currentStock = emotionStore.activeStock;
if (currentStock) {
console.log('音频被停止,重置当前股票音频状态:', currentStock.stockInfo?.name);
setStockAudioState(currentStock, { isPlaying: false, isPaused: false });
}
}, },
onerror: (error) => { onerror: (error) => {
console.error(`${audioInfo.name}音频播放失败:`, error); console.error(`${audioInfo.name}音频播放失败:`, error);
@ -1844,6 +1858,13 @@ function playAudioQueue(
} }
} else { } else {
console.log(`总共找到 ${audioQueue.value.length} 个音频,准备播放`); console.log(`总共找到 ${audioQueue.value.length} 个音频,准备播放`);
//
const currentStock = emotionStore.activeStock;
if (currentStock) {
console.log('设置当前股票音频状态为播放中:', currentStock.stockInfo?.name);
setStockAudioState(currentStock, { isPlaying: true, isPaused: false });
}
} }
} catch (error) { } catch (error) {
console.error("处理音频播放失败:", error); console.error("处理音频播放失败:", error);
@ -2151,16 +2172,17 @@ async function handleSendMessage(input, onComplete) {
// refuse // refuse
// isLoading.value = false; // isLoading.value = false;
isPageLoaded.value = false; isPageLoaded.value = false;
const refuseMessage = response && response.msg ? response.msg : "接口返回数据异常,请重试";
const aiMessage = reactive({ const aiMessage = reactive({
sender: "ai", sender: "ai",
text: processRefuseMessage(parsedData.refuse),
text: processRefuseMessage(refuseMessage),
}); });
messages.value.push(aiMessage); messages.value.push(aiMessage);
// AIemotion store // AIemotion store
emotionStore.addConversation({ emotionStore.addConversation({
sender: "ai", sender: "ai",
text: processRefuseMessage(parsedData.refuse),
text: processRefuseMessage(refuseMessage),
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}); });
isRotating.value = false; isRotating.value = false;
@ -2372,18 +2394,6 @@ async function handleSendMessage(input, onComplete) {
isPageLoaded.value = false; isPageLoaded.value = false;
} }
const aiMessage = reactive({
sender: "ai",
text: "请求工作流接口失败,请检查网络连接",
});
messages.value.push(aiMessage);
// AIemotion store
emotionStore.addConversation({
sender: "ai",
text: "请求工作流接口失败,请检查网络连接",
timestamp: new Date().toISOString(),
});
// //
isRotating.value = false; isRotating.value = false;
messages.value = [...previousMessages, ...messages.value]; messages.value = [...previousMessages, ...messages.value];
@ -4284,7 +4294,7 @@ const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat"]);
text-align: left; text-align: left;
margin-right: auto; margin-right: auto;
/* 将AI消息保持在左边 */ /* 将AI消息保持在左边 */
white-space: nowrap;
/* white-space: nowrap; */
width: fit-content; width: fit-content;
overflow: visible; overflow: visible;
align-items: center; align-items: center;
@ -4539,16 +4549,16 @@ const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat"]);
height: auto; height: auto;
} }
.main {
/* .main {
min-height: 100px; min-height: 100px;
height: auto; height: auto;
box-sizing: border-box; box-sizing: border-box;
background-color: #02107d; background-color: #02107d;
margin-bottom: 10rem; margin-bottom: 10rem;
}
} */
.emotion-decoder-section { .emotion-decoder-section {
width: 80%;
width: 80vw;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
/* min-height: 38rem; */ /* min-height: 38rem; */
@ -4730,7 +4740,7 @@ const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat"]);
.bottom-radar-section { .bottom-radar-section {
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
width: 80%;
width: 80vw;
height: auto; height: auto;
/* min-height: 48rem; */ /* min-height: 48rem; */
} }
@ -4738,7 +4748,7 @@ const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat"]);
.energy-converter-section { .energy-converter-section {
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
width: 80%;
width: 80vw;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
min-height: 55vh; min-height: 55vh;
@ -4808,7 +4818,7 @@ const emit = defineEmits(["updateMessage", "sendMessage", "ensureAIchat"]);
/* 超小屏幕设备 */ /* 超小屏幕设备 */
@media only screen and (max-width: 480px) { @media only screen and (max-width: 480px) {
.main { .main {
width: 100%;
width: 90%;
padding: 0.3rem; padding: 0.3rem;
margin-bottom: 3rem; margin-bottom: 3rem;
} }

2
src/views/components/emoEnergyConverter.vue

@ -152,7 +152,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
max: qxnlzhqData.js, max: qxnlzhqData.js,
name: "【情绪临界区】", name: "【情绪临界区】",
color: "#FFC0AA", color: "#FFC0AA",
fontColor: 'white',
fontColor: '#2D2D89',
NumberColor: 'white', NumberColor: 'white',
}, },
]; ];

Loading…
Cancel
Save