Browse Source

解决了情绪大模型文本输出时切换页面造成输入框状态错误的问题。

songjie/feature-20250628160649-上线前优化
宋杰 1 day ago
parent
commit
a23125300f
  1. 28
      src/views/AiEmotion.vue
  2. 4
      src/views/homePage.vue

28
src/views/AiEmotion.vue

@ -290,6 +290,8 @@ const typewriterTimers = ref([]);
const stockTypewriterShown = ref(new Map()); const stockTypewriterShown = ref(new Map());
// //
const stockAudioPlayed = ref(new Map()); const stockAudioPlayed = ref(new Map());
//
const currentOnCompleteCallback = ref(null);
// //
const audioUrl = ref(''); const audioUrl = ref('');
@ -650,6 +652,9 @@ watch(parsedConclusion, (newConclusion) => {
function startTypewriterEffect(conclusion, onComplete) { function startTypewriterEffect(conclusion, onComplete) {
console.log('开始打字机效果,结论数据:', conclusion); console.log('开始打字机效果,结论数据:', conclusion);
//
currentOnCompleteCallback.value = onComplete;
// //
console.log('L1字段 - one1:', conclusion.one1); console.log('L1字段 - one1:', conclusion.one1);
console.log('L1字段 - one2:', conclusion.one2); console.log('L1字段 - one2:', conclusion.one2);
@ -787,6 +792,8 @@ function startTypewriterEffect(conclusion, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
}, 100); }, 100);
} }
@ -914,6 +921,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
return; return;
} }
@ -936,6 +945,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
return; return;
} }
@ -957,6 +968,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
return; return;
} }
@ -996,6 +1009,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
return; return;
} }
@ -1066,6 +1081,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
} }
} }
@ -1084,6 +1101,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
return; return;
} }
@ -1096,6 +1115,8 @@ async function handleSendMessage(input, onComplete) {
// //
if (onComplete && typeof onComplete === 'function') { if (onComplete && typeof onComplete === 'function') {
onComplete(); onComplete();
//
currentOnCompleteCallback.value = null;
} }
return; return;
} finally { } finally {
@ -1653,6 +1674,13 @@ onMounted(async () => {
// observer // observer
onUnmounted(() => { onUnmounted(() => {
clearTypewriterTimers(); clearTypewriterTimers();
//
if (currentOnCompleteCallback.value && typeof currentOnCompleteCallback.value === 'function') {
currentOnCompleteCallback.value();
currentOnCompleteCallback.value = null;
}
stopAudio(); stopAudio();
// //

4
src/views/homePage.vue

@ -98,6 +98,10 @@ const tabs = computed(() => [
const setActiveTab = (tab, index, forceAIchat = false) => { const setActiveTab = (tab, index, forceAIchat = false) => {
isScrolling.value = false; // isScrolling.value = false; //
isAnnouncementVisible.value = false; isAnnouncementVisible.value = false;
//
isInputDisabled.value = false;
if (forceAIchat && activeTab.value !== "AIchat") { if (forceAIchat && activeTab.value !== "AIchat") {
activeTab.value = "AIchat"; activeTab.value = "AIchat";
activeIndex.value = 0; activeIndex.value = 0;

Loading…
Cancel
Save