g-ai-robot3 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/g-ai-robot3.common.js +88 -79
- package/dist/g-ai-robot3.css +1 -1
- package/dist/g-ai-robot3.umd.js +88 -79
- package/dist/g-ai-robot3.umd.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ import "g-ai-robot3/dist/g-ai-robot3.css"
|
|
|
27
27
|
# props
|
|
28
28
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
29
29
|
|---------- |-------------------|------------|---------|---------|
|
|
30
|
+
| isDebug | 开启debug打印 | Boolean | - | - |
|
|
30
31
|
| title | 问答标题 | String | - | - |
|
|
31
32
|
| greet | 问答问候语 | String | - | - |
|
|
32
33
|
| waitTxt | 问答等候语 | String | - | - |
|
|
@@ -31217,7 +31217,7 @@ function segment(word, options) {
|
|
|
31217
31217
|
|
|
31218
31218
|
|
|
31219
31219
|
|
|
31220
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
31220
|
+
const _withScopeId = n => (_pushScopeId("data-v-7ed14ae0"), n = n(), _popScopeId(), n);
|
|
31221
31221
|
const _hoisted_1 = ["src"];
|
|
31222
31222
|
const _hoisted_2 = {
|
|
31223
31223
|
key: 0,
|
|
@@ -31268,6 +31268,10 @@ const _hoisted_19 = ["src"];
|
|
|
31268
31268
|
/* harmony default export */ var mainvue_type_script_setup_true_lang_js = ({
|
|
31269
31269
|
__name: 'main',
|
|
31270
31270
|
props: {
|
|
31271
|
+
isDebug: {
|
|
31272
|
+
type: Boolean,
|
|
31273
|
+
default: true
|
|
31274
|
+
},
|
|
31271
31275
|
title: {
|
|
31272
31276
|
type: String,
|
|
31273
31277
|
default: "GR水利大模型"
|
|
@@ -31441,7 +31445,7 @@ const _hoisted_19 = ["src"];
|
|
|
31441
31445
|
iAmHere();
|
|
31442
31446
|
window.setTimeout(() => {
|
|
31443
31447
|
setRecording();
|
|
31444
|
-
},
|
|
31448
|
+
}, 2000);
|
|
31445
31449
|
}
|
|
31446
31450
|
};
|
|
31447
31451
|
const throttle = (func, wait) => {
|
|
@@ -31468,7 +31472,9 @@ const _hoisted_19 = ["src"];
|
|
|
31468
31472
|
recognition.onresult = function (event) {
|
|
31469
31473
|
var last = event.results.length - 1;
|
|
31470
31474
|
var text = event.results[last][0].transcript;
|
|
31471
|
-
|
|
31475
|
+
if (props.isDebug) {
|
|
31476
|
+
console.log("你说的是: " + text);
|
|
31477
|
+
}
|
|
31472
31478
|
if (state.recorderCode === 0) {
|
|
31473
31479
|
discernHere(text);
|
|
31474
31480
|
}
|
|
@@ -31493,79 +31499,82 @@ const _hoisted_19 = ["src"];
|
|
|
31493
31499
|
|
|
31494
31500
|
// 唤醒后的录音
|
|
31495
31501
|
const setRecording = () => {
|
|
31496
|
-
state.recorder.stop();
|
|
31497
|
-
state.recorder.start()
|
|
31498
|
-
|
|
31499
|
-
|
|
31500
|
-
|
|
31501
|
-
|
|
31502
|
-
|
|
31503
|
-
|
|
31504
|
-
|
|
31505
|
-
|
|
31506
|
-
|
|
31507
|
-
|
|
31508
|
-
|
|
31509
|
-
|
|
31510
|
-
|
|
31511
|
-
|
|
31512
|
-
state.recorderCode = 0;
|
|
31513
|
-
let formData = new FormData();
|
|
31514
|
-
formData.append("modelName", "medium");
|
|
31515
|
-
formData.append("audio", fileOfBlob);
|
|
31516
|
-
uploadWavFile(formData).then(result => {
|
|
31517
|
-
let res = result.data;
|
|
31518
|
-
if (res.code == 200) {
|
|
31519
|
-
let {
|
|
31520
|
-
answer: audioToText
|
|
31521
|
-
} = res.detail.content;
|
|
31522
|
-
let text = audioToText;
|
|
31523
|
-
|
|
31524
|
-
// let text = "回到2023年7月22日时刻";
|
|
31525
|
-
|
|
31526
|
-
// 拿到的语音进行问答
|
|
31527
|
-
let option = {
|
|
31528
|
-
searchText: text,
|
|
31529
|
-
use_tts: "True",
|
|
31530
|
-
coze_info: props.cozeInfo || {}
|
|
31531
|
-
};
|
|
31532
|
-
searchText(option).then(q => {
|
|
31533
|
-
let data = q.data;
|
|
31534
|
-
if (data && data.code == 200) {
|
|
31535
|
-
// 检索场景
|
|
31536
|
-
// matching(text, data.detail[0]);
|
|
31537
|
-
|
|
31538
|
-
// 讲回答后的内容返回给业务系统
|
|
31539
|
-
if (props.searchTextCallback) {
|
|
31540
|
-
props.searchTextCallback(data.detail[0]);
|
|
31541
|
-
}
|
|
31542
|
-
let {
|
|
31543
|
-
ttsMaleAddress
|
|
31544
|
-
} = data.detail[0];
|
|
31545
|
-
// 播放回答内容和进行小G动作
|
|
31546
|
-
if (ttsMaleAddress) {
|
|
31547
|
-
playAudio(ttsMaleAddress, "sys");
|
|
31548
|
-
}
|
|
31549
|
-
// if (state.findMatch && state.findMatch.fun) {
|
|
31550
|
-
// if (state.findMatch.trigger == "together") {
|
|
31551
|
-
// state.findMatch.fun({
|
|
31552
|
-
// ...data.detail[0],
|
|
31553
|
-
// });
|
|
31554
|
-
// }
|
|
31555
|
-
// }
|
|
31556
|
-
}
|
|
31557
|
-
}).catch(err => {
|
|
31558
|
-
console.error("问答错误");
|
|
31559
|
-
console.error(err);
|
|
31560
|
-
});
|
|
31502
|
+
// state.recorder.stop();
|
|
31503
|
+
state.recorder.start().then(() => {
|
|
31504
|
+
window.setTimeout(() => {
|
|
31505
|
+
let wavBlob = state.recorder.getWAVBlob();
|
|
31506
|
+
let newbolb = new Blob([wavBlob], {
|
|
31507
|
+
type: "audio/wav"
|
|
31508
|
+
});
|
|
31509
|
+
//获取当时时间戳作为文件名
|
|
31510
|
+
let fileOfBlob = new File([newbolb], new Date().getTime() + ".wav");
|
|
31511
|
+
|
|
31512
|
+
// 本地播放录音文件流
|
|
31513
|
+
if (props.isDebug) {
|
|
31514
|
+
let sound = new Audio();
|
|
31515
|
+
let src = URL.createObjectURL(fileOfBlob);
|
|
31516
|
+
sound.src = src;
|
|
31517
|
+
sound.play();
|
|
31561
31518
|
}
|
|
31562
|
-
|
|
31563
|
-
|
|
31564
|
-
|
|
31565
|
-
|
|
31519
|
+
state.recorder.stop();
|
|
31520
|
+
state.recorderCode = 0;
|
|
31521
|
+
let formData = new FormData();
|
|
31522
|
+
formData.append("modelName", "medium");
|
|
31523
|
+
formData.append("audio", fileOfBlob);
|
|
31524
|
+
uploadWavFile(formData).then(result => {
|
|
31525
|
+
let res = result.data;
|
|
31526
|
+
if (res.code == 200) {
|
|
31527
|
+
let {
|
|
31528
|
+
answer: audioToText
|
|
31529
|
+
} = res.detail.content;
|
|
31530
|
+
let text = audioToText;
|
|
31531
|
+
|
|
31532
|
+
// let text = "回到2023年7月22日时刻";
|
|
31533
|
+
|
|
31534
|
+
// 拿到的语音进行问答
|
|
31535
|
+
let option = {
|
|
31536
|
+
searchText: text,
|
|
31537
|
+
use_tts: "True",
|
|
31538
|
+
coze_info: props.cozeInfo || {}
|
|
31539
|
+
};
|
|
31540
|
+
searchText(option).then(q => {
|
|
31541
|
+
let data = q.data;
|
|
31542
|
+
if (data && data.code == 200) {
|
|
31543
|
+
// 检索场景
|
|
31544
|
+
// matching(text, data.detail[0]);
|
|
31545
|
+
|
|
31546
|
+
// 讲回答后的内容返回给业务系统
|
|
31547
|
+
if (props.searchTextCallback) {
|
|
31548
|
+
props.searchTextCallback(data.detail[0]);
|
|
31549
|
+
}
|
|
31550
|
+
let {
|
|
31551
|
+
ttsMaleAddress
|
|
31552
|
+
} = data.detail[0];
|
|
31553
|
+
// 播放回答内容和进行小G动作
|
|
31554
|
+
if (ttsMaleAddress) {
|
|
31555
|
+
playAudio(ttsMaleAddress, "sys");
|
|
31556
|
+
}
|
|
31557
|
+
// if (state.findMatch && state.findMatch.fun) {
|
|
31558
|
+
// if (state.findMatch.trigger == "together") {
|
|
31559
|
+
// state.findMatch.fun({
|
|
31560
|
+
// ...data.detail[0],
|
|
31561
|
+
// });
|
|
31562
|
+
// }
|
|
31563
|
+
// }
|
|
31564
|
+
}
|
|
31565
|
+
}).catch(err => {
|
|
31566
|
+
console.error("问答错误");
|
|
31567
|
+
console.error(err);
|
|
31568
|
+
});
|
|
31569
|
+
}
|
|
31570
|
+
}).catch(err => {
|
|
31571
|
+
console.error("语音识别错误");
|
|
31572
|
+
console.error(err);
|
|
31573
|
+
});
|
|
31566
31574
|
|
|
31567
|
-
|
|
31568
|
-
|
|
31575
|
+
// recognition.start();
|
|
31576
|
+
}, 5 * 1000);
|
|
31577
|
+
});
|
|
31569
31578
|
};
|
|
31570
31579
|
const sendRecorder = () => {
|
|
31571
31580
|
let wavBlob = state.recorder.getWAVBlob();
|
|
@@ -32020,15 +32029,15 @@ const _hoisted_19 = ["src"];
|
|
|
32020
32029
|
});
|
|
32021
32030
|
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=script&setup=true&lang=js
|
|
32022
32031
|
|
|
32023
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=0&id=
|
|
32032
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=0&id=7ed14ae0&lang=css
|
|
32024
32033
|
// extracted by mini-css-extract-plugin
|
|
32025
32034
|
|
|
32026
|
-
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=0&id=
|
|
32035
|
+
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=0&id=7ed14ae0&lang=css
|
|
32027
32036
|
|
|
32028
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=1&id=
|
|
32037
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=1&id=7ed14ae0&lang=less&scoped=true
|
|
32029
32038
|
// extracted by mini-css-extract-plugin
|
|
32030
32039
|
|
|
32031
|
-
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=1&id=
|
|
32040
|
+
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=1&id=7ed14ae0&lang=less&scoped=true
|
|
32032
32041
|
|
|
32033
32042
|
// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
|
|
32034
32043
|
var exportHelper = __webpack_require__(6262);
|
|
@@ -32040,7 +32049,7 @@ var exportHelper = __webpack_require__(6262);
|
|
|
32040
32049
|
|
|
32041
32050
|
|
|
32042
32051
|
|
|
32043
|
-
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(mainvue_type_script_setup_true_lang_js, [['__scopeId',"data-v-
|
|
32052
|
+
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(mainvue_type_script_setup_true_lang_js, [['__scopeId',"data-v-7ed14ae0"]])
|
|
32044
32053
|
|
|
32045
32054
|
/* harmony default export */ var main = (__exports__);
|
|
32046
32055
|
;// CONCATENATED MODULE: ./src/package/index.js
|
package/dist/g-ai-robot3.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ellipsisText{display:inline-block;width:20px;height:24px;position:relative}.ellipsisText:after{position:absolute;left:0;top:4px;content:"···";animation:loading-animation 1s linear infinite}@keyframes loading-animation{0%{content:"·"}50%{content:"··"}to{content:"···"}}#g-ai-robat[data-v-
|
|
1
|
+
.ellipsisText{display:inline-block;width:20px;height:24px;position:relative}.ellipsisText:after{position:absolute;left:0;top:4px;content:"···";animation:loading-animation 1s linear infinite}@keyframes loading-animation{0%{content:"·"}50%{content:"··"}to{content:"···"}}#g-ai-robat[data-v-7ed14ae0]{position:fixed}#g-ai-robat .robot[data-v-7ed14ae0]{cursor:pointer}#g-ai-robat .robot.disabled[data-v-7ed14ae0]{cursor:not-allowed}#g-ai-robat .robot img[data-v-7ed14ae0]{height:100px;width:100px}#g-ai-robat .talk_main[data-v-7ed14ae0]{position:absolute;width:400px;height:600px;background:#f5f6f7}#g-ai-robat .talk_main.top[data-v-7ed14ae0]{left:50%;bottom:100px;transform:translateX(-50%)}#g-ai-robat .talk_main.bottom[data-v-7ed14ae0]{left:50%;top:100px;transform:translateX(-50%)}#g-ai-robat .talk_main.right[data-v-7ed14ae0]{left:100px;bottom:50%;transform:translateY(50%)}#g-ai-robat .talk_main.left[data-v-7ed14ae0]{right:100px;bottom:50%;transform:translateY(50%)}#g-ai-robat .talk_main.top-end[data-v-7ed14ae0]{left:100px;bottom:100px}#g-ai-robat .talk_main.top-start[data-v-7ed14ae0]{right:100px;bottom:100px}#g-ai-robat .talk_main.bottom-start[data-v-7ed14ae0]{right:100px;top:100px}#g-ai-robat .talk_main.bottom-end[data-v-7ed14ae0]{left:100px;top:100px}#g-ai-robat .talk_main header[data-v-7ed14ae0]{height:44px;background:linear-gradient(90deg,#ebf1ff,#e5faf8,#f2ebfe);display:flex;padding:0 16px;align-items:center;justify-content:space-between;cursor:move}#g-ai-robat .talk_main header span[data-v-7ed14ae0]{font-size:16px;font-weight:700}#g-ai-robat .talk_main header span.close[data-v-7ed14ae0]{color:#999}#g-ai-robat .talk_main header i[data-v-7ed14ae0]{cursor:pointer}#g-ai-robat .talk_main header i.disabled[data-v-7ed14ae0]{cursor:not-allowed}#g-ai-robat .talk_main .qa_body[data-v-7ed14ae0]{list-style:none;padding:16px;box-sizing:border-box;margin:0;height:calc(100% - 116px);overflow-y:auto}#g-ai-robat .talk_main .qa_body[data-v-7ed14ae0]::-webkit-scrollbar{width:8px;background-color:#f9f9f9}#g-ai-robat .talk_main .qa_body[data-v-7ed14ae0]::-webkit-scrollbar-track{background:#e1e1e1;border-radius:10px}#g-ai-robat .talk_main .qa_body[data-v-7ed14ae0]::-webkit-scrollbar-thumb{background-color:#c1c1c1;border-radius:10px}#g-ai-robat .talk_main .qa_body li[data-v-7ed14ae0]{display:flex;margin-bottom:24px;justify-content:flex-end}#g-ai-robat .talk_main .qa_body li .is_icon[data-v-7ed14ae0]{width:30px;height:30px;border-radius:50%;color:#fff;display:flex}#g-ai-robat .talk_main .qa_body li .is_icon i[data-v-7ed14ae0]{margin:auto}#g-ai-robat .talk_main .qa_body li.is_ai[data-v-7ed14ae0]{justify-content:flex-start}#g-ai-robat .talk_main .qa_body li.is_ai .text_main[data-v-7ed14ae0]{box-shadow:0 4px 20px 0 #0476ed29;border:1px solid;border-image-source:linear-gradient(180deg,#fff,hsla(0,0%,100%,.5) 104.31%);background:linear-gradient(92.03deg,rgba(119,241,255,.222) -2.18%,rgba(237,250,255,.6) 48.06%,rgba(91,168,255,.174) 107.05%)}#g-ai-robat .talk_main .qa_body li.is_ai .text_main>.value[data-v-7ed14ae0]{white-space:pre-wrap}#g-ai-robat .talk_main .qa_body li .text_main[data-v-7ed14ae0]{padding:10px;max-width:calc(100% - 100px);border:1px solid;margin:0 8px;border-image-source:linear-gradient(90deg,#fff,hsla(0,0%,100%,.5));box-shadow:0 4px 20px 0 #0476ed29;background:linear-gradient(90.81deg,rgba(244,252,255,.6) 1.75%,hsla(0,0%,100%,.6) 32.33%,rgba(238,246,255,.6) 102.86%);border-radius:6px}#g-ai-robat .talk_main .qa_body li .text_main>.value[data-v-7ed14ae0]{display:flex;align-items:center;overflow-wrap:break-word;word-wrap:break-word;font-size:14px;font-weight:400}#g-ai-robat .talk_main .qa_body li .text_main .btn i[data-v-7ed14ae0]{font-size:14px;font-weight:400;color:#037aff;margin-right:10px;cursor:pointer;text-decoration:underline}#g-ai-robat .talk_main .qa_body li .text_main .btn i.open[data-v-7ed14ae0]{filter:hue-rotate(180deg);animation:opacityCss 2s linear infinite}#g-ai-robat .talk_main .qa_input[data-v-7ed14ae0]{padding:10px 16px;display:flex;align-items:center;justify-content:space-between;position:absolute;bottom:0;left:0;right:0;box-sizing:border-box}#g-ai-robat .talk_main .qa_input textarea[data-v-7ed14ae0]{width:100%;height:68px;resize:none;background-color:#fff;border:1px solid #dcdfe6;color:#606266;padding:6px}#g-ai-robat .talk_main .qa_input textarea[data-v-7ed14ae0]:focus{outline:none;border-color:#409eff}#g-ai-robat .talk_main .qa_input .is_icon[data-v-7ed14ae0]{width:30px}#g-ai-robat .talk_main .qa_input .is_icon p[data-v-7ed14ae0]{display:flex;align-items:center;justify-content:flex-end;margin:6px 0}#g-ai-robat .talk_main .qa_input .is_icon p[data-v-7ed14ae0]:first-of-type{position:relative}#g-ai-robat .talk_main .qa_input .is_icon p:first-of-type #playChart[data-v-7ed14ae0]{bottom:30px;position:absolute;visibility:hidden}#g-ai-robat .talk_main .qa_input .is_icon p:first-of-type #playChart.show[data-v-7ed14ae0]{visibility:visible}#g-ai-robat .talk_main .qa_input .is_icon p:first-of-type #playChart.hiddle[data-v-7ed14ae0]{visibility:hidden}#g-ai-robat .talk_main .qa_input .is_icon p i[data-v-7ed14ae0]{animation:rotateCss-7ed14ae0 2s linear infinite;font-size:20px;color:#606266}#g-ai-robat .talk_main .qa_input .is_icon p img[data-v-7ed14ae0]{width:20px;height:20px;cursor:pointer}#g-ai-robat .talk_main .qa_input .is_icon p img.close[data-v-7ed14ae0]{filter:hue-rotate(180deg);animation:opacityCss 2s linear infinite}#g-ai-robat .talk_main .qa_input .is_icon p.send img.disabled[data-v-7ed14ae0]{cursor:not-allowed}#g-ai-robat .talk_main .qa_input .is_icon p i[data-v-7ed14ae0]{cursor:pointer}@keyframes rotateCss-7ed14ae0{0%{transform:rotate(0deg)}25%{transform:rotate(90deg)}50%{transform:rotate(180deg)}70%{transform:rotate(270deg)}to{transform:rotate(1turn)}}@font-face{font-family:iconfont;src:url(//at.alicdn.com/t/c/font_4633255_xm549qw7rxj.woff2?t=1721900327001) format("woff2"),url(//at.alicdn.com/t/c/font_4633255_xm549qw7rxj.woff?t=1721900327001) format("woff"),url(//at.alicdn.com/t/c/font_4633255_xm549qw7rxj.ttf?t=1721900327001) format("truetype")}.iconfont[data-v-7ed14ae0]{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-guanbi[data-v-7ed14ae0]:before{content:"\e609"}.icon-nvsheng[data-v-7ed14ae0]:before{content:"\e603"}.icon-nansheng[data-v-7ed14ae0]:before{content:"\e604"}.icon-fuzhi[data-v-7ed14ae0]:before{content:"\e626"}.icon-zhongxinhuida[data-v-7ed14ae0]:before{content:"\e63b"}
|
package/dist/g-ai-robot3.umd.js
CHANGED
|
@@ -31235,7 +31235,7 @@ function segment(word, options) {
|
|
|
31235
31235
|
|
|
31236
31236
|
|
|
31237
31237
|
|
|
31238
|
-
const _withScopeId = n => (_pushScopeId("data-v-
|
|
31238
|
+
const _withScopeId = n => (_pushScopeId("data-v-7ed14ae0"), n = n(), _popScopeId(), n);
|
|
31239
31239
|
const _hoisted_1 = ["src"];
|
|
31240
31240
|
const _hoisted_2 = {
|
|
31241
31241
|
key: 0,
|
|
@@ -31286,6 +31286,10 @@ const _hoisted_19 = ["src"];
|
|
|
31286
31286
|
/* harmony default export */ var mainvue_type_script_setup_true_lang_js = ({
|
|
31287
31287
|
__name: 'main',
|
|
31288
31288
|
props: {
|
|
31289
|
+
isDebug: {
|
|
31290
|
+
type: Boolean,
|
|
31291
|
+
default: true
|
|
31292
|
+
},
|
|
31289
31293
|
title: {
|
|
31290
31294
|
type: String,
|
|
31291
31295
|
default: "GR水利大模型"
|
|
@@ -31459,7 +31463,7 @@ const _hoisted_19 = ["src"];
|
|
|
31459
31463
|
iAmHere();
|
|
31460
31464
|
window.setTimeout(() => {
|
|
31461
31465
|
setRecording();
|
|
31462
|
-
},
|
|
31466
|
+
}, 2000);
|
|
31463
31467
|
}
|
|
31464
31468
|
};
|
|
31465
31469
|
const throttle = (func, wait) => {
|
|
@@ -31486,7 +31490,9 @@ const _hoisted_19 = ["src"];
|
|
|
31486
31490
|
recognition.onresult = function (event) {
|
|
31487
31491
|
var last = event.results.length - 1;
|
|
31488
31492
|
var text = event.results[last][0].transcript;
|
|
31489
|
-
|
|
31493
|
+
if (props.isDebug) {
|
|
31494
|
+
console.log("你说的是: " + text);
|
|
31495
|
+
}
|
|
31490
31496
|
if (state.recorderCode === 0) {
|
|
31491
31497
|
discernHere(text);
|
|
31492
31498
|
}
|
|
@@ -31511,79 +31517,82 @@ const _hoisted_19 = ["src"];
|
|
|
31511
31517
|
|
|
31512
31518
|
// 唤醒后的录音
|
|
31513
31519
|
const setRecording = () => {
|
|
31514
|
-
state.recorder.stop();
|
|
31515
|
-
state.recorder.start()
|
|
31516
|
-
|
|
31517
|
-
|
|
31518
|
-
|
|
31519
|
-
|
|
31520
|
-
|
|
31521
|
-
|
|
31522
|
-
|
|
31523
|
-
|
|
31524
|
-
|
|
31525
|
-
|
|
31526
|
-
|
|
31527
|
-
|
|
31528
|
-
|
|
31529
|
-
|
|
31530
|
-
state.recorderCode = 0;
|
|
31531
|
-
let formData = new FormData();
|
|
31532
|
-
formData.append("modelName", "medium");
|
|
31533
|
-
formData.append("audio", fileOfBlob);
|
|
31534
|
-
uploadWavFile(formData).then(result => {
|
|
31535
|
-
let res = result.data;
|
|
31536
|
-
if (res.code == 200) {
|
|
31537
|
-
let {
|
|
31538
|
-
answer: audioToText
|
|
31539
|
-
} = res.detail.content;
|
|
31540
|
-
let text = audioToText;
|
|
31541
|
-
|
|
31542
|
-
// let text = "回到2023年7月22日时刻";
|
|
31543
|
-
|
|
31544
|
-
// 拿到的语音进行问答
|
|
31545
|
-
let option = {
|
|
31546
|
-
searchText: text,
|
|
31547
|
-
use_tts: "True",
|
|
31548
|
-
coze_info: props.cozeInfo || {}
|
|
31549
|
-
};
|
|
31550
|
-
searchText(option).then(q => {
|
|
31551
|
-
let data = q.data;
|
|
31552
|
-
if (data && data.code == 200) {
|
|
31553
|
-
// 检索场景
|
|
31554
|
-
// matching(text, data.detail[0]);
|
|
31555
|
-
|
|
31556
|
-
// 讲回答后的内容返回给业务系统
|
|
31557
|
-
if (props.searchTextCallback) {
|
|
31558
|
-
props.searchTextCallback(data.detail[0]);
|
|
31559
|
-
}
|
|
31560
|
-
let {
|
|
31561
|
-
ttsMaleAddress
|
|
31562
|
-
} = data.detail[0];
|
|
31563
|
-
// 播放回答内容和进行小G动作
|
|
31564
|
-
if (ttsMaleAddress) {
|
|
31565
|
-
playAudio(ttsMaleAddress, "sys");
|
|
31566
|
-
}
|
|
31567
|
-
// if (state.findMatch && state.findMatch.fun) {
|
|
31568
|
-
// if (state.findMatch.trigger == "together") {
|
|
31569
|
-
// state.findMatch.fun({
|
|
31570
|
-
// ...data.detail[0],
|
|
31571
|
-
// });
|
|
31572
|
-
// }
|
|
31573
|
-
// }
|
|
31574
|
-
}
|
|
31575
|
-
}).catch(err => {
|
|
31576
|
-
console.error("问答错误");
|
|
31577
|
-
console.error(err);
|
|
31578
|
-
});
|
|
31520
|
+
// state.recorder.stop();
|
|
31521
|
+
state.recorder.start().then(() => {
|
|
31522
|
+
window.setTimeout(() => {
|
|
31523
|
+
let wavBlob = state.recorder.getWAVBlob();
|
|
31524
|
+
let newbolb = new Blob([wavBlob], {
|
|
31525
|
+
type: "audio/wav"
|
|
31526
|
+
});
|
|
31527
|
+
//获取当时时间戳作为文件名
|
|
31528
|
+
let fileOfBlob = new File([newbolb], new Date().getTime() + ".wav");
|
|
31529
|
+
|
|
31530
|
+
// 本地播放录音文件流
|
|
31531
|
+
if (props.isDebug) {
|
|
31532
|
+
let sound = new Audio();
|
|
31533
|
+
let src = URL.createObjectURL(fileOfBlob);
|
|
31534
|
+
sound.src = src;
|
|
31535
|
+
sound.play();
|
|
31579
31536
|
}
|
|
31580
|
-
|
|
31581
|
-
|
|
31582
|
-
|
|
31583
|
-
|
|
31537
|
+
state.recorder.stop();
|
|
31538
|
+
state.recorderCode = 0;
|
|
31539
|
+
let formData = new FormData();
|
|
31540
|
+
formData.append("modelName", "medium");
|
|
31541
|
+
formData.append("audio", fileOfBlob);
|
|
31542
|
+
uploadWavFile(formData).then(result => {
|
|
31543
|
+
let res = result.data;
|
|
31544
|
+
if (res.code == 200) {
|
|
31545
|
+
let {
|
|
31546
|
+
answer: audioToText
|
|
31547
|
+
} = res.detail.content;
|
|
31548
|
+
let text = audioToText;
|
|
31549
|
+
|
|
31550
|
+
// let text = "回到2023年7月22日时刻";
|
|
31551
|
+
|
|
31552
|
+
// 拿到的语音进行问答
|
|
31553
|
+
let option = {
|
|
31554
|
+
searchText: text,
|
|
31555
|
+
use_tts: "True",
|
|
31556
|
+
coze_info: props.cozeInfo || {}
|
|
31557
|
+
};
|
|
31558
|
+
searchText(option).then(q => {
|
|
31559
|
+
let data = q.data;
|
|
31560
|
+
if (data && data.code == 200) {
|
|
31561
|
+
// 检索场景
|
|
31562
|
+
// matching(text, data.detail[0]);
|
|
31563
|
+
|
|
31564
|
+
// 讲回答后的内容返回给业务系统
|
|
31565
|
+
if (props.searchTextCallback) {
|
|
31566
|
+
props.searchTextCallback(data.detail[0]);
|
|
31567
|
+
}
|
|
31568
|
+
let {
|
|
31569
|
+
ttsMaleAddress
|
|
31570
|
+
} = data.detail[0];
|
|
31571
|
+
// 播放回答内容和进行小G动作
|
|
31572
|
+
if (ttsMaleAddress) {
|
|
31573
|
+
playAudio(ttsMaleAddress, "sys");
|
|
31574
|
+
}
|
|
31575
|
+
// if (state.findMatch && state.findMatch.fun) {
|
|
31576
|
+
// if (state.findMatch.trigger == "together") {
|
|
31577
|
+
// state.findMatch.fun({
|
|
31578
|
+
// ...data.detail[0],
|
|
31579
|
+
// });
|
|
31580
|
+
// }
|
|
31581
|
+
// }
|
|
31582
|
+
}
|
|
31583
|
+
}).catch(err => {
|
|
31584
|
+
console.error("问答错误");
|
|
31585
|
+
console.error(err);
|
|
31586
|
+
});
|
|
31587
|
+
}
|
|
31588
|
+
}).catch(err => {
|
|
31589
|
+
console.error("语音识别错误");
|
|
31590
|
+
console.error(err);
|
|
31591
|
+
});
|
|
31584
31592
|
|
|
31585
|
-
|
|
31586
|
-
|
|
31593
|
+
// recognition.start();
|
|
31594
|
+
}, 5 * 1000);
|
|
31595
|
+
});
|
|
31587
31596
|
};
|
|
31588
31597
|
const sendRecorder = () => {
|
|
31589
31598
|
let wavBlob = state.recorder.getWAVBlob();
|
|
@@ -32038,15 +32047,15 @@ const _hoisted_19 = ["src"];
|
|
|
32038
32047
|
});
|
|
32039
32048
|
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=script&setup=true&lang=js
|
|
32040
32049
|
|
|
32041
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=0&id=
|
|
32050
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=0&id=7ed14ae0&lang=css
|
|
32042
32051
|
// extracted by mini-css-extract-plugin
|
|
32043
32052
|
|
|
32044
|
-
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=0&id=
|
|
32053
|
+
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=0&id=7ed14ae0&lang=css
|
|
32045
32054
|
|
|
32046
|
-
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-74.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-74.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-74.use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-74.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=1&id=
|
|
32055
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-74.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-74.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-74.use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-74.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/src/main.vue?vue&type=style&index=1&id=7ed14ae0&lang=less&scoped=true
|
|
32047
32056
|
// extracted by mini-css-extract-plugin
|
|
32048
32057
|
|
|
32049
|
-
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=1&id=
|
|
32058
|
+
;// CONCATENATED MODULE: ./src/package/src/main.vue?vue&type=style&index=1&id=7ed14ae0&lang=less&scoped=true
|
|
32050
32059
|
|
|
32051
32060
|
// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
|
|
32052
32061
|
var exportHelper = __webpack_require__(6262);
|
|
@@ -32058,7 +32067,7 @@ var exportHelper = __webpack_require__(6262);
|
|
|
32058
32067
|
|
|
32059
32068
|
|
|
32060
32069
|
|
|
32061
|
-
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(mainvue_type_script_setup_true_lang_js, [['__scopeId',"data-v-
|
|
32070
|
+
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(mainvue_type_script_setup_true_lang_js, [['__scopeId',"data-v-7ed14ae0"]])
|
|
32062
32071
|
|
|
32063
32072
|
/* harmony default export */ var main = (__exports__);
|
|
32064
32073
|
;// CONCATENATED MODULE: ./src/package/index.js
|