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

feat(speaking): add per-mode prompt/greeting slots + hydrateDefaults action

jimmylee 1 месяц назад
Родитель
Сommit
a157e05f74
1 измененных файлов с 31 добавлено и 0 удалено
  1. 31 0
      src/store/speaking.ts

+ 31 - 0
src/store/speaking.ts

@@ -42,6 +42,12 @@ const DEFAULT_CONFIG: TopicDiscussionConfig = {
   },
   },
   videoScene: {
   videoScene: {
     enabled: false,
     enabled: false,
+    systemPrompt: '',
+    greeting: '',
+  },
+  nonVideoScene: {
+    systemPrompt: '',
+    greeting: '',
   },
   },
 }
 }
 
 
@@ -74,6 +80,12 @@ const EMPTY_CONFIG: TopicDiscussionConfig = {
   },
   },
   videoScene: {
   videoScene: {
     enabled: false,
     enabled: false,
+    systemPrompt: '',
+    greeting: '',
+  },
+  nonVideoScene: {
+    systemPrompt: '',
+    greeting: '',
   },
   },
 }
 }
 
 
@@ -174,5 +186,24 @@ export const useSpeakingStore = defineStore('speaking', {
     toggleVideoScene() {
     toggleVideoScene() {
       this.config.videoScene.enabled = !this.config.videoScene.enabled
       this.config.videoScene.enabled = !this.config.videoScene.enabled
     },
     },
+
+    hydrateDefaults(payload: {
+      videoScene: { systemPrompt: string; greeting: string }
+      nonVideoScene: { systemPrompt: string; greeting: string }
+    }) {
+      // Fill only empty slots — preserve any teacher edits already present.
+      if (!this.config.videoScene.systemPrompt) {
+        this.config.videoScene.systemPrompt = payload.videoScene.systemPrompt
+      }
+      if (!this.config.videoScene.greeting) {
+        this.config.videoScene.greeting = payload.videoScene.greeting
+      }
+      if (!this.config.nonVideoScene.systemPrompt) {
+        this.config.nonVideoScene.systemPrompt = payload.nonVideoScene.systemPrompt
+      }
+      if (!this.config.nonVideoScene.greeting) {
+        this.config.nonVideoScene.greeting = payload.nonVideoScene.greeting
+      }
+    },
   },
   },
 })
 })