|
@@ -26,12 +26,19 @@ export function analysisRecognitionDialogueData(arr) {
|
|
|
// 角色列表
|
|
|
let roleList = [];
|
|
|
arr.forEach((item) => {
|
|
|
+ if (item.match(/^-\S+/)) {
|
|
|
+ let role = item.split(/^-/)[1];
|
|
|
+ if (!roleList.includes(role) && role !== '学生') {
|
|
|
+ roleList.push(role);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!item.match(/.+[::].+/)) return;
|
|
|
let [role] = item.split(/[::]/);
|
|
|
if (!roleList.includes(role)) {
|
|
|
roleList.push(role);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
if (roleList.length < 1 || roleList.length > 5) {
|
|
|
Message.warning('角色数不符合要求,最小为 1,最大为 5');
|
|
|
return {};
|
|
@@ -39,6 +46,7 @@ export function analysisRecognitionDialogueData(arr) {
|
|
|
let role_number = roleList.length;
|
|
|
let role_list = roleList.map((item, i) => getRole(i, item));
|
|
|
|
|
|
+ // 选项列表
|
|
|
let option_list = [];
|
|
|
arr.forEach((item) => {
|
|
|
if (item.match(/.+[::].+/)) {
|
|
@@ -50,14 +58,19 @@ export function analysisRecognitionDialogueData(arr) {
|
|
|
type: 'text',
|
|
|
});
|
|
|
}
|
|
|
- if (item.match(/^-学生$/)) {
|
|
|
+
|
|
|
+ if (item.match(/^-\S+/)) {
|
|
|
+ let isStudent = /^-学生$/.test(item); // 是否是学生
|
|
|
+
|
|
|
option_list.push({
|
|
|
mark: getRandomNumber(),
|
|
|
+ role: isStudent ? '' : role_list.find(({ name }) => name === item.split(/^-/)[1]).mark,
|
|
|
file_id: '',
|
|
|
type: 'input_student',
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
return {
|
|
|
'data.property.role_number': role_number,
|
|
|
'data.property.role_list': role_list,
|