|
@@ -1637,25 +1637,14 @@ ${JSON.stringify(_list)}
|
|
try {
|
|
try {
|
|
let iiframe = this.$refs["iiframe"];
|
|
let iiframe = this.$refs["iiframe"];
|
|
let _this = this;
|
|
let _this = this;
|
|
- this.wavGetTextLoading = true;
|
|
|
|
iiframe.contentWindow.window.document.getElementById(
|
|
iiframe.contentWindow.window.document.getElementById(
|
|
"languageOptions"
|
|
"languageOptions"
|
|
).selectedIndex = this.languageRadio;
|
|
).selectedIndex = this.languageRadio;
|
|
_this.transcriptionData.content = "";
|
|
_this.transcriptionData.content = "";
|
|
- iiframe.contentWindow.window.onRecognizedResult = function(e) {
|
|
|
|
- if (flag) {
|
|
|
|
- // 这里上传文件
|
|
|
|
- // _this.uploadWavFile(audioFile);
|
|
|
|
- _this.controlsStatus = 2;
|
|
|
|
- _this.showIndexPage = false;
|
|
|
|
- _this.pageStatus = 2;
|
|
|
|
- _this.editorBarData.type = "0";
|
|
|
|
- flag = false;
|
|
|
|
- _this.uploadFileLoading = false;
|
|
|
|
- _this.transcriptionData.content = "";
|
|
|
|
- _this.editorBarData.content = "";
|
|
|
|
- textList = [];
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ this.showGetTextLoading = true;
|
|
|
|
+ this.wavGetTextLoading = true;
|
|
|
|
+ let _timer = setInterval(() => {
|
|
if (_this.wavGetTextProgress <= 70) {
|
|
if (_this.wavGetTextProgress <= 70) {
|
|
_TimeProgress = 6000; //六秒
|
|
_TimeProgress = 6000; //六秒
|
|
} else if (_this.wavGetTextProgress <= 80) {
|
|
} else if (_this.wavGetTextProgress <= 80) {
|
|
@@ -1674,396 +1663,476 @@ ${JSON.stringify(_list)}
|
|
_this.wavGetTextProgress = ((_totalTime / _duration) * 100).toFixed(
|
|
_this.wavGetTextProgress = ((_totalTime / _duration) * 100).toFixed(
|
|
0
|
|
0
|
|
);
|
|
);
|
|
- _this.wavGetTextLoading = true;
|
|
|
|
- _this.showGetTextLoading = true;
|
|
|
|
- let privText = e.privText;
|
|
|
|
- let privSpeakerId = e.privSpeakerId;
|
|
|
|
- let _copyPrivSpeakerId = privSpeakerId;
|
|
|
|
- let privDuration = e.privDuration;
|
|
|
|
- let privOffset = e.privOffset;
|
|
|
|
- console.log("👉转译对象👉", e);
|
|
|
|
- console.log("👉转译结果👉", privText);
|
|
|
|
- if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (_roleList[privSpeakerId]) {
|
|
|
|
- privSpeakerId = _roleList[privSpeakerId];
|
|
|
|
- } else {
|
|
|
|
- _getRoleList.push({
|
|
|
|
- role: privSpeakerId,
|
|
|
|
- content: privText
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- _behavioralCodingList.push({
|
|
|
|
- index: textList.length,
|
|
|
|
- role: privSpeakerId,
|
|
|
|
- content: privText,
|
|
|
|
- code: ""
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- console.log("roleList", _roleList);
|
|
|
|
- console.log("getRoleList", _getRoleList);
|
|
|
|
- console.log("behavioralCodingList", _behavioralCodingList);
|
|
|
|
- if (_getRoleList.length >= 10 && !_getRoleLoading) {
|
|
|
|
- try {
|
|
|
|
- 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
|
|
|
|
- .getWavRoleList(params)
|
|
|
|
- .then(res => {
|
|
|
|
- let _runData = res.data.data;
|
|
|
|
- let _runResult = _runData.outputs.result;
|
|
|
|
- let _numRole = [];
|
|
|
|
-
|
|
|
|
- _runResult.forEach((txt, index) => {
|
|
|
|
- let _oldRole = _getRoleList[index].role;
|
|
|
|
- if (_numRole.map(i => i.role).includes(_oldRole)) {
|
|
|
|
- let _findIndex = _numRole.findIndex(
|
|
|
|
- i => i.role == _oldRole
|
|
|
|
- );
|
|
|
|
- if (txt == "学生") {
|
|
|
|
- _numRole[_findIndex].s += 1;
|
|
|
|
- } else if (txt == "老师") {
|
|
|
|
- _numRole[_findIndex].t += 1;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (txt == "学生") {
|
|
|
|
- _numRole.push({ role: _oldRole, t: 0, s: 1 });
|
|
|
|
- } else if (txt == "老师") {
|
|
|
|
- _numRole.push({ role: _oldRole, t: 1, s: 0 });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- //根据数量判断是老师还是学生
|
|
|
|
- _numRole.forEach(i => {
|
|
|
|
- if (i.t > i.s) {
|
|
|
|
- _roleList[i.role] = "老师";
|
|
|
|
- } else if (i.t < i.s) {
|
|
|
|
- _roleList[i.role] = "学生";
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- //已经有的role
|
|
|
|
- let roleKeys = Object.keys(_roleList);
|
|
|
|
-
|
|
|
|
- textList.forEach(i => {
|
|
|
|
- if (roleKeys.includes(i.role)) {
|
|
|
|
- i.role = _roleList[i.role];
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- //同时更新
|
|
|
|
- _behavioralCodingList.forEach(i=>{
|
|
|
|
- if(roleKeys.includes(i.role)){
|
|
|
|
- i.role = _roleList[i.role]
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- _getRoleList = _getRoleList.filter(
|
|
|
|
- i => !roleKeys.includes(i.role)
|
|
|
|
- );
|
|
|
|
- _getRoleLoading = false;
|
|
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
- console.log("获取说话人编码失败", err);
|
|
|
|
- _getRoleLoading = false;
|
|
|
|
- });
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log("说话人编码失败", error);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- console.log("behavioralCodingListIf", (_behavioralCodingList.filter(
|
|
|
|
- i => (i.role.indexOf("Guest") == -1 && i.code == "")
|
|
|
|
- )));
|
|
|
|
- if (
|
|
|
|
- _behavioralCodingList.filter(
|
|
|
|
- i => i.role.indexOf("Guest") === -1 && i.code === ""
|
|
|
|
- ).length >= 10 &&
|
|
|
|
- !_getBehavioralCodingLoading
|
|
|
|
- ) {
|
|
|
|
- try {
|
|
|
|
- const _behavioralCodingListTemp = _behavioralCodingList
|
|
|
|
- .filter(i => i.role.indexOf("Guest") == -1 && i.code == "")
|
|
|
|
- .slice(0, 10);
|
|
|
|
-
|
|
|
|
- console.log("behavioralCodingListTemp", _behavioralCodingListTemp);
|
|
|
|
- const params = {
|
|
|
|
- inputs: {
|
|
|
|
- rows: JSON.stringify(
|
|
|
|
- _behavioralCodingListTemp.map(i => ({
|
|
|
|
- content: i.content,
|
|
|
|
- role: i.role
|
|
|
|
- }))
|
|
|
|
- ),
|
|
|
|
- options: "老师讲课,老师提问或点名,老师板书或操作,老师评价或反馈,老师其他,学生发言,学生小组活动,学生自主学习,学生汇报分享,学生其他",
|
|
|
|
- attention: "- 先根据说话人角色判断,再在对应角色的选项中选择选项\n- 如果没有合适的选项,默认使用`老师其他`或者`学生其他`"
|
|
|
|
- },
|
|
|
|
- response_mode: "blocking",
|
|
|
|
- user: _this.userId
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- _getBehavioralCodingLoading = true;
|
|
|
|
- _this
|
|
|
|
- .getBehavioralCoding(params)
|
|
|
|
- .then(res => {
|
|
|
|
- const _runResult = res.data.data.outputs.result;
|
|
|
|
- _behavioralCodingListTemp.forEach((item, index) => {
|
|
|
|
- const foundItem = _behavioralCodingList.find(i => i.index === item.index);
|
|
|
|
- if (foundItem) {
|
|
|
|
- foundItem.code = _runResult[index];
|
|
|
|
- textList[item.index].code = foundItem.code;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- _getBehavioralCodingLoading = false;
|
|
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
- console.log("获取行为编码错误", err);
|
|
|
|
- _getBehavioralCodingLoading = false;
|
|
|
|
- });
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log("获取行为编码错误", error);
|
|
|
|
- _getBehavioralCodingLoading = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- _endTime = (privOffset + privDuration) / 10000000;
|
|
|
|
- textList.push({
|
|
|
|
- value: privText,
|
|
|
|
- startTime: _this.updateRecordedTime({ duration: _startTime }),
|
|
|
|
- endTime: _this.updateRecordedTime({ duration: _endTime }),
|
|
|
|
- time: _this.updateRecordedTime({ duration: _endTime - _startTime }),
|
|
|
|
- role: privSpeakerId,
|
|
|
|
- code: ""
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- _startTime = _endTime;
|
|
|
|
-
|
|
|
|
- _this.transcriptionData.content += _copyPrivSpeakerId + ":" + privText +"\n";
|
|
|
|
-
|
|
|
|
- // console.log(textList);
|
|
|
|
-
|
|
|
|
- let _result = `
|
|
|
|
- <table
|
|
|
|
- border="0"
|
|
|
|
- width="100%"
|
|
|
|
- cellpadding="0"
|
|
|
|
- cellspacing="0"
|
|
|
|
- style="text-align: center"
|
|
|
|
- >
|
|
|
|
- <tbody>
|
|
|
|
- <tr>
|
|
|
|
- <th>序号</th>
|
|
|
|
- <th>开始时间</th>
|
|
|
|
- <th>结束时间</th>
|
|
|
|
- <th>发言内容</th>
|
|
|
|
- <th>时长</th>
|
|
|
|
- <th>说话人身份</th>
|
|
|
|
- <th>行为编码</th>
|
|
|
|
- </tr>
|
|
|
|
- `;
|
|
|
|
- textList.forEach((item, index) => {
|
|
|
|
- _result += `<tr>
|
|
|
|
- <td>${index + 1}</td>
|
|
|
|
- <td>${item.startTime}</td>
|
|
|
|
- <td>${item.endTime}</td>
|
|
|
|
- <td>${item.value}</td>
|
|
|
|
- <td>${item.time}</td>
|
|
|
|
- <td>${item.role}</td>
|
|
|
|
- <td>${item.code}</td>
|
|
|
|
- </tr>`;
|
|
|
|
- });
|
|
|
|
- _result += `
|
|
|
|
- <tr>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- </tr>
|
|
|
|
- </tbody>
|
|
|
|
- </table>`;
|
|
|
|
- _this.editorBarData.content = _result;
|
|
|
|
- this.$forceUpdate();
|
|
|
|
- // _this.editorBarData.content += privText;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- iiframe.contentWindow.onSessionStopped = async function(e) {
|
|
|
|
- let _flag = false;
|
|
|
|
- if (_getRoleList.length > 0) {
|
|
|
|
- _flag = true;
|
|
|
|
- await _this
|
|
|
|
- .getWavRoleList({
|
|
|
|
- inputs: {
|
|
|
|
- options: "老师,学生",
|
|
|
|
- rows: JSON.stringify(
|
|
|
|
- _getRoleList.map(i => {
|
|
|
|
- return { content: i.content, role: i.role };
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- },
|
|
|
|
- response_mode: "blocking",
|
|
|
|
- user: _this.userId
|
|
|
|
- })
|
|
|
|
- .then(res => {
|
|
|
|
- let _runData = res.data.data;
|
|
|
|
- let _runResult = _runData.outputs.result;
|
|
|
|
- let _numRole = [];
|
|
|
|
-
|
|
|
|
- _runResult.forEach((txt, index) => {
|
|
|
|
- let _oldRole = _getRoleList[index].role;
|
|
|
|
- if (_numRole.map(i => i.role).includes(_oldRole)) {
|
|
|
|
- let _findIndex = _numRole.findIndex(
|
|
|
|
- i => i.role == _oldRole
|
|
|
|
- );
|
|
|
|
- if (txt == "学生") {
|
|
|
|
- _numRole[_findIndex].s += 1;
|
|
|
|
- } else if (txt == "老师") {
|
|
|
|
- _numRole[_findIndex].t += 1;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (txt == "学生") {
|
|
|
|
- _numRole.push({ role: _oldRole, t: 0, s: 1 });
|
|
|
|
- } else if (txt == "老师") {
|
|
|
|
- _numRole.push({ role: _oldRole, t: 1, s: 0 });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- //根据数量判断是老师还是学生
|
|
|
|
- _numRole.forEach(i => {
|
|
|
|
- if (i.t > i.s) {
|
|
|
|
- _roleList[i.role] = "老师";
|
|
|
|
- } else if (i.t < i.s) {
|
|
|
|
- _roleList[i.role] = "学生";
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- //已经有的role
|
|
|
|
- let roleKeys = Object.keys(_roleList);
|
|
|
|
-
|
|
|
|
- textList.forEach(i => {
|
|
|
|
- if (roleKeys.includes(i.role)) {
|
|
|
|
- i.role = _roleList[i.role];
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- _getRoleList = _getRoleList.filter(
|
|
|
|
- i => !roleKeys.includes(i.role)
|
|
|
|
- );
|
|
|
|
- _getRoleLoading = false;
|
|
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
- console.log("最后的获取说话人身份失败", err);
|
|
|
|
|
|
+ }, 2000);
|
|
|
|
+ iiframe.contentWindow.window
|
|
|
|
+ .doConversationTranscriber({ files: [_file] })
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log("转录内容", res);
|
|
|
|
+
|
|
|
|
+ let _data = res.phrases;
|
|
|
|
+
|
|
|
|
+ _data.forEach(i => {
|
|
|
|
+ let _privSpeakerId = `Guest-${i.speaker}`;
|
|
|
|
+ let _privText = i.text;
|
|
|
|
+ let privOffset = i.offsetMilliseconds;
|
|
|
|
+ let privDuration = i.durationMilliseconds;
|
|
|
|
+
|
|
|
|
+ _endTime = (privOffset + privDuration) / 10000000;
|
|
|
|
+ textList.push({
|
|
|
|
+ value: _privText,
|
|
|
|
+ startTime: this.updateRecordedTime({ duration: _startTime }),
|
|
|
|
+ endTime: this.updateRecordedTime({ duration: _endTime }),
|
|
|
|
+ time: this.updateRecordedTime({
|
|
|
|
+ duration: _endTime - _startTime
|
|
|
|
+ }),
|
|
|
|
+ role: _privSpeakerId,
|
|
|
|
+ code: ""
|
|
});
|
|
});
|
|
- }
|
|
|
|
- if (
|
|
|
|
- _behavioralCodingList.some(
|
|
|
|
- i => i.role.indexOf("Guest") === -1 && i.code === ""
|
|
|
|
- )
|
|
|
|
- ) {
|
|
|
|
- _flag = true;
|
|
|
|
- const _behavioralCodingListTemp = _behavioralCodingList
|
|
|
|
- .filter(i => i.role.indexOf("Guest") == -1 && i.code == "")
|
|
|
|
- const params = {
|
|
|
|
- inputs: {
|
|
|
|
- rows: JSON.stringify(
|
|
|
|
- _behavioralCodingListTemp.map(i => ({
|
|
|
|
- content: i.content,
|
|
|
|
- role: i.role
|
|
|
|
- }))
|
|
|
|
- ),
|
|
|
|
- options: "老师讲课,老师提问或点名,老师板书或操作,老师评价或反馈,老师其他,学生发言,学生小组活动,学生自主学习,学生汇报分享,学生其他",
|
|
|
|
- attention: "- 先根据说话人角色判断,再在对应角色的选项中选择选项\n- 如果没有合适的选项,默认使用`老师其他`或者`学生其他`"
|
|
|
|
- },
|
|
|
|
- response_mode: "blocking",
|
|
|
|
- user: _this.userId
|
|
|
|
- };
|
|
|
|
- await _this
|
|
|
|
- .getBehavioralCoding(params)
|
|
|
|
- .then(res => {
|
|
|
|
- const _runResult = res.data.data.outputs.result;
|
|
|
|
- _behavioralCodingListTemp.forEach((item, index) => {
|
|
|
|
- const foundItem = _behavioralCodingList.find(i => i.index === item.index);
|
|
|
|
- if (foundItem) {
|
|
|
|
- foundItem.code = _runResult[index];
|
|
|
|
- textList[item.index].code = foundItem.code;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
- console.log("获取行为编码错误", err);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (_flag) {
|
|
|
|
- let _result = `
|
|
|
|
- <table
|
|
|
|
- border="0"
|
|
|
|
- width="100%"
|
|
|
|
- cellpadding="0"
|
|
|
|
- cellspacing="0"
|
|
|
|
- style="text-align: center"
|
|
|
|
- >
|
|
|
|
- <tbody>
|
|
|
|
- <tr>
|
|
|
|
- <th>序号</th>
|
|
|
|
- <th>开始时间</th>
|
|
|
|
- <th>结束时间</th>
|
|
|
|
- <th>发言内容</th>
|
|
|
|
- <th>时长</th>
|
|
|
|
- <th>说话人身份</th>
|
|
|
|
- <th>行为编码</th>
|
|
|
|
- </tr>
|
|
|
|
- `;
|
|
|
|
|
|
+ _startTime = _endTime;
|
|
|
|
+ this.transcriptionData.content +=
|
|
|
|
+ _privSpeakerId + ":" + _privText + "\n";
|
|
|
|
+ });
|
|
|
|
+ let _result = `<table border="0" width="100%" cellpadding="0" cellspacing="0" style="text-align: center"><tbody><tr><th>序号</th><th>开始时间</th><th>结束时间</th><th>发言内容</th><th>时长</th><th>说话人身份</th><th>行为编码</th></tr>`;
|
|
textList.forEach((item, index) => {
|
|
textList.forEach((item, index) => {
|
|
- _result += `<tr>
|
|
|
|
- <td>${index + 1}</td>
|
|
|
|
- <td>${item.startTime}</td>
|
|
|
|
- <td>${item.endTime}</td>
|
|
|
|
- <td>${item.value}</td>
|
|
|
|
- <td>${item.time}</td>
|
|
|
|
- <td>${item.role}</td>
|
|
|
|
- <td>${item.code}</td>
|
|
|
|
- </tr>`;
|
|
|
|
|
|
+ _result += `<tr><td>${index + 1}</td><td>${item.startTime}</td><td>${item.endTime}</td><td>${item.value}</td><td>${item.time}</td><td>${item.role}</td><td>${item.code}</td></tr>`;
|
|
});
|
|
});
|
|
- _result += `
|
|
|
|
- <tr>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- <td></td>
|
|
|
|
- </tr>
|
|
|
|
- </tbody>
|
|
|
|
- </table>`;
|
|
|
|
- _this.editorBarData.content = _result;
|
|
|
|
- }
|
|
|
|
- _this.wavGetTextProgress = 100;
|
|
|
|
- if (_this.wavFileGetTextLoading) _this.$message.success("转译完成");
|
|
|
|
- _this.showGetTextLoading = false;
|
|
|
|
- _this.wavGetTextLoading = false;
|
|
|
|
- _this.saveEditorBar();
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- iiframe.contentWindow.ConversationTranscriber({
|
|
|
|
- files: [_file]
|
|
|
|
- });
|
|
|
|
|
|
+ _result += `</tbody></table>`;
|
|
|
|
+ this.editorBarData.content = _result;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ this.wavGetTextProgress = 100;
|
|
|
|
+ if (this.wavFileGetTextLoading) this.$message.success("转译完成");
|
|
|
|
+ // _this.editorBarData.content += privText;
|
|
|
|
+
|
|
|
|
+ this.showGetTextLoading = false;
|
|
|
|
+ this.wavGetTextLoading = false;
|
|
|
|
+ if (_timer) {
|
|
|
|
+ clearInterval(_timer);
|
|
|
|
+ }
|
|
|
|
+ this.saveEditorBar();
|
|
|
|
+ })
|
|
|
|
+ .catch(err => {});
|
|
|
|
+ //iiframe.contentWindow.window.onRecognizedResult = function(e) {
|
|
|
|
+ // if (flag) {
|
|
|
|
+ // // 这里上传文件
|
|
|
|
+ // // _this.uploadWavFile(audioFile);
|
|
|
|
+ // _this.controlsStatus = 2;
|
|
|
|
+ // _this.showIndexPage = false;
|
|
|
|
+ // _this.pageStatus = 2;
|
|
|
|
+ // _this.editorBarData.type = "0";
|
|
|
|
+ // flag = false;
|
|
|
|
+ // _this.uploadFileLoading = false;
|
|
|
|
+ // _this.transcriptionData.content = "";
|
|
|
|
+ // _this.editorBarData.content = "";
|
|
|
|
+ // textList = [];
|
|
|
|
+ // }
|
|
|
|
+ // if (_this.wavGetTextProgress <= 70) {
|
|
|
|
+ // _TimeProgress = 6000; //六秒
|
|
|
|
+ // } else if (_this.wavGetTextProgress <= 80) {
|
|
|
|
+ // _TimeProgress = 4000; //改为三秒
|
|
|
|
+ // } else if (_this.wavGetTextProgress <= 90) {
|
|
|
|
+ // _TimeProgress = 2000; //改为一秒
|
|
|
|
+ // } else if (_this.wavGetTextProgress < 95) {
|
|
|
|
+ // _TimeProgress = 1000; //改为0.5秒
|
|
|
|
+ // } else if (_this.wavGetTextProgress < 99) {
|
|
|
|
+ // _TimeProgress = 500; //改为0.1秒
|
|
|
|
+ // } else {
|
|
|
|
+ // _TimeProgress = 0; //改为0秒不动
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // _totalTime += _TimeProgress;
|
|
|
|
+ // _this.wavGetTextProgress = ((_totalTime / _duration) * 100).toFixed(
|
|
|
|
+ // 0
|
|
|
|
+ // );
|
|
|
|
+ // _this.wavGetTextLoading = true;
|
|
|
|
+ // _this.showGetTextLoading = true;
|
|
|
|
+ // let privText = e.privText;
|
|
|
|
+ // let privSpeakerId = e.privSpeakerId;
|
|
|
|
+ // let _copyPrivSpeakerId = privSpeakerId;
|
|
|
|
+ // let privDuration = e.privDuration;
|
|
|
|
+ // let privOffset = e.privOffset;
|
|
|
|
+ // console.log("👉转译对象👉", e);
|
|
|
|
+ // console.log("👉转译结果👉", privText);
|
|
|
|
+ // if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // if (_roleList[privSpeakerId]) {
|
|
|
|
+ // privSpeakerId = _roleList[privSpeakerId];
|
|
|
|
+ // } else {
|
|
|
|
+ // _getRoleList.push({
|
|
|
|
+ // role: privSpeakerId,
|
|
|
|
+ // content: privText
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // _behavioralCodingList.push({
|
|
|
|
+ // index: textList.length,
|
|
|
|
+ // role: privSpeakerId,
|
|
|
|
+ // content: privText,
|
|
|
|
+ // code: ""
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // console.log("roleList", _roleList);
|
|
|
|
+ // console.log("getRoleList", _getRoleList);
|
|
|
|
+ // console.log("behavioralCodingList", _behavioralCodingList);
|
|
|
|
+ // if (_getRoleList.length >= 10 && !_getRoleLoading) {
|
|
|
|
+ // try {
|
|
|
|
+ // 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
|
|
|
|
+ // .getWavRoleList(params)
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // let _runData = res.data.data;
|
|
|
|
+ // let _runResult = _runData.outputs.result;
|
|
|
|
+ // let _numRole = [];
|
|
|
|
+ //
|
|
|
|
+ // _runResult.forEach((txt, index) => {
|
|
|
|
+ // let _oldRole = _getRoleList[index].role;
|
|
|
|
+ // if (_numRole.map(i => i.role).includes(_oldRole)) {
|
|
|
|
+ // let _findIndex = _numRole.findIndex(
|
|
|
|
+ // i => i.role == _oldRole
|
|
|
|
+ // );
|
|
|
|
+ // if (txt == "学生") {
|
|
|
|
+ // _numRole[_findIndex].s += 1;
|
|
|
|
+ // } else if (txt == "老师") {
|
|
|
|
+ // _numRole[_findIndex].t += 1;
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // if (txt == "学生") {
|
|
|
|
+ // _numRole.push({ role: _oldRole, t: 0, s: 1 });
|
|
|
|
+ // } else if (txt == "老师") {
|
|
|
|
+ // _numRole.push({ role: _oldRole, t: 1, s: 0 });
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // //根据数量判断是老师还是学生
|
|
|
|
+ // _numRole.forEach(i => {
|
|
|
|
+ // if (i.t > i.s) {
|
|
|
|
+ // _roleList[i.role] = "老师";
|
|
|
|
+ // } else if (i.t < i.s) {
|
|
|
|
+ // _roleList[i.role] = "学生";
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // //已经有的role
|
|
|
|
+ // let roleKeys = Object.keys(_roleList);
|
|
|
|
+ //
|
|
|
|
+ // textList.forEach(i => {
|
|
|
|
+ // if (roleKeys.includes(i.role)) {
|
|
|
|
+ // i.role = _roleList[i.role];
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // //同时更新
|
|
|
|
+ // _behavioralCodingList.forEach(i=>{
|
|
|
|
+ // if(roleKeys.includes(i.role)){
|
|
|
|
+ // i.role = _roleList[i.role]
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ //
|
|
|
|
+ // _getRoleList = _getRoleList.filter(
|
|
|
|
+ // i => !roleKeys.includes(i.role)
|
|
|
|
+ // );
|
|
|
|
+ // _getRoleLoading = false;
|
|
|
|
+ // })
|
|
|
|
+ // .catch(err => {
|
|
|
|
+ // console.log("获取说话人编码失败", err);
|
|
|
|
+ // _getRoleLoading = false;
|
|
|
|
+ // });
|
|
|
|
+ // } catch (error) {
|
|
|
|
+ // console.log("说话人编码失败", error);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // console.log("behavioralCodingListIf", (_behavioralCodingList.filter(
|
|
|
|
+ // i => (i.role.indexOf("Guest") == -1 && i.code == "")
|
|
|
|
+ // )));
|
|
|
|
+ // if (
|
|
|
|
+ // _behavioralCodingList.filter(
|
|
|
|
+ // i => i.role.indexOf("Guest") === -1 && i.code === ""
|
|
|
|
+ // ).length >= 10 &&
|
|
|
|
+ // !_getBehavioralCodingLoading
|
|
|
|
+ // ) {
|
|
|
|
+ // try {
|
|
|
|
+ // const _behavioralCodingListTemp = _behavioralCodingList
|
|
|
|
+ // .filter(i => i.role.indexOf("Guest") == -1 && i.code == "")
|
|
|
|
+ // .slice(0, 10);
|
|
|
|
+ //
|
|
|
|
+ // console.log("behavioralCodingListTemp", _behavioralCodingListTemp);
|
|
|
|
+ // const params = {
|
|
|
|
+ // inputs: {
|
|
|
|
+ // rows: JSON.stringify(
|
|
|
|
+ // _behavioralCodingListTemp.map(i => ({
|
|
|
|
+ // content: i.content,
|
|
|
|
+ // role: i.role
|
|
|
|
+ // }))
|
|
|
|
+ // ),
|
|
|
|
+ // options: "老师讲课,老师提问或点名,老师板书或操作,老师评价或反馈,老师其他,学生发言,学生小组活动,学生自主学习,学生汇报分享,学生其他",
|
|
|
|
+ // attention: "- 先根据说话人角色判断,再在对应角色的选项中选择选项\n- 如果没有合适的选项,默认使用`老师其他`或者`学生其他`"
|
|
|
|
+ // },
|
|
|
|
+ // response_mode: "blocking",
|
|
|
|
+ // user: _this.userId
|
|
|
|
+ // };
|
|
|
|
+ //
|
|
|
|
+ // _getBehavioralCodingLoading = true;
|
|
|
|
+ // _this
|
|
|
|
+ // .getBehavioralCoding(params)
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // const _runResult = res.data.data.outputs.result;
|
|
|
|
+ // _behavioralCodingListTemp.forEach((item, index) => {
|
|
|
|
+ // const foundItem = _behavioralCodingList.find(i => i.index === item.index);
|
|
|
|
+ // if (foundItem) {
|
|
|
|
+ // foundItem.code = _runResult[index];
|
|
|
|
+ // textList[item.index].code = foundItem.code;
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // _getBehavioralCodingLoading = false;
|
|
|
|
+ // })
|
|
|
|
+ // .catch(err => {
|
|
|
|
+ // console.log("获取行为编码错误", err);
|
|
|
|
+ // _getBehavioralCodingLoading = false;
|
|
|
|
+ // });
|
|
|
|
+ // } catch (error) {
|
|
|
|
+ // console.log("获取行为编码错误", error);
|
|
|
|
+ // _getBehavioralCodingLoading = false;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // _endTime = (privOffset + privDuration) / 10000000;
|
|
|
|
+ // textList.push({
|
|
|
|
+ // value: privText,
|
|
|
|
+ // startTime: _this.updateRecordedTime({ duration: _startTime }),
|
|
|
|
+ // endTime: _this.updateRecordedTime({ duration: _endTime }),
|
|
|
|
+ // time: _this.updateRecordedTime({ duration: _endTime - _startTime }),
|
|
|
|
+ // role: privSpeakerId,
|
|
|
|
+ // code: ""
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // _startTime = _endTime;
|
|
|
|
+ //
|
|
|
|
+ // _this.transcriptionData.content += _copyPrivSpeakerId + ":" + privText +"\n";
|
|
|
|
+ //
|
|
|
|
+ // // console.log(textList);
|
|
|
|
+ //
|
|
|
|
+ // let _result = `
|
|
|
|
+ //<table
|
|
|
|
+ // border="0"
|
|
|
|
+ // width="100%"
|
|
|
|
+ // cellpadding="0"
|
|
|
|
+ // cellspacing="0"
|
|
|
|
+ // style="text-align: center"
|
|
|
|
+ // >
|
|
|
|
+ // <tbody>
|
|
|
|
+ // <tr>
|
|
|
|
+ // <th>序号</th>
|
|
|
|
+ // <th>开始时间</th>
|
|
|
|
+ // <th>结束时间</th>
|
|
|
|
+ // <th>发言内容</th>
|
|
|
|
+ // <th>时长</th>
|
|
|
|
+ // <th>说话人身份</th>
|
|
|
|
+ // <th>行为编码</th>
|
|
|
|
+ // </tr>
|
|
|
|
+ //`;
|
|
|
|
+ // textList.forEach((item, index) => {
|
|
|
|
+ // _result += `<tr>
|
|
|
|
+ // <td>${index + 1}</td>
|
|
|
|
+ // <td>${item.startTime}</td>
|
|
|
|
+ // <td>${item.endTime}</td>
|
|
|
|
+ // <td>${item.value}</td>
|
|
|
|
+ // <td>${item.time}</td>
|
|
|
|
+ // <td>${item.role}</td>
|
|
|
|
+ // <td>${item.code}</td>
|
|
|
|
+ // </tr>`;
|
|
|
|
+ // });
|
|
|
|
+ // _result += `
|
|
|
|
+ //<tr>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // </tr>
|
|
|
|
+ // </tbody>
|
|
|
|
+ //</table>`;
|
|
|
|
+ // _this.editorBarData.content = _result;
|
|
|
|
+ // this.$forceUpdate();
|
|
|
|
+ // // _this.editorBarData.content += privText;
|
|
|
|
+ //};
|
|
|
|
+ //
|
|
|
|
+ //iiframe.contentWindow.onSessionStopped = async function(e) {
|
|
|
|
+ // let _flag = false;
|
|
|
|
+ // if (_getRoleList.length > 0) {
|
|
|
|
+ // _flag = true;
|
|
|
|
+ // await _this
|
|
|
|
+ // .getWavRoleList({
|
|
|
|
+ // inputs: {
|
|
|
|
+ // options: "老师,学生",
|
|
|
|
+ // rows: JSON.stringify(
|
|
|
|
+ // _getRoleList.map(i => {
|
|
|
|
+ // return { content: i.content, role: i.role };
|
|
|
|
+ // })
|
|
|
|
+ // )
|
|
|
|
+ // },
|
|
|
|
+ // response_mode: "blocking",
|
|
|
|
+ // user: _this.userId
|
|
|
|
+ // })
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // let _runData = res.data.data;
|
|
|
|
+ // let _runResult = _runData.outputs.result;
|
|
|
|
+ // let _numRole = [];
|
|
|
|
+ //
|
|
|
|
+ // _runResult.forEach((txt, index) => {
|
|
|
|
+ // let _oldRole = _getRoleList[index].role;
|
|
|
|
+ // if (_numRole.map(i => i.role).includes(_oldRole)) {
|
|
|
|
+ // let _findIndex = _numRole.findIndex(
|
|
|
|
+ // i => i.role == _oldRole
|
|
|
|
+ // );
|
|
|
|
+ // if (txt == "学生") {
|
|
|
|
+ // _numRole[_findIndex].s += 1;
|
|
|
|
+ // } else if (txt == "老师") {
|
|
|
|
+ // _numRole[_findIndex].t += 1;
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // if (txt == "学生") {
|
|
|
|
+ // _numRole.push({ role: _oldRole, t: 0, s: 1 });
|
|
|
|
+ // } else if (txt == "老师") {
|
|
|
|
+ // _numRole.push({ role: _oldRole, t: 1, s: 0 });
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // //根据数量判断是老师还是学生
|
|
|
|
+ // _numRole.forEach(i => {
|
|
|
|
+ // if (i.t > i.s) {
|
|
|
|
+ // _roleList[i.role] = "老师";
|
|
|
|
+ // } else if (i.t < i.s) {
|
|
|
|
+ // _roleList[i.role] = "学生";
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // //已经有的role
|
|
|
|
+ // let roleKeys = Object.keys(_roleList);
|
|
|
|
+ //
|
|
|
|
+ // textList.forEach(i => {
|
|
|
|
+ // if (roleKeys.includes(i.role)) {
|
|
|
|
+ // i.role = _roleList[i.role];
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ //
|
|
|
|
+ // _getRoleList = _getRoleList.filter(
|
|
|
|
+ // i => !roleKeys.includes(i.role)
|
|
|
|
+ // );
|
|
|
|
+ // _getRoleLoading = false;
|
|
|
|
+ // })
|
|
|
|
+ // .catch(err => {
|
|
|
|
+ // console.log("最后的获取说话人身份失败", err);
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // if (
|
|
|
|
+ // _behavioralCodingList.some(
|
|
|
|
+ // i => i.role.indexOf("Guest") === -1 && i.code === ""
|
|
|
|
+ // )
|
|
|
|
+ // ) {
|
|
|
|
+ // _flag = true;
|
|
|
|
+ // const _behavioralCodingListTemp = _behavioralCodingList
|
|
|
|
+ // .filter(i => i.role.indexOf("Guest") == -1 && i.code == "")
|
|
|
|
+ // const params = {
|
|
|
|
+ // inputs: {
|
|
|
|
+ // rows: JSON.stringify(
|
|
|
|
+ // _behavioralCodingListTemp.map(i => ({
|
|
|
|
+ // content: i.content,
|
|
|
|
+ // role: i.role
|
|
|
|
+ // }))
|
|
|
|
+ // ),
|
|
|
|
+ // options: "老师讲课,老师提问或点名,老师板书或操作,老师评价或反馈,老师其他,学生发言,学生小组活动,学生自主学习,学生汇报分享,学生其他",
|
|
|
|
+ // attention: "- 先根据说话人角色判断,再在对应角色的选项中选择选项\n- 如果没有合适的选项,默认使用`老师其他`或者`学生其他`"
|
|
|
|
+ // },
|
|
|
|
+ // response_mode: "blocking",
|
|
|
|
+ // user: _this.userId
|
|
|
|
+ // };
|
|
|
|
+ // await _this
|
|
|
|
+ // .getBehavioralCoding(params)
|
|
|
|
+ // .then(res => {
|
|
|
|
+ // const _runResult = res.data.data.outputs.result;
|
|
|
|
+ // _behavioralCodingListTemp.forEach((item, index) => {
|
|
|
|
+ // const foundItem = _behavioralCodingList.find(i => i.index === item.index);
|
|
|
|
+ // if (foundItem) {
|
|
|
|
+ // foundItem.code = _runResult[index];
|
|
|
|
+ // textList[item.index].code = foundItem.code;
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ // })
|
|
|
|
+ // .catch(err => {
|
|
|
|
+ // console.log("获取行为编码错误", err);
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // if (_flag) {
|
|
|
|
+ // let _result = `
|
|
|
|
+ //<table
|
|
|
|
+ // border="0"
|
|
|
|
+ // width="100%"
|
|
|
|
+ // cellpadding="0"
|
|
|
|
+ // cellspacing="0"
|
|
|
|
+ // style="text-align: center"
|
|
|
|
+ // >
|
|
|
|
+ // <tbody>
|
|
|
|
+ // <tr>
|
|
|
|
+ // <th>序号</th>
|
|
|
|
+ // <th>开始时间</th>
|
|
|
|
+ // <th>结束时间</th>
|
|
|
|
+ // <th>发言内容</th>
|
|
|
|
+ // <th>时长</th>
|
|
|
|
+ // <th>说话人身份</th>
|
|
|
|
+ // <th>行为编码</th>
|
|
|
|
+ // </tr>
|
|
|
|
+ //`;
|
|
|
|
+ // textList.forEach((item, index) => {
|
|
|
|
+ // _result += `<tr>
|
|
|
|
+ // <td>${index + 1}</td>
|
|
|
|
+ // <td>${item.startTime}</td>
|
|
|
|
+ // <td>${item.endTime}</td>
|
|
|
|
+ // <td>${item.value}</td>
|
|
|
|
+ // <td>${item.time}</td>
|
|
|
|
+ // <td>${item.role}</td>
|
|
|
|
+ // <td>${item.code}</td>
|
|
|
|
+ // </tr>`;
|
|
|
|
+ // });
|
|
|
|
+ // _result += `
|
|
|
|
+ //<tr>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // <td></td>
|
|
|
|
+ // </tr>
|
|
|
|
+ // </tbody>
|
|
|
|
+ //</table>`;
|
|
|
|
+ // _this.editorBarData.content = _result;
|
|
|
|
+ // }
|
|
|
|
+ // _this.wavGetTextProgress = 100;
|
|
|
|
+ // if (_this.wavFileGetTextLoading) _this.$message.success("转译完成");
|
|
|
|
+ // _this.showGetTextLoading = false;
|
|
|
|
+ // _this.wavGetTextLoading = false;
|
|
|
|
+ // _this.saveEditorBar();
|
|
|
|
+ //};
|
|
|
|
+
|
|
|
|
+ //iiframe.contentWindow.ConversationTranscriber({
|
|
|
|
+ // files: [_file]
|
|
|
|
+ //});
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.log(error);
|
|
console.log(error);
|
|
this.wavGetTextLoading = false;
|
|
this.wavGetTextLoading = false;
|
|
@@ -3116,9 +3185,9 @@ ${JSON.stringify(_list)}
|
|
|
|
|
|
// 录音开始
|
|
// 录音开始
|
|
let flag = true;
|
|
let flag = true;
|
|
- console.log("开始录音",iiframe)
|
|
|
|
|
|
+ console.log("开始录音", iiframe);
|
|
iiframe.contentWindow.window.onRecognizedResult = e => {
|
|
iiframe.contentWindow.window.onRecognizedResult = e => {
|
|
- console.log("onRecognizedResult",e)
|
|
|
|
|
|
+ console.log("onRecognizedResult", e);
|
|
// let e = {
|
|
// let e = {
|
|
// privText:"测试测试"
|
|
// privText:"测试测试"
|
|
// }
|
|
// }
|
|
@@ -3143,8 +3212,8 @@ ${JSON.stringify(_list)}
|
|
console.log("👇转译结果👇");
|
|
console.log("👇转译结果👇");
|
|
console.log(privText);
|
|
console.log(privText);
|
|
if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {
|
|
if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
const newItem = {
|
|
const newItem = {
|
|
value: privText,
|
|
value: privText,
|
|
@@ -3161,7 +3230,8 @@ ${JSON.stringify(_list)}
|
|
};
|
|
};
|
|
this.recordedForm.textList.push(newItem);
|
|
this.recordedForm.textList.push(newItem);
|
|
this.recordedForm.startTime = this.recordedForm.timeDuration + 1;
|
|
this.recordedForm.startTime = this.recordedForm.timeDuration + 1;
|
|
- this.transcriptionData.content += _copyPrivSpeakerId + ":" + privText + "\n";
|
|
|
|
|
|
+ this.transcriptionData.content +=
|
|
|
|
+ _copyPrivSpeakerId + ":" + privText + "\n";
|
|
this.onRecordAddLine(newItem);
|
|
this.onRecordAddLine(newItem);
|
|
};
|
|
};
|
|
|
|
|