فهرست منبع

refactor(speaking): Task 6 code review 微调

- totalRounds 回退从 || 改为 ??,保留 0 作为合法值(比如未来"无限轮数")
- roleId 硬编码 'tom' 改为 mockRole.id,消除两个字面量的漂移风险
- 为 createDialogueApi 每次新建实例补一行注释(MockDialogueAPI 靠
  createSession 重置 roundIndex,重试时需要新实例)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jimmylee 2 هفته پیش
والد
کامیت
d78bbf6b80
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      src/views/Editor/EnglishSpeaking/preview/TopicDiscussionPreview.vue

+ 3 - 2
src/views/Editor/EnglishSpeaking/preview/TopicDiscussionPreview.vue

@@ -208,11 +208,12 @@ async function startDialogue() {
   sessionCreating.value = true
   sessionError.value = null
   try {
+    // Fresh instance per attempt; MockDialogueAPI resets roundIndex in createSession.
     const api = createDialogueApi(props.mode)
     const info = await api.createSession({
       topic: speakingStore.config.topic || props.topic,
-      totalRounds: speakingStore.config.practice.rounds || props.totalRounds,
-      roleId: 'tom',
+      totalRounds: speakingStore.config.practice.rounds ?? props.totalRounds,
+      roleId: mockRole.id,
       vocabulary: speakingStore.config.learningGoals.vocabulary,
     })
     preparedSession.value = {