|
@@ -1699,30 +1699,66 @@ ${JSON.stringify(_list)}
|
|
role: privSpeakerId,
|
|
role: privSpeakerId,
|
|
content: privText
|
|
content: privText
|
|
});
|
|
});
|
|
- console.log(_getRoleList)
|
|
|
|
|
|
+ console.log(_getRoleList);
|
|
}
|
|
}
|
|
|
|
|
|
- console.log(_getRoleList.length >= 5 && !_getRoleLoading)
|
|
|
|
|
|
+ console.log(_getRoleList.length >= 5 && !_getRoleLoading);
|
|
if (_getRoleList.length >= 5 && !_getRoleLoading) {
|
|
if (_getRoleList.length >= 5 && !_getRoleLoading) {
|
|
try {
|
|
try {
|
|
let params = {
|
|
let params = {
|
|
- inputs: {
|
|
|
|
- options: "老师,学生",
|
|
|
|
- rows: JSON.stringify(
|
|
|
|
- _getRoleList.map(i => {
|
|
|
|
- return { content: i.content, role: i.role };
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- },
|
|
|
|
- response_mode: "blocking",
|
|
|
|
- user: _this.userId
|
|
|
|
- };
|
|
|
|
- _getRoleLoading = true;
|
|
|
|
- _this.ajax
|
|
|
|
- .post("https://dify.cocorobo.cn/v1/workflows/run", params)
|
|
|
|
- .then(res => {
|
|
|
|
- let _runData = res.data;
|
|
|
|
- let _runResult = _runData.outputs.result;
|
|
|
|
|
|
+ inputs: {
|
|
|
|
+ options: "老师,学生",
|
|
|
|
+ rows: JSON.stringify(
|
|
|
|
+ _getRoleList.map(i => {
|
|
|
|
+ return { content: i.content, role: i.role };
|
|
|
|
+ })
|
|
|
|
+ )
|
|
|
|
+ },
|
|
|
|
+ response_mode: "blocking",
|
|
|
|
+ user: _this.userId
|
|
|
|
+ };
|
|
|
|
+ _getRoleLoading = true;
|
|
|
|
+ const config = {
|
|
|
|
+ headers: {
|
|
|
|
+ Authorization: `Bearer app-TonzLPv7rPG0EtnFKszOWjwt`,
|
|
|
|
+ "Content-Type": "application/json"
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ // _this.ajax
|
|
|
|
+ // .post("https://dify.cocorobo.cn/v1/workflows/run", params)
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // let _runData = res.data;
|
|
|
|
+ // let _runResult = _runData.outputs.result;
|
|
|
|
+ // _runResult.forEach((txt, index) => {
|
|
|
|
+ // let _oldRole = _getRoleList[index].role;
|
|
|
|
+ // if (!_roleList[_oldRole]) {
|
|
|
|
+ // _roleList[_oldRole] = txt;
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // // 去除内容
|
|
|
|
+ // _getRoleList.splice(0, _runResult.length);
|
|
|
|
+ // let _indexList = [];
|
|
|
|
+ // _getRoleList.forEach((i, index) => {
|
|
|
|
+ // if (_roleList[i.role]) {
|
|
|
|
+ // textList[i.index].role = _roleList[i.role];
|
|
|
|
+ // _indexList.push(index);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // _getRoleList = _getRoleList.filter(
|
|
|
|
+ // (item, index) => !_indexList.includes(index)
|
|
|
|
+ // );
|
|
|
|
+ // _getRoleLoading = false;
|
|
|
|
+ // })
|
|
|
|
+ // .catch(err => {
|
|
|
|
+ // console.log("获取说话人编码失败", err);
|
|
|
|
+ // _getRoleLoading = false;
|
|
|
|
+ // });
|
|
|
|
+ fetch("https://dify.cocorobo.cn/v1/workflows/run", {
|
|
|
|
+ method: "POST",
|
|
|
|
+ body: JSON.stringify(params),
|
|
|
|
+ ...config
|
|
|
|
+ }).then(res => {
|
|
|
|
+ let _runResult = res.outputs.result;
|
|
_runResult.forEach((txt, index) => {
|
|
_runResult.forEach((txt, index) => {
|
|
let _oldRole = _getRoleList[index].role;
|
|
let _oldRole = _getRoleList[index].role;
|
|
if (!_roleList[_oldRole]) {
|
|
if (!_roleList[_oldRole]) {
|
|
@@ -1742,13 +1778,9 @@ ${JSON.stringify(_list)}
|
|
(item, index) => !_indexList.includes(index)
|
|
(item, index) => !_indexList.includes(index)
|
|
);
|
|
);
|
|
_getRoleLoading = false;
|
|
_getRoleLoading = false;
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
- console.log("获取说话人编码失败", err);
|
|
|
|
- _getRoleLoading = false;
|
|
|
|
});
|
|
});
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- console.log("说话人编码失败",error)
|
|
|
|
|
|
+ console.log("说话人编码失败", error);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|