Forráskód Böngészése

【优化】Chat 字体滚动,如果stream结束,开始加速

cherishsince 1 éve
szülő
commit
a3c5d253b3
1 módosított fájl, 6 hozzáadás és 1 törlés
  1. 6 1
      src/views/ai/chat/index.vue

+ 6 - 1
src/views/ai/chat/index.vue

@@ -124,8 +124,9 @@ const textRoll = async () => {
     if (textRoleRunning.value) {
       return
     }
+    // 设置状态
     textRoleRunning.value = true
-
+    displayedText.value = ''
     const task = async () => {
       // 调整速度
       const diff = (fullText.value.length - displayedText.value.length) / 10
@@ -138,6 +139,10 @@ const textRoll = async () => {
       } else {
         textSpeed.value = 100
       }
+      // 对话结束,就按30的速度
+      if (!conversationInProgress.value) {
+        textSpeed.value = 30
+      }
 
       console.log(`diff ${diff} 速度 ${textSpeed.value} `)
       // console.log('index < fullText.value.length', index < fullText.value.length, conversationInProgress.value)