|
@@ -64,9 +64,17 @@
|
|
|
v-if="pageStatus == 2 && !showIndexPage && editorBarData.type == '0'"
|
|
|
v-loading="uploadFileLoading"
|
|
|
>
|
|
|
- <div class="wavGetTextProgress" v-if="wavGetTextLoading" style="position: absolute; bottom: 20px; right: 285px; z-index: 10002">
|
|
|
- <el-progress :text-inside="true" :stroke-width="26" :percentage="wavGetTextProgress"></el-progress>
|
|
|
- </div>
|
|
|
+ <div
|
|
|
+ class="wavGetTextProgress"
|
|
|
+ v-if="wavGetTextLoading"
|
|
|
+ style="position: absolute; bottom: 20px; right: 285px; z-index: 10002"
|
|
|
+ >
|
|
|
+ <el-progress
|
|
|
+ :text-inside="true"
|
|
|
+ :stroke-width="26"
|
|
|
+ :percentage="wavGetTextProgress"
|
|
|
+ ></el-progress>
|
|
|
+ </div>
|
|
|
<el-button
|
|
|
style="position: absolute; bottom: 20px; right: 185px; z-index: 10002"
|
|
|
size="small"
|
|
@@ -767,7 +775,7 @@ export default {
|
|
|
ws: null
|
|
|
},
|
|
|
userName: "",
|
|
|
- curRequestController:null,
|
|
|
+ curRequestController: null
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -986,44 +994,50 @@ export default {
|
|
|
};
|
|
|
|
|
|
let _addText = "";
|
|
|
- const md = new MarkdownIt();
|
|
|
- let _this = this;
|
|
|
- // const curRequestController = new AbortController();
|
|
|
- this.curRequestController = new AbortController();
|
|
|
-
|
|
|
- fetchEventSource("https://gpt4.cocorobo.cn/ai_agent_park_chat_new_post_stream",{
|
|
|
- method: "POST",
|
|
|
- headers: {
|
|
|
- "Content-Type": "application/json"
|
|
|
- },
|
|
|
- body: JSON.stringify(params),
|
|
|
- signal: _this.curRequestController.signal,
|
|
|
- onmessage(ev){
|
|
|
- console.log(ev)
|
|
|
- if(ev.data=="")return
|
|
|
- let _data = JSON.parse(ev.data);
|
|
|
- if(_data.content=='[DONE]')return;
|
|
|
- _addText+=_data.content;
|
|
|
- _this.chatList.find(i => i.uid == _uid).aiContent = md.render(_addText);
|
|
|
- _this.chatList.find(i => i.uid == _uid).loading = false;
|
|
|
- _this.scrollBottom();
|
|
|
- console.log(_data)
|
|
|
- },
|
|
|
- onclose(){
|
|
|
- _this.$forceUpdate();
|
|
|
- // _this.stopTalkToken = null;
|
|
|
- // _this.faloading = false;
|
|
|
- _this.curRequestController = null;
|
|
|
- _this.chatList.find(i => i.uid == _uid).isalltext = true;
|
|
|
- _this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
|
|
|
- _this.insertChat(_uid);
|
|
|
- console.log("连接关闭")
|
|
|
- },
|
|
|
- onerror(err){
|
|
|
-
|
|
|
- console.log("连接错误",err)
|
|
|
- }
|
|
|
- })
|
|
|
+ const md = new MarkdownIt();
|
|
|
+ let _this = this;
|
|
|
+ // const curRequestController = new AbortController();
|
|
|
+ this.curRequestController = new AbortController();
|
|
|
+
|
|
|
+ fetchEventSource(
|
|
|
+ "https://gpt4.cocorobo.cn/ai_agent_park_chat_new_post_stream",
|
|
|
+ {
|
|
|
+ method: "POST",
|
|
|
+ headers: {
|
|
|
+ "Content-Type": "application/json"
|
|
|
+ },
|
|
|
+ body: JSON.stringify(params),
|
|
|
+ signal: _this.curRequestController.signal,
|
|
|
+ onmessage(ev) {
|
|
|
+ console.log(ev);
|
|
|
+ if (ev.data == "") return;
|
|
|
+ let _data = JSON.parse(ev.data);
|
|
|
+ if (_data.content == "[DONE]") return;
|
|
|
+ _addText += _data.content;
|
|
|
+ _this.chatList.find(i => i.uid == _uid).aiContent = md.render(
|
|
|
+ _addText
|
|
|
+ );
|
|
|
+ _this.chatList.find(i => i.uid == _uid).loading = false;
|
|
|
+ _this.scrollBottom();
|
|
|
+ console.log(_data);
|
|
|
+ },
|
|
|
+ onclose() {
|
|
|
+ _this.$forceUpdate();
|
|
|
+ // _this.stopTalkToken = null;
|
|
|
+ // _this.faloading = false;
|
|
|
+ _this.curRequestController = null;
|
|
|
+ _this.chatList.find(i => i.uid == _uid).isalltext = true;
|
|
|
+ _this.chatList.find(
|
|
|
+ i => i.uid == _uid
|
|
|
+ ).isShowSynchronization = true;
|
|
|
+ _this.insertChat(_uid);
|
|
|
+ console.log("连接关闭");
|
|
|
+ },
|
|
|
+ onerror(err) {
|
|
|
+ console.log("连接错误", err);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
// this.ajax
|
|
|
// .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
|
// .then(res => {
|
|
@@ -1080,7 +1094,7 @@ export default {
|
|
|
messages: _historyMessage,
|
|
|
uid: _uuid,
|
|
|
mind_map_question: "",
|
|
|
- stream:true
|
|
|
+ stream: true
|
|
|
};
|
|
|
// let params = JSON.stringify({
|
|
|
// message: {
|
|
@@ -1094,44 +1108,46 @@ export default {
|
|
|
// model: "Claude 3 Sonnet", // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
// });
|
|
|
|
|
|
-
|
|
|
let _addText = "";
|
|
|
const md = new MarkdownIt();
|
|
|
let _this = this;
|
|
|
- this.curRequestController = new AbortController();
|
|
|
+ this.curRequestController = new AbortController();
|
|
|
|
|
|
- fetchEventSource("https://gpt4.cocorobo.cn/chat_post_stream",{
|
|
|
+ fetchEventSource("https://gpt4.cocorobo.cn/chat_post_stream", {
|
|
|
method: "POST",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json"
|
|
|
},
|
|
|
body: JSON.stringify(params),
|
|
|
signal: _this.curRequestController.signal,
|
|
|
- onmessage(ev){
|
|
|
- console.log(ev)
|
|
|
+ onmessage(ev) {
|
|
|
+ console.log(ev);
|
|
|
let _data = ev.data;
|
|
|
- if(_data=='[DONE]')return;
|
|
|
- _addText+=_data;
|
|
|
- _this.chatList.find(i => i.uid == _uuid).aiContent = md.render(_addText);
|
|
|
+ if (_data == "[DONE]") return;
|
|
|
+ _addText += _data;
|
|
|
+ _this.chatList.find(i => i.uid == _uuid).aiContent = md.render(
|
|
|
+ _addText
|
|
|
+ );
|
|
|
_this.chatList.find(i => i.uid == _uuid).loading = false;
|
|
|
_this.scrollBottom();
|
|
|
- console.log(_data)
|
|
|
+ console.log(_data);
|
|
|
},
|
|
|
- onclose(){
|
|
|
+ onclose() {
|
|
|
_this.$forceUpdate();
|
|
|
// _this.stopTalkToken = null;
|
|
|
// _this.faloading = false;
|
|
|
_this.curRequestController = null;
|
|
|
_this.chatList.find(i => i.uid == _uuid).isalltext = true;
|
|
|
- _this.chatList.find(i => i.uid == _uuid).isShowSynchronization = true;
|
|
|
+ _this.chatList.find(
|
|
|
+ i => i.uid == _uuid
|
|
|
+ ).isShowSynchronization = true;
|
|
|
_this.insertChat(_uuid);
|
|
|
- console.log("连接关闭")
|
|
|
+ console.log("连接关闭");
|
|
|
},
|
|
|
- onerror(err){
|
|
|
-
|
|
|
- console.log("连接错误",err)
|
|
|
+ onerror(err) {
|
|
|
+ console.log("连接错误", err);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
|
|
|
// this.ajax
|
|
|
// .post("https://gpt4.cocorobo.cn/chat", params)
|
|
@@ -1558,10 +1574,10 @@ ${JSON.stringify(_list)}
|
|
|
// return new Blob(buffer, { type: "audio/mp3" });
|
|
|
// },
|
|
|
async wavFileGetText(audioFile) {
|
|
|
- this.wavGetTextProgress = 0;
|
|
|
- let _TimeProgress = 6000;//六秒
|
|
|
- let _totalTime = 0;
|
|
|
- let _duration = 0;
|
|
|
+ this.wavGetTextProgress = 0;
|
|
|
+ let _TimeProgress = 6000; //六秒
|
|
|
+ let _totalTime = 0;
|
|
|
+ let _duration = 0;
|
|
|
let flag = true;
|
|
|
let textList = [];
|
|
|
let _file = null;
|
|
@@ -1577,21 +1593,21 @@ ${JSON.stringify(_list)}
|
|
|
console.log("将转录的文件👇");
|
|
|
console.log(_file);
|
|
|
|
|
|
- const audio = new Audio(URL.createObjectURL(_file));
|
|
|
- audio.addEventListener("canplaythrough",()=>{
|
|
|
- _duration = (audio.duration * 1000).toFixed(0);
|
|
|
- console.log("音频时长",_duration)
|
|
|
- })
|
|
|
-
|
|
|
+ const audio = new Audio(URL.createObjectURL(_file));
|
|
|
+ audio.addEventListener("canplaythrough", () => {
|
|
|
+ _duration = (audio.duration * 1000).toFixed(0);
|
|
|
+ console.log("音频时长", _duration);
|
|
|
+ });
|
|
|
|
|
|
try {
|
|
|
- let iiframe = this.$refs["iiframe"];
|
|
|
- let _this = this;
|
|
|
+ let iiframe = this.$refs["iiframe"];
|
|
|
+ let _this = this;
|
|
|
this.wavGetTextLoading = true;
|
|
|
iiframe.contentWindow.window.document.getElementById(
|
|
|
"languageOptions"
|
|
|
).selectedIndex = this.languageRadio;
|
|
|
_this.transcriptionData.content = "";
|
|
|
+ let _tempText = "";
|
|
|
iiframe.contentWindow.onRecognizedResult = function(e) {
|
|
|
if (flag) {
|
|
|
// 这里上传文件
|
|
@@ -1606,30 +1622,33 @@ ${JSON.stringify(_list)}
|
|
|
_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);
|
|
|
+ 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;
|
|
|
console.log("👇转译对象👇");
|
|
|
console.log(e);
|
|
|
console.log("👇转译结果👇");
|
|
|
console.log(privText);
|
|
|
- if(!privText)return;
|
|
|
+ if (!privText) return;
|
|
|
textList.push({
|
|
|
value: privText,
|
|
|
startTime: "",
|
|
@@ -1685,18 +1704,22 @@ ${JSON.stringify(_list)}
|
|
|
};
|
|
|
|
|
|
iiframe.contentWindow.onSessionStopped = function(e) {
|
|
|
- _this.wavGetTextProgress = 100;
|
|
|
- if(_this.wavFileGetTextLoading)_this.$message.success("转译完成");
|
|
|
+ _this.wavGetTextProgress = 100;
|
|
|
+ if (_this.wavFileGetTextLoading) _this.$message.success("转译完成");
|
|
|
_this.showGetTextLoading = false;
|
|
|
_this.wavGetTextLoading = false;
|
|
|
_this.saveEditorBar();
|
|
|
};
|
|
|
|
|
|
- iiframe.contentWindow.doContinuousPronunciationAssessment("", {
|
|
|
+ //iiframe.contentWindow.doContinuousPronunciationAssessment("", {
|
|
|
+ // files: [_file]
|
|
|
+ //});
|
|
|
+
|
|
|
+ iiframe.contentWindow.ConversationTranscriber({
|
|
|
files: [_file]
|
|
|
});
|
|
|
} catch (error) {
|
|
|
- console.log(error)
|
|
|
+ console.log(error);
|
|
|
this.wavGetTextLoading = false;
|
|
|
this.showGetTextLoading = false;
|
|
|
}
|
|
@@ -1708,7 +1731,7 @@ ${JSON.stringify(_list)}
|
|
|
iiframe.contentWindow.scenarioStopButton.click();
|
|
|
this.wavGetTextLoading = false;
|
|
|
this.showGetTextLoading = false;
|
|
|
- this.wavGetTextProgress = 0;
|
|
|
+ this.wavGetTextProgress = 0;
|
|
|
this.$message.success("终止转译成功");
|
|
|
} catch (error) {
|
|
|
this.$message.error("终止转译失败");
|
|
@@ -3645,10 +3668,10 @@ ${JSON.stringify(_list)}
|
|
|
color: #fff !important;
|
|
|
}
|
|
|
|
|
|
-.wavGetTextProgress{
|
|
|
- width: 250px;
|
|
|
- height: 32px;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 3px 0;
|
|
|
+.wavGetTextProgress {
|
|
|
+ width: 250px;
|
|
|
+ height: 32px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 3px 0;
|
|
|
}
|
|
|
</style>
|