Просмотр исходного кода

docs: restore WS-finish comment, document blob-before-finish ordering

Task 4 dropped the existing "WS 失败不自动降级 HTTP" comment.
Restore it and add a sibling line explaining why
attachStudentBlob must run before ctl.finish().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jimmylee 2 недель назад
Родитель
Сommit
5dedcf11bb
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/views/Editor/EnglishSpeaking/preview/DialogueChatView.vue

+ 3 - 1
src/views/Editor/EnglishSpeaking/preview/DialogueChatView.vue

@@ -643,10 +643,12 @@ async function handleFinishRecording() {
     const blob = await recorder.stopRecording()
     recorder.onChunk.value = null
     if (ctl) {
+      // 走 WebSocket 流式路径。WS 失败时,不自动降级 HTTP —— 让错误泡泡的"重试"按钮走人工路径。
+      // attachStudentBlob 必须在 ctl.finish() 之前:服务端 done 事件回来前,blob 已经挂到学生消息上,replay 才能用。
       engine.attachStudentBlob(ctl.studentMsgId, blob)
       ctl.finish()
     } else {
-      // 没启动流式(异常情况)→ 直接走旧 HTTP 路径
+      // 没启动流式(异常情况)→ 直接走旧 HTTP 路径
       await engine.sendStudentMessage(blob)
     }
   } catch (err) {