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

feat(speaking): record start work entry on fresh "开始对话" click

Injects recordSpeakingStart and fires it once inside startDialogue(),
right after the existing notifySpeakingProgress('active', ...) broadcast.
The resume path (loadLatestStudentSession) and completion path
(handleDialogueComplete) deliberately do NOT call it — idempotency is
enforced purely at the call site.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jimmylee 23 часов назад
Родитель
Сommit
1ecc645de2

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

@@ -112,6 +112,7 @@ type SpeakingNotify = (
   payload: { configId: string; sessionId: string },
 ) => void
 const notifySpeakingProgress = inject<SpeakingNotify>('notifySpeakingProgress', () => {})
+const recordSpeakingStart = inject<(sessionId: string) => void>('recordSpeakingStart', () => {})
 
 const speakingStore = useSpeakingStore()
 
@@ -334,6 +335,7 @@ async function startDialogue() {
       configId: props.configId || '',
       sessionId: preparedSession.value?.sessionId || '',
     })
+    recordSpeakingStart(preparedSession.value?.sessionId || '')
   } catch (err: unknown) {
     if (err instanceof DialogueApiError) {
       sessionError.value = `创建会话失败(${err.status}),请重试`