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

feat(speaking): add videoScene config + VideoMeta + image SSE event types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jimmylee 1 месяц назад
Родитель
Сommit
29eec60210
2 измененных файлов с 25 добавлено и 0 удалено
  1. 10 0
      src/store/speaking.ts
  2. 15 0
      src/types/englishSpeaking.ts

+ 10 - 0
src/store/speaking.ts

@@ -40,6 +40,9 @@ const DEFAULT_CONFIG: TopicDiscussionConfig = {
     },
     scoreMode: 'letter',
   },
+  videoScene: {
+    enabled: false,
+  },
 }
 
 // 手动创建用:结构与 DEFAULT_CONFIG 完全一致,按需手动调整为空值
@@ -69,6 +72,9 @@ const EMPTY_CONFIG: TopicDiscussionConfig = {
     },
     scoreMode: 'letter',
   },
+  videoScene: {
+    enabled: false,
+  },
 }
 
 export const useSpeakingStore = defineStore('speaking', {
@@ -164,5 +170,9 @@ export const useSpeakingStore = defineStore('speaking', {
     updateScoreMode(scoreMode: ScoreMode) {
       this.config.evaluation.scoreMode = scoreMode
     },
+
+    toggleVideoScene() {
+      this.config.videoScene.enabled = !this.config.videoScene.enabled
+    },
   },
 })

+ 15 - 0
src/types/englishSpeaking.ts

@@ -47,6 +47,14 @@ export interface LearningGoals {
   sentences: string[]
 }
 
+// 视频场景元数据
+export interface VideoMeta {
+  id: string
+  title: string
+  videoUrl: string
+  description: string
+}
+
 // 话题讨论配置
 export interface TopicDiscussionConfig {
   topic: string
@@ -55,6 +63,9 @@ export interface TopicDiscussionConfig {
   learningGoals: LearningGoals
   practice: PracticeSettings
   evaluation: EvaluationSettings
+  videoScene: {
+    enabled: boolean
+  }
 }
 
 // 推荐任务卡片
@@ -222,6 +233,7 @@ export interface PreviewChatMessage {
   audioBlob?: Blob
   audioUrl?: string
   audioDuration?: number   // NEW: 秒,由后端 transcript 事件 / sessions-latest 写入
+  imageUrl?: string
   evaluation?: {
     dimensions: {
       accuracy: 'excellent' | 'good' | 'improve'
@@ -250,6 +262,7 @@ export type SSEEvent =
   | { type: 'token'; text: string }
   | { type: 'done'; isComplete: boolean }
   | { type: 'error'; message: string }
+  | { type: 'image'; url: string; round?: number }
 
 // 对话会话配置
 export interface SessionConfig {
@@ -263,6 +276,8 @@ export interface SessionConfig {
   sentences?: string[]
   configId?: string | null
   userId?: string | null
+  mode?: 'normal' | 'video_scene'
+  selectedVideo?: VideoMeta
 }
 
 // 对话会话信息 (createSession 返回)