|
@@ -85,9 +85,21 @@
|
|
|
>
|
|
|
<el-popover placement="top" trigger="click" v-if="!wavGetTextLoading">
|
|
|
<div style="display: flex;">
|
|
|
- <el-input size="small" style="width: 150px;margin-right: 10px;" v-model="replace1" placeholder="替换之前的文字"></el-input>
|
|
|
- <el-input size="small" style="width: 150px;margin-right: 10px;" v-model="replace2" placeholder="替换之后的文字"></el-input>
|
|
|
- <el-button type="primary" size="small" @click="replaceText()">替换</el-button>
|
|
|
+ <el-input
|
|
|
+ size="small"
|
|
|
+ style="width: 150px;margin-right: 10px;"
|
|
|
+ v-model="replace1"
|
|
|
+ placeholder="替换之前的文字"
|
|
|
+ ></el-input>
|
|
|
+ <el-input
|
|
|
+ size="small"
|
|
|
+ style="width: 150px;margin-right: 10px;"
|
|
|
+ v-model="replace2"
|
|
|
+ placeholder="替换之后的文字"
|
|
|
+ ></el-input>
|
|
|
+ <el-button type="primary" size="small" @click="replaceText()"
|
|
|
+ >替换</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
<el-button
|
|
|
slot="reference"
|
|
@@ -790,8 +802,8 @@ export default {
|
|
|
},
|
|
|
userName: "",
|
|
|
curRequestController: null,
|
|
|
- replace1:"",//替换1
|
|
|
- replace2:"",//替换2
|
|
|
+ replace1: "", //替换1
|
|
|
+ replace2: "" //替换2
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -1671,78 +1683,83 @@ ${JSON.stringify(_list)}
|
|
|
console.log("👇转译结果👇");
|
|
|
console.log(privText);
|
|
|
console.log(privSpeakerId);
|
|
|
- console.log(privDuration)
|
|
|
- console.log(privOffset)
|
|
|
- if (!privText && !privSpeakerId){
|
|
|
- console.log(privText,privSpeakerId)
|
|
|
- console.log(!privText || !privSpeakerId)
|
|
|
- return
|
|
|
- };
|
|
|
+ console.log(privDuration);
|
|
|
+ console.log(privOffset);
|
|
|
+ if (!privText && !privSpeakerId) {
|
|
|
+ console.log(privText, privSpeakerId);
|
|
|
+ console.log(!privText || !privSpeakerId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- if(_roleList[privSpeakerId]){
|
|
|
- privSpeakerId = _roleList[privSpeakerId]
|
|
|
- }else{
|
|
|
+ if (_roleList[privSpeakerId]) {
|
|
|
+ privSpeakerId = _roleList[privSpeakerId];
|
|
|
+ } else {
|
|
|
_getRoleList.push({
|
|
|
- index:textList.length,
|
|
|
- role:privSpeakerId,
|
|
|
- content:privText
|
|
|
- })
|
|
|
+ index: textList.length,
|
|
|
+ role: privSpeakerId,
|
|
|
+ content: privText
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- if(_getRoleList.length>=5 && !_getRoleLoading){
|
|
|
+ if (_getRoleList.length >= 5 && !_getRoleLoading) {
|
|
|
let params = {
|
|
|
- inputs:{
|
|
|
- options:"老师,学生",
|
|
|
- rows:JSON.stringify(_getRoleList.map(i=>{return {content:i.content,role:i.role}}))
|
|
|
+ inputs: {
|
|
|
+ options: "老师,学生",
|
|
|
+ rows: JSON.stringify(
|
|
|
+ _getRoleList.map(i => {
|
|
|
+ return { content: i.content, role: i.role };
|
|
|
+ })
|
|
|
+ )
|
|
|
},
|
|
|
- response_mode:"blocking",
|
|
|
- user:this.userId
|
|
|
- }
|
|
|
+ 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;
|
|
|
+ _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;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- _getRoleLoading = true;
|
|
|
- _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;
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
_endTime = (privOffset + privDuration) / 10000000;
|
|
|
textList.push({
|
|
|
value: privText,
|
|
|
startTime: _this.updateRecordedTime({ duration: _startTime }),
|
|
|
- endTime: _this.updateRecordedTime({duration:_endTime}),
|
|
|
+ endTime: _this.updateRecordedTime({ duration: _endTime }),
|
|
|
time: _this.updateRecordedTime({ duration: _endTime - _startTime }),
|
|
|
role: privSpeakerId
|
|
|
});
|
|
|
|
|
|
_startTime = _endTime;
|
|
|
|
|
|
-
|
|
|
_this.transcriptionData.content += privText;
|
|
|
|
|
|
- console.log(textList)
|
|
|
+ console.log(textList);
|
|
|
|
|
|
let _result = `
|
|
|
<table
|
|
@@ -3105,21 +3122,23 @@ ${JSON.stringify(_list)}
|
|
|
},
|
|
|
// ============ end 声扬录音转译
|
|
|
//替换文字
|
|
|
- replaceText(){
|
|
|
- if(!this.tid)return;
|
|
|
- if(!this.replace1.trim() || !this.replace2.trim()){
|
|
|
- return this.$message.error("请输入内容")
|
|
|
+ replaceText() {
|
|
|
+ if (!this.tid) return;
|
|
|
+ if (!this.replace1.trim() || !this.replace2.trim()) {
|
|
|
+ return this.$message.error("请输入内容");
|
|
|
}
|
|
|
|
|
|
let _replace1 = this.replace1.trim();
|
|
|
let _replace2 = this.replace2.trim();
|
|
|
- console.log(_replace1,_replace2)
|
|
|
+ console.log(_replace1, _replace2);
|
|
|
// console.log(this.editorBarData)
|
|
|
- this.editorBarData.content = this.editorBarData.content.replace(new RegExp(_replace1, 'g'), _replace2);
|
|
|
+ this.editorBarData.content = this.editorBarData.content.replace(
|
|
|
+ new RegExp(_replace1, "g"),
|
|
|
+ _replace2
|
|
|
+ );
|
|
|
this.$forceUpdate();
|
|
|
// this.saveEditorBar();
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
this.loadVoiceprints();
|