|
@@ -100,8 +100,17 @@ import {
|
|
|
} from "@/api/questions.js";
|
|
} from "@/api/questions.js";
|
|
|
import {Message} from "@/utils/message/Message.js";
|
|
import {Message} from "@/utils/message/Message.js";
|
|
|
|
|
|
|
|
|
|
+// 定义props
|
|
|
|
|
+const props = defineProps({
|
|
|
|
|
+ // 数字人列表
|
|
|
|
|
+ scriptRoles: {
|
|
|
|
|
+ type: Array,
|
|
|
|
|
+ default: () => []
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
// 发送消息输入框
|
|
// 发送消息输入框
|
|
|
-const prompt = ref("给我一首李白的静夜思"); // prompt
|
|
|
|
|
|
|
+const prompt = ref(""); // prompt
|
|
|
|
|
|
|
|
// 对话相关
|
|
// 对话相关
|
|
|
const activeConversationId = ref(null) // 选中的对话编号
|
|
const activeConversationId = ref(null) // 选中的对话编号
|
|
@@ -129,11 +138,6 @@ const lessonList = ref([
|
|
|
{id: '2', name: '知识讲解'},
|
|
{id: '2', name: '知识讲解'},
|
|
|
{id: '3', name: '课程总结'}
|
|
{id: '3', name: '课程总结'}
|
|
|
])
|
|
])
|
|
|
-// 数字人列表
|
|
|
|
|
-const digitalHumans = ref([
|
|
|
|
|
- { id: 18, name: '李白', description: '你是诗仙李白' },
|
|
|
|
|
- { id: 10, name: '小智', description: '你是智能机器人小智' }
|
|
|
|
|
-])
|
|
|
|
|
//主讲人、助讲人
|
|
//主讲人、助讲人
|
|
|
const selectedMainTeacher = ref('李白')
|
|
const selectedMainTeacher = ref('李白')
|
|
|
const selectedAssistants = ref(['小智'])
|
|
const selectedAssistants = ref(['小智'])
|
|
@@ -250,7 +254,7 @@ const generateScript = async () => {
|
|
|
try {
|
|
try {
|
|
|
isGenerating.value = true
|
|
isGenerating.value = true
|
|
|
|
|
|
|
|
- const role = digitalHumans.value.find((r) => r.name === selectedMainTeacher.value)
|
|
|
|
|
|
|
+ const role = props.scriptRoles.value.find((r) => r.name === selectedMainTeacher.value)
|
|
|
let content =
|
|
let content =
|
|
|
prompt.value +
|
|
prompt.value +
|
|
|
'(主讲人:' + role.name +
|
|
'(主讲人:' + role.name +
|
|
@@ -259,7 +263,7 @@ const generateScript = async () => {
|
|
|
let zhujiang = []
|
|
let zhujiang = []
|
|
|
|
|
|
|
|
selectedAssistants.value.forEach((rName) => {
|
|
selectedAssistants.value.forEach((rName) => {
|
|
|
- const assistantRole = digitalHumans.value.find((r) => r.name === rName)
|
|
|
|
|
|
|
+ const assistantRole = props.scriptRoles.value.find((r) => r.name === rName)
|
|
|
zhujiang.push(assistantRole.name + '[' + assistantRole.description + ']')
|
|
zhujiang.push(assistantRole.name + '[' + assistantRole.description + ']')
|
|
|
})
|
|
})
|
|
|
content += zhujiang.join(',') + ')'
|
|
content += zhujiang.join(',') + ')'
|
|
@@ -731,7 +735,7 @@ const generateVoiceover = async (lessonIndex, sectionIndex, dialogueIndex) => {
|
|
|
|
|
|
|
|
dialogue.generatingVoiceover = true
|
|
dialogue.generatingVoiceover = true
|
|
|
|
|
|
|
|
- let role = digitalHumans.value.find((r) => r.name === dialogue.roleName)
|
|
|
|
|
|
|
+ let role = props.scriptRoles.value.find((r) => r.name === dialogue.roleName)
|
|
|
if (!role) {
|
|
if (!role) {
|
|
|
console.error('未找到角色:', dialogue.roleName)
|
|
console.error('未找到角色:', dialogue.roleName)
|
|
|
dialogue.generatingVoiceover = false
|
|
dialogue.generatingVoiceover = false
|