byt-lingxiao-ai 0.2.5 → 0.2.7
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/components/AiMessage.vue +109 -0
- package/components/ChatAvatar.vue +86 -0
- package/components/ChatInputBox.vue +127 -0
- package/components/ChatMessageList.vue +81 -0
- package/components/ChatRobot.vue +38 -0
- package/components/ChatWindow.vue +90 -848
- package/components/ChatWindowDialog.vue +82 -0
- package/components/ChatWindowHeader.vue +95 -0
- package/components/UserMessage.vue +35 -0
- package/components/mixins/audioMixin.js +122 -0
- package/components/mixins/messageMixin.js +158 -0
- package/components/mixins/webSocketMixin.js +94 -0
- package/components/utils/StreamParser.js +277 -0
- package/dist/index.common.js +1399 -654
- package/dist/index.common.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.umd.js +1399 -654
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -3746,7 +3746,7 @@ if (typeof window !== 'undefined') {
|
|
|
3746
3746
|
var es_iterator_constructor = __webpack_require__(8111);
|
|
3747
3747
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
|
|
3748
3748
|
var es_iterator_for_each = __webpack_require__(7588);
|
|
3749
|
-
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindow.vue?vue&type=template&id=
|
|
3749
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindow.vue?vue&type=template&id=5792943c&scoped=true
|
|
3750
3750
|
var render = function render() {
|
|
3751
3751
|
var _vm = this,
|
|
3752
3752
|
_c = _vm._self._c;
|
|
@@ -3764,172 +3764,44 @@ var render = function render() {
|
|
|
3764
3764
|
"src": _vm.audioSrc,
|
|
3765
3765
|
"type": "audio/mpeg"
|
|
3766
3766
|
}
|
|
3767
|
-
}), _vm._v(" 您的浏览器不支持音频元素。 ")]), _vm.robotStatus !== 'leaving' ? _c('
|
|
3768
|
-
class: ['chat-robot', _vm.robotStatus]
|
|
3769
|
-
}) : _c('div', {
|
|
3770
|
-
staticClass: "chat-ai",
|
|
3771
|
-
on: {
|
|
3772
|
-
"click": _vm.toggleWindow
|
|
3773
|
-
}
|
|
3774
|
-
}, [_c('div', {
|
|
3775
|
-
class: ['chat-ai-avater', _vm.avaterStatus]
|
|
3776
|
-
}), _c('div', {
|
|
3777
|
-
staticClass: "chat-ai-text"
|
|
3778
|
-
}, [_vm._v(_vm._s(_vm.avaterText))])]), _c('div', {
|
|
3779
|
-
directives: [{
|
|
3780
|
-
name: "show",
|
|
3781
|
-
rawName: "v-show",
|
|
3782
|
-
value: _vm.visible,
|
|
3783
|
-
expression: "visible"
|
|
3784
|
-
}],
|
|
3785
|
-
staticClass: "chat-overlay",
|
|
3786
|
-
on: {
|
|
3787
|
-
"click": _vm.handleOverlayClick
|
|
3788
|
-
}
|
|
3789
|
-
}, [_c('div', {
|
|
3790
|
-
staticClass: "chat-window",
|
|
3791
|
-
on: {
|
|
3792
|
-
"click": function ($event) {
|
|
3793
|
-
$event.stopPropagation();
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3796
|
-
}, [_c('div', {
|
|
3797
|
-
staticClass: "chat-window-header"
|
|
3798
|
-
}, [_c('div', {
|
|
3799
|
-
staticClass: "chat-window-header-title"
|
|
3800
|
-
}, [_vm._v("凌霄大模型AI对话")]), _c('div', {
|
|
3801
|
-
staticClass: "chat-window-header-close",
|
|
3802
|
-
on: {
|
|
3803
|
-
"click": function ($event) {
|
|
3804
|
-
_vm.visible = false;
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3807
|
-
}, [_c('svg', {
|
|
3808
|
-
attrs: {
|
|
3809
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
3810
|
-
"width": "24",
|
|
3811
|
-
"height": "24",
|
|
3812
|
-
"viewBox": "0 0 24 24",
|
|
3813
|
-
"fill": "none"
|
|
3814
|
-
}
|
|
3815
|
-
}, [_c('path', {
|
|
3767
|
+
}), _vm._v(" 您的浏览器不支持音频元素。 ")]), _vm.robotStatus !== 'leaving' ? _c('ChatRobot', {
|
|
3816
3768
|
attrs: {
|
|
3817
|
-
"
|
|
3818
|
-
"stroke": "#4E5969",
|
|
3819
|
-
"stroke-width": "1.89404",
|
|
3820
|
-
"stroke-linecap": "round",
|
|
3821
|
-
"stroke-linejoin": "round"
|
|
3769
|
+
"status": _vm.robotStatus
|
|
3822
3770
|
}
|
|
3823
|
-
})
|
|
3771
|
+
}) : _c('ChatAvatar', {
|
|
3824
3772
|
attrs: {
|
|
3825
|
-
"
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
"
|
|
3829
|
-
"stroke-linejoin": "round"
|
|
3773
|
+
"status": _vm.avaterStatus
|
|
3774
|
+
},
|
|
3775
|
+
on: {
|
|
3776
|
+
"click": _vm.toggleWindow
|
|
3830
3777
|
}
|
|
3831
|
-
})
|
|
3832
|
-
ref: "chatArea",
|
|
3833
|
-
staticClass: "chat-window-content scrollbar-hide"
|
|
3834
|
-
}, _vm._l(_vm.messages, function (message) {
|
|
3835
|
-
return _c('div', {
|
|
3836
|
-
key: message.id,
|
|
3837
|
-
staticClass: "chat-window-message"
|
|
3838
|
-
}, [message.type === 'user' ? _c('div', {
|
|
3839
|
-
staticClass: "chat-window-message-user"
|
|
3840
|
-
}, [_c('div', {
|
|
3841
|
-
staticClass: "user-message"
|
|
3842
|
-
}, [_vm._v(_vm._s(message.content))])]) : _c('div', {
|
|
3843
|
-
staticClass: "chat-window-message-ai"
|
|
3844
|
-
}, [_c('div', {
|
|
3845
|
-
staticClass: "ai-render"
|
|
3846
|
-
}, [_c('div', {
|
|
3847
|
-
staticClass: "ai-thinking"
|
|
3848
|
-
}, [_c('div', {
|
|
3849
|
-
staticClass: "ai-thinking-time"
|
|
3850
|
-
}, [_vm._v("思考用时" + _vm._s(message.time) + "秒")]), _c('div', {
|
|
3851
|
-
staticClass: "ai-thinking-content"
|
|
3852
|
-
}, [_vm._v(_vm._s(message.thinking))])]), _c('div', {
|
|
3853
|
-
staticClass: "ai-content"
|
|
3854
|
-
}, [_vm._v(_vm._s(message.content))])])])]);
|
|
3855
|
-
}), 0), _c('div', {
|
|
3856
|
-
staticClass: "chat-window-footer"
|
|
3857
|
-
}, [_c('div', {
|
|
3858
|
-
staticClass: "chat-window-textarea"
|
|
3859
|
-
}, [_c('el-input', {
|
|
3860
|
-
staticClass: "chat-window-input",
|
|
3778
|
+
}), _c('ChatWindowDialog', {
|
|
3861
3779
|
attrs: {
|
|
3862
|
-
"
|
|
3863
|
-
"
|
|
3864
|
-
"
|
|
3865
|
-
"resize": "none"
|
|
3780
|
+
"messages": _vm.messages,
|
|
3781
|
+
"input-message": _vm.inputMessage,
|
|
3782
|
+
"think-status": _vm.thinkStatus
|
|
3866
3783
|
},
|
|
3867
3784
|
on: {
|
|
3868
|
-
"
|
|
3785
|
+
"update:inputMessage": function ($event) {
|
|
3786
|
+
_vm.inputMessage = $event;
|
|
3787
|
+
},
|
|
3788
|
+
"send": _vm.handleSend,
|
|
3789
|
+
"thinking-click": _vm.handleThinkingClick,
|
|
3790
|
+
"overlay-click": _vm.handleOverlayClick
|
|
3869
3791
|
},
|
|
3870
3792
|
model: {
|
|
3871
|
-
value: _vm.
|
|
3793
|
+
value: _vm.visible,
|
|
3872
3794
|
callback: function ($$v) {
|
|
3873
|
-
_vm.
|
|
3795
|
+
_vm.visible = $$v;
|
|
3874
3796
|
},
|
|
3875
|
-
expression: "
|
|
3876
|
-
}
|
|
3877
|
-
}), _c('div', {
|
|
3878
|
-
staticClass: "chat-window-bar"
|
|
3879
|
-
}, [_c('div', {
|
|
3880
|
-
staticClass: "chat-window-send",
|
|
3881
|
-
on: {
|
|
3882
|
-
"click": _vm.handleSend
|
|
3883
|
-
}
|
|
3884
|
-
}, [_c('svg', {
|
|
3885
|
-
attrs: {
|
|
3886
|
-
"xmlns": "http://www.w3.org/2000/svg",
|
|
3887
|
-
"width": "20",
|
|
3888
|
-
"height": "20",
|
|
3889
|
-
"viewBox": "0 0 20 20",
|
|
3890
|
-
"fill": "none"
|
|
3891
|
-
}
|
|
3892
|
-
}, [_c('g', {
|
|
3893
|
-
attrs: {
|
|
3894
|
-
"clip-path": "url(#clip0_640_2107)"
|
|
3895
|
-
}
|
|
3896
|
-
}, [_c('path', {
|
|
3897
|
-
attrs: {
|
|
3898
|
-
"d": "M18.6427 2.37822C19.3253 2.47432 19.8025 3.10738 19.7065 3.79002C19.6871 3.97072 19.5381 4.41327 19.5403 4.41161L14.9673 17.8079L14.9632 17.8093C14.7858 18.3838 14.212 18.7607 13.5971 18.6744C13.4173 18.6492 13.2504 18.5862 13.1055 18.4949L13.0973 18.4977L9.83449 16.3686C9.58371 16.2584 9.4276 15.9939 9.46729 15.7115C9.5154 15.3691 9.83278 15.1317 10.1751 15.1798C10.293 15.1964 10.3988 15.2448 10.4853 15.3161L13.4054 17.2314L13.4073 17.2317C13.4452 17.2566 13.4882 17.2746 13.5364 17.2814C13.6911 17.3029 13.8371 17.2052 13.8793 17.0593L18.0469 4.89796L8.27396 14.3367L7.77435 17.8916C7.72706 18.2281 7.41369 18.464 7.07727 18.4169C6.74073 18.3696 6.50469 18.0564 6.55198 17.7198L7.07633 13.9889C7.08231 13.9464 7.09382 13.9066 7.10727 13.867C7.13549 13.7645 7.19079 13.6657 7.27291 13.5866L17.0754 4.12041L2.68514 8.17767L2.68487 8.1796C2.58481 8.21873 2.50686 8.31058 2.49042 8.42643C2.47412 8.5424 2.52417 8.65007 2.6093 8.71729L2.60903 8.71922L3.28261 9.16101L3.28013 9.16461C3.47505 9.29254 3.58819 9.52563 3.55386 9.77111C3.50575 10.1134 3.18836 10.3509 2.84602 10.3028C2.75512 10.29 2.6708 10.2584 2.59833 10.2127L2.59806 10.2147L1.37843 9.42001L1.37951 9.41227C1.02215 9.14901 0.816644 8.70195 0.882687 8.23203C0.951867 7.74096 1.29791 7.35545 1.73968 7.21445L1.73995 7.21251L17.7833 2.57104C18.0287 2.41036 18.3294 2.3342 18.6427 2.37822Z",
|
|
3899
|
-
"fill": "#013378"
|
|
3900
|
-
}
|
|
3901
|
-
}), _c('path', {
|
|
3902
|
-
attrs: {
|
|
3903
|
-
"d": "M3.1309 10.9936C3.2178 10.5684 3.82528 10.5684 3.91218 10.9936C4.10411 11.9326 4.83794 12.6664 5.77697 12.8584C6.20213 12.9453 6.20213 13.5527 5.77697 13.6397C4.83794 13.8316 4.10411 14.5654 3.91218 15.5044C3.82528 15.9296 3.2178 15.9296 3.1309 15.5044C2.93897 14.5654 2.20513 13.8316 1.26611 13.6397C0.840944 13.5527 0.840944 12.9453 1.26611 12.8584C2.20513 12.6664 2.93897 11.9326 3.1309 10.9936Z",
|
|
3904
|
-
"fill": "#2B80F6"
|
|
3905
|
-
}
|
|
3906
|
-
}), _c('path', {
|
|
3907
|
-
attrs: {
|
|
3908
|
-
"d": "M6.20382 8.56242C6.25596 8.30732 6.62045 8.30732 6.67259 8.56242C6.78775 9.12583 7.22805 9.56613 7.79146 9.68129C8.04656 9.73343 8.04656 10.0979 7.79146 10.1501C7.22805 10.2652 6.78775 10.7055 6.67259 11.2689C6.62045 11.524 6.25596 11.524 6.20382 11.2689C6.08866 10.7055 5.64836 10.2652 5.08495 10.1501C4.82985 10.0979 4.82985 9.73343 5.08495 9.68129C5.64836 9.56613 6.08866 9.12583 6.20382 8.56242Z",
|
|
3909
|
-
"fill": "#2B80F6"
|
|
3910
|
-
}
|
|
3911
|
-
})]), _c('defs', [_c('clipPath', {
|
|
3912
|
-
attrs: {
|
|
3913
|
-
"id": "clip0_640_2107"
|
|
3914
|
-
}
|
|
3915
|
-
}, [_c('rect', {
|
|
3916
|
-
attrs: {
|
|
3917
|
-
"width": "20",
|
|
3918
|
-
"height": "20",
|
|
3919
|
-
"fill": "white"
|
|
3797
|
+
expression: "visible"
|
|
3920
3798
|
}
|
|
3921
|
-
})]
|
|
3799
|
+
})], 1);
|
|
3922
3800
|
};
|
|
3923
3801
|
var staticRenderFns = [];
|
|
3924
3802
|
|
|
3925
3803
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
3926
3804
|
var es_array_push = __webpack_require__(4114);
|
|
3927
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.detached.js
|
|
3928
|
-
var es_array_buffer_detached = __webpack_require__(6573);
|
|
3929
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer.js
|
|
3930
|
-
var es_array_buffer_transfer = __webpack_require__(8100);
|
|
3931
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer-to-fixed-length.js
|
|
3932
|
-
var es_array_buffer_transfer_to_fixed_length = __webpack_require__(7936);
|
|
3933
3805
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.difference.v2.js
|
|
3934
3806
|
var es_set_difference_v2 = __webpack_require__(7642);
|
|
3935
3807
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.intersection.v2.js
|
|
@@ -3944,176 +3816,885 @@ var es_set_is_superset_of_v2 = __webpack_require__(2475);
|
|
|
3944
3816
|
var es_set_symmetric_difference_v2 = __webpack_require__(5024);
|
|
3945
3817
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
|
|
3946
3818
|
var es_set_union_v2 = __webpack_require__(1698);
|
|
3947
|
-
|
|
3948
|
-
var
|
|
3949
|
-
|
|
3819
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatRobot.vue?vue&type=template&id=3d936cb2&scoped=true
|
|
3820
|
+
var ChatRobotvue_type_template_id_3d936cb2_scoped_true_render = function render() {
|
|
3821
|
+
var _vm = this,
|
|
3822
|
+
_c = _vm._self._c;
|
|
3823
|
+
return _c('div', {
|
|
3824
|
+
class: ['chat-robot', _vm.status]
|
|
3825
|
+
});
|
|
3826
|
+
};
|
|
3827
|
+
var ChatRobotvue_type_template_id_3d936cb2_scoped_true_staticRenderFns = [];
|
|
3828
|
+
|
|
3829
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatRobot.vue?vue&type=script&lang=js
|
|
3830
|
+
/* harmony default export */ var ChatRobotvue_type_script_lang_js = ({
|
|
3831
|
+
name: 'ChatRobot',
|
|
3832
|
+
props: {
|
|
3833
|
+
status: {
|
|
3834
|
+
type: String,
|
|
3835
|
+
required: true,
|
|
3836
|
+
validator: value => ['entering', 'waiting', 'speaking'].includes(value)
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
});
|
|
3840
|
+
;// ./components/ChatRobot.vue?vue&type=script&lang=js
|
|
3841
|
+
/* harmony default export */ var components_ChatRobotvue_type_script_lang_js = (ChatRobotvue_type_script_lang_js);
|
|
3842
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatRobot.vue?vue&type=style&index=0&id=3d936cb2&prod&scoped=true&lang=css
|
|
3843
|
+
// extracted by mini-css-extract-plugin
|
|
3844
|
+
|
|
3845
|
+
;// ./components/ChatRobot.vue?vue&type=style&index=0&id=3d936cb2&prod&scoped=true&lang=css
|
|
3846
|
+
|
|
3847
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
3848
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
3849
|
+
|
|
3850
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
3851
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
3852
|
+
// be included in the final webpack user bundle.
|
|
3853
|
+
|
|
3854
|
+
function normalizeComponent(
|
|
3855
|
+
scriptExports,
|
|
3856
|
+
render,
|
|
3857
|
+
staticRenderFns,
|
|
3858
|
+
functionalTemplate,
|
|
3859
|
+
injectStyles,
|
|
3860
|
+
scopeId,
|
|
3861
|
+
moduleIdentifier /* server only */,
|
|
3862
|
+
shadowMode /* vue-cli only */
|
|
3863
|
+
) {
|
|
3864
|
+
// Vue.extend constructor export interop
|
|
3865
|
+
var options =
|
|
3866
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
3867
|
+
|
|
3868
|
+
// render functions
|
|
3869
|
+
if (render) {
|
|
3870
|
+
options.render = render
|
|
3871
|
+
options.staticRenderFns = staticRenderFns
|
|
3872
|
+
options._compiled = true
|
|
3873
|
+
}
|
|
3950
3874
|
|
|
3875
|
+
// functional template
|
|
3876
|
+
if (functionalTemplate) {
|
|
3877
|
+
options.functional = true
|
|
3878
|
+
}
|
|
3951
3879
|
|
|
3880
|
+
// scopedId
|
|
3881
|
+
if (scopeId) {
|
|
3882
|
+
options._scopeId = 'data-v-' + scopeId
|
|
3883
|
+
}
|
|
3952
3884
|
|
|
3885
|
+
var hook
|
|
3886
|
+
if (moduleIdentifier) {
|
|
3887
|
+
// server build
|
|
3888
|
+
hook = function (context) {
|
|
3889
|
+
// 2.3 injection
|
|
3890
|
+
context =
|
|
3891
|
+
context || // cached call
|
|
3892
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
3893
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
3894
|
+
// 2.2 with runInNewContext: true
|
|
3895
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
3896
|
+
context = __VUE_SSR_CONTEXT__
|
|
3897
|
+
}
|
|
3898
|
+
// inject component styles
|
|
3899
|
+
if (injectStyles) {
|
|
3900
|
+
injectStyles.call(this, context)
|
|
3901
|
+
}
|
|
3902
|
+
// register component module identifier for async chunk inferrence
|
|
3903
|
+
if (context && context._registeredComponents) {
|
|
3904
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
// used by ssr in case component is cached and beforeCreate
|
|
3908
|
+
// never gets called
|
|
3909
|
+
options._ssrRegister = hook
|
|
3910
|
+
} else if (injectStyles) {
|
|
3911
|
+
hook = shadowMode
|
|
3912
|
+
? function () {
|
|
3913
|
+
injectStyles.call(
|
|
3914
|
+
this,
|
|
3915
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
3916
|
+
)
|
|
3917
|
+
}
|
|
3918
|
+
: injectStyles
|
|
3919
|
+
}
|
|
3953
3920
|
|
|
3921
|
+
if (hook) {
|
|
3922
|
+
if (options.functional) {
|
|
3923
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
3924
|
+
// go through the normalizer
|
|
3925
|
+
options._injectStyles = hook
|
|
3926
|
+
// register for functional component in vue file
|
|
3927
|
+
var originalRender = options.render
|
|
3928
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
3929
|
+
hook.call(context)
|
|
3930
|
+
return originalRender(h, context)
|
|
3931
|
+
}
|
|
3932
|
+
} else {
|
|
3933
|
+
// inject component registration as beforeCreate hook
|
|
3934
|
+
var existing = options.beforeCreate
|
|
3935
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3954
3938
|
|
|
3939
|
+
return {
|
|
3940
|
+
exports: scriptExports,
|
|
3941
|
+
options: options
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3955
3944
|
|
|
3945
|
+
;// ./components/ChatRobot.vue
|
|
3956
3946
|
|
|
3957
3947
|
|
|
3958
3948
|
|
|
3949
|
+
;
|
|
3959
3950
|
|
|
3960
3951
|
|
|
3952
|
+
/* normalize component */
|
|
3961
3953
|
|
|
3954
|
+
var component = normalizeComponent(
|
|
3955
|
+
components_ChatRobotvue_type_script_lang_js,
|
|
3956
|
+
ChatRobotvue_type_template_id_3d936cb2_scoped_true_render,
|
|
3957
|
+
ChatRobotvue_type_template_id_3d936cb2_scoped_true_staticRenderFns,
|
|
3958
|
+
false,
|
|
3959
|
+
null,
|
|
3960
|
+
"3d936cb2",
|
|
3961
|
+
null
|
|
3962
|
+
|
|
3963
|
+
)
|
|
3962
3964
|
|
|
3965
|
+
/* harmony default export */ var ChatRobot = (component.exports);
|
|
3966
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatAvatar.vue?vue&type=template&id=7b09a9c8&scoped=true
|
|
3967
|
+
var ChatAvatarvue_type_template_id_7b09a9c8_scoped_true_render = function render() {
|
|
3968
|
+
var _vm = this,
|
|
3969
|
+
_c = _vm._self._c;
|
|
3970
|
+
return _c('div', {
|
|
3971
|
+
staticClass: "chat-ai",
|
|
3972
|
+
on: {
|
|
3973
|
+
"click": function ($event) {
|
|
3974
|
+
return _vm.$emit('click');
|
|
3975
|
+
}
|
|
3976
|
+
}
|
|
3977
|
+
}, [_c('div', {
|
|
3978
|
+
class: ['chat-ai-avater', _vm.status]
|
|
3979
|
+
}), _c('div', {
|
|
3980
|
+
staticClass: "chat-ai-text"
|
|
3981
|
+
}, [_vm._v(_vm._s(_vm.statusText))])]);
|
|
3982
|
+
};
|
|
3983
|
+
var ChatAvatarvue_type_template_id_7b09a9c8_scoped_true_staticRenderFns = [];
|
|
3963
3984
|
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
name: 'ChatWindow',
|
|
3985
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatAvatar.vue?vue&type=script&lang=js
|
|
3986
|
+
/* harmony default export */ var ChatAvatarvue_type_script_lang_js = ({
|
|
3987
|
+
name: 'ChatAvatar',
|
|
3968
3988
|
props: {
|
|
3969
|
-
|
|
3970
|
-
type:
|
|
3971
|
-
|
|
3989
|
+
status: {
|
|
3990
|
+
type: String,
|
|
3991
|
+
required: true,
|
|
3992
|
+
validator: value => ['normal', 'thinking', 'output'].includes(value)
|
|
3972
3993
|
}
|
|
3973
3994
|
},
|
|
3995
|
+
computed: {
|
|
3996
|
+
statusText() {
|
|
3997
|
+
const textMap = {
|
|
3998
|
+
'normal': '凌霄AI',
|
|
3999
|
+
'thinking': '思考中',
|
|
4000
|
+
'output': '语音中'
|
|
4001
|
+
};
|
|
4002
|
+
return textMap[this.status];
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
});
|
|
4006
|
+
;// ./components/ChatAvatar.vue?vue&type=script&lang=js
|
|
4007
|
+
/* harmony default export */ var components_ChatAvatarvue_type_script_lang_js = (ChatAvatarvue_type_script_lang_js);
|
|
4008
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatAvatar.vue?vue&type=style&index=0&id=7b09a9c8&prod&scoped=true&lang=css
|
|
4009
|
+
// extracted by mini-css-extract-plugin
|
|
4010
|
+
|
|
4011
|
+
;// ./components/ChatAvatar.vue?vue&type=style&index=0&id=7b09a9c8&prod&scoped=true&lang=css
|
|
4012
|
+
|
|
4013
|
+
;// ./components/ChatAvatar.vue
|
|
4014
|
+
|
|
4015
|
+
|
|
4016
|
+
|
|
4017
|
+
;
|
|
4018
|
+
|
|
4019
|
+
|
|
4020
|
+
/* normalize component */
|
|
4021
|
+
|
|
4022
|
+
var ChatAvatar_component = normalizeComponent(
|
|
4023
|
+
components_ChatAvatarvue_type_script_lang_js,
|
|
4024
|
+
ChatAvatarvue_type_template_id_7b09a9c8_scoped_true_render,
|
|
4025
|
+
ChatAvatarvue_type_template_id_7b09a9c8_scoped_true_staticRenderFns,
|
|
4026
|
+
false,
|
|
4027
|
+
null,
|
|
4028
|
+
"7b09a9c8",
|
|
4029
|
+
null
|
|
4030
|
+
|
|
4031
|
+
)
|
|
4032
|
+
|
|
4033
|
+
/* harmony default export */ var ChatAvatar = (ChatAvatar_component.exports);
|
|
4034
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowDialog.vue?vue&type=template&id=5eca994a&scoped=true
|
|
4035
|
+
var ChatWindowDialogvue_type_template_id_5eca994a_scoped_true_render = function render() {
|
|
4036
|
+
var _vm = this,
|
|
4037
|
+
_c = _vm._self._c;
|
|
4038
|
+
return _c('div', {
|
|
4039
|
+
directives: [{
|
|
4040
|
+
name: "show",
|
|
4041
|
+
rawName: "v-show",
|
|
4042
|
+
value: _vm.value,
|
|
4043
|
+
expression: "value"
|
|
4044
|
+
}],
|
|
4045
|
+
staticClass: "chat-overlay",
|
|
4046
|
+
on: {
|
|
4047
|
+
"click": function ($event) {
|
|
4048
|
+
return _vm.$emit('overlay-click');
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
}, [_c('div', {
|
|
4052
|
+
staticClass: "chat-window",
|
|
4053
|
+
on: {
|
|
4054
|
+
"click": function ($event) {
|
|
4055
|
+
$event.stopPropagation();
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
}, [_c('ChatWindowHeader', {
|
|
4059
|
+
on: {
|
|
4060
|
+
"close": function ($event) {
|
|
4061
|
+
return _vm.$emit('input', false);
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
}), _c('ChatMessageList', {
|
|
4065
|
+
ref: "messageList",
|
|
4066
|
+
attrs: {
|
|
4067
|
+
"messages": _vm.messages,
|
|
4068
|
+
"think-status": _vm.thinkStatus
|
|
4069
|
+
},
|
|
4070
|
+
on: {
|
|
4071
|
+
"thinking-click": function ($event) {
|
|
4072
|
+
return _vm.$emit('thinking-click');
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
}), _c('ChatInputBox', {
|
|
4076
|
+
attrs: {
|
|
4077
|
+
"value": _vm.inputMessage
|
|
4078
|
+
},
|
|
4079
|
+
on: {
|
|
4080
|
+
"input": function ($event) {
|
|
4081
|
+
return _vm.$emit('update:inputMessage', $event);
|
|
4082
|
+
},
|
|
4083
|
+
"send": function ($event) {
|
|
4084
|
+
return _vm.$emit('send');
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
})], 1)]);
|
|
4088
|
+
};
|
|
4089
|
+
var ChatWindowDialogvue_type_template_id_5eca994a_scoped_true_staticRenderFns = [];
|
|
4090
|
+
|
|
4091
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowHeader.vue?vue&type=template&id=1cff0e3b&scoped=true
|
|
4092
|
+
var ChatWindowHeadervue_type_template_id_1cff0e3b_scoped_true_render = function render() {
|
|
4093
|
+
var _vm = this,
|
|
4094
|
+
_c = _vm._self._c;
|
|
4095
|
+
return _c('div', {
|
|
4096
|
+
staticClass: "chat-window-header"
|
|
4097
|
+
}, [_c('div', {
|
|
4098
|
+
staticClass: "chat-window-header-title"
|
|
4099
|
+
}, [_vm._v("凌霄大模型AI123对话")]), _c('div', {
|
|
4100
|
+
staticClass: "chat-window-header-open",
|
|
4101
|
+
on: {
|
|
4102
|
+
"click": _vm.handleOpen
|
|
4103
|
+
}
|
|
4104
|
+
}, [_c('svg', {
|
|
4105
|
+
attrs: {
|
|
4106
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
4107
|
+
"width": "24",
|
|
4108
|
+
"height": "24",
|
|
4109
|
+
"viewBox": "0 0 24 24",
|
|
4110
|
+
"fill": "none"
|
|
4111
|
+
}
|
|
4112
|
+
}, [_c('path', {
|
|
4113
|
+
attrs: {
|
|
4114
|
+
"d": "M14.5 4.5H19.5V9.5",
|
|
4115
|
+
"stroke": "#4E5969",
|
|
4116
|
+
"stroke-width": "1.66667",
|
|
4117
|
+
"stroke-linecap": "round",
|
|
4118
|
+
"stroke-linejoin": "round"
|
|
4119
|
+
}
|
|
4120
|
+
}), _c('path', {
|
|
4121
|
+
attrs: {
|
|
4122
|
+
"d": "M9.5 19.5H4.5V14.5",
|
|
4123
|
+
"stroke": "#4E5969",
|
|
4124
|
+
"stroke-width": "1.66667",
|
|
4125
|
+
"stroke-linecap": "round",
|
|
4126
|
+
"stroke-linejoin": "round"
|
|
4127
|
+
}
|
|
4128
|
+
}), _c('path', {
|
|
4129
|
+
attrs: {
|
|
4130
|
+
"d": "M19.5 4.5L14.0833 9.91667",
|
|
4131
|
+
"stroke": "#4E5969",
|
|
4132
|
+
"stroke-width": "1.66667",
|
|
4133
|
+
"stroke-linecap": "round",
|
|
4134
|
+
"stroke-linejoin": "round"
|
|
4135
|
+
}
|
|
4136
|
+
}), _c('path', {
|
|
4137
|
+
attrs: {
|
|
4138
|
+
"d": "M9.91667 14.083L4.5 19.4997",
|
|
4139
|
+
"stroke": "#4E5969",
|
|
4140
|
+
"stroke-width": "1.66667",
|
|
4141
|
+
"stroke-linecap": "round",
|
|
4142
|
+
"stroke-linejoin": "round"
|
|
4143
|
+
}
|
|
4144
|
+
})])]), _c('div', {
|
|
4145
|
+
staticClass: "chat-window-header-close",
|
|
4146
|
+
on: {
|
|
4147
|
+
"click": function ($event) {
|
|
4148
|
+
return _vm.$emit('close');
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
}, [_c('svg', {
|
|
4152
|
+
attrs: {
|
|
4153
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
4154
|
+
"width": "24",
|
|
4155
|
+
"height": "24",
|
|
4156
|
+
"viewBox": "0 0 24 24",
|
|
4157
|
+
"fill": "none"
|
|
4158
|
+
}
|
|
4159
|
+
}, [_c('path', {
|
|
4160
|
+
attrs: {
|
|
4161
|
+
"d": "M5.50002 5.5L18.5 18.5",
|
|
4162
|
+
"stroke": "#4E5969",
|
|
4163
|
+
"stroke-width": "1.89404",
|
|
4164
|
+
"stroke-linecap": "round",
|
|
4165
|
+
"stroke-linejoin": "round"
|
|
4166
|
+
}
|
|
4167
|
+
}), _c('path', {
|
|
4168
|
+
attrs: {
|
|
4169
|
+
"d": "M5.50002 18.5L18.5 5.5",
|
|
4170
|
+
"stroke": "#4E5969",
|
|
4171
|
+
"stroke-width": "1.89404",
|
|
4172
|
+
"stroke-linecap": "round",
|
|
4173
|
+
"stroke-linejoin": "round"
|
|
4174
|
+
}
|
|
4175
|
+
})])])]);
|
|
4176
|
+
};
|
|
4177
|
+
var ChatWindowHeadervue_type_template_id_1cff0e3b_scoped_true_staticRenderFns = [];
|
|
4178
|
+
|
|
4179
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowHeader.vue?vue&type=script&lang=js
|
|
4180
|
+
/* harmony default export */ var ChatWindowHeadervue_type_script_lang_js = ({
|
|
4181
|
+
name: 'ChatWindowHeader',
|
|
4182
|
+
methods: {
|
|
4183
|
+
handleOpen() {
|
|
4184
|
+
window.open('http://192.168.8.87:8090/', '_blank');
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
});
|
|
4188
|
+
;// ./components/ChatWindowHeader.vue?vue&type=script&lang=js
|
|
4189
|
+
/* harmony default export */ var components_ChatWindowHeadervue_type_script_lang_js = (ChatWindowHeadervue_type_script_lang_js);
|
|
4190
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowHeader.vue?vue&type=style&index=0&id=1cff0e3b&prod&scoped=true&lang=css
|
|
4191
|
+
// extracted by mini-css-extract-plugin
|
|
4192
|
+
|
|
4193
|
+
;// ./components/ChatWindowHeader.vue?vue&type=style&index=0&id=1cff0e3b&prod&scoped=true&lang=css
|
|
4194
|
+
|
|
4195
|
+
;// ./components/ChatWindowHeader.vue
|
|
4196
|
+
|
|
4197
|
+
|
|
4198
|
+
|
|
4199
|
+
;
|
|
4200
|
+
|
|
4201
|
+
|
|
4202
|
+
/* normalize component */
|
|
4203
|
+
|
|
4204
|
+
var ChatWindowHeader_component = normalizeComponent(
|
|
4205
|
+
components_ChatWindowHeadervue_type_script_lang_js,
|
|
4206
|
+
ChatWindowHeadervue_type_template_id_1cff0e3b_scoped_true_render,
|
|
4207
|
+
ChatWindowHeadervue_type_template_id_1cff0e3b_scoped_true_staticRenderFns,
|
|
4208
|
+
false,
|
|
4209
|
+
null,
|
|
4210
|
+
"1cff0e3b",
|
|
4211
|
+
null
|
|
4212
|
+
|
|
4213
|
+
)
|
|
4214
|
+
|
|
4215
|
+
/* harmony default export */ var ChatWindowHeader = (ChatWindowHeader_component.exports);
|
|
4216
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatMessageList.vue?vue&type=template&id=ba7356ea&scoped=true
|
|
4217
|
+
var ChatMessageListvue_type_template_id_ba7356ea_scoped_true_render = function render() {
|
|
4218
|
+
var _vm = this,
|
|
4219
|
+
_c = _vm._self._c;
|
|
4220
|
+
return _c('div', {
|
|
4221
|
+
ref: "chatArea",
|
|
4222
|
+
staticClass: "chat-window-content scrollbar-hide"
|
|
4223
|
+
}, _vm._l(_vm.messages, function (message) {
|
|
4224
|
+
return _c('div', {
|
|
4225
|
+
key: message.id,
|
|
4226
|
+
staticClass: "chat-window-message"
|
|
4227
|
+
}, [message.type === 'user' ? _c('UserMessage', {
|
|
4228
|
+
attrs: {
|
|
4229
|
+
"content": message.content
|
|
4230
|
+
}
|
|
4231
|
+
}) : _c('AiMessage', {
|
|
4232
|
+
attrs: {
|
|
4233
|
+
"message": message,
|
|
4234
|
+
"think-status": _vm.thinkStatus
|
|
4235
|
+
},
|
|
4236
|
+
on: {
|
|
4237
|
+
"thinking-click": function ($event) {
|
|
4238
|
+
return _vm.$emit('thinking-click');
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
})], 1);
|
|
4242
|
+
}), 0);
|
|
4243
|
+
};
|
|
4244
|
+
var ChatMessageListvue_type_template_id_ba7356ea_scoped_true_staticRenderFns = [];
|
|
4245
|
+
|
|
4246
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/UserMessage.vue?vue&type=template&id=6a2b6167&scoped=true
|
|
4247
|
+
var UserMessagevue_type_template_id_6a2b6167_scoped_true_render = function render() {
|
|
4248
|
+
var _vm = this,
|
|
4249
|
+
_c = _vm._self._c;
|
|
4250
|
+
return _c('div', {
|
|
4251
|
+
staticClass: "chat-window-message-user"
|
|
4252
|
+
}, [_c('div', {
|
|
4253
|
+
staticClass: "user-message"
|
|
4254
|
+
}, [_vm._v(_vm._s(_vm.content))])]);
|
|
4255
|
+
};
|
|
4256
|
+
var UserMessagevue_type_template_id_6a2b6167_scoped_true_staticRenderFns = [];
|
|
4257
|
+
|
|
4258
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/UserMessage.vue?vue&type=script&lang=js
|
|
4259
|
+
/* harmony default export */ var UserMessagevue_type_script_lang_js = ({
|
|
4260
|
+
name: 'UserMessage',
|
|
4261
|
+
props: {
|
|
4262
|
+
content: {
|
|
4263
|
+
type: String,
|
|
4264
|
+
required: true
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
});
|
|
4268
|
+
;// ./components/UserMessage.vue?vue&type=script&lang=js
|
|
4269
|
+
/* harmony default export */ var components_UserMessagevue_type_script_lang_js = (UserMessagevue_type_script_lang_js);
|
|
4270
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/UserMessage.vue?vue&type=style&index=0&id=6a2b6167&prod&scoped=true&lang=css
|
|
4271
|
+
// extracted by mini-css-extract-plugin
|
|
4272
|
+
|
|
4273
|
+
;// ./components/UserMessage.vue?vue&type=style&index=0&id=6a2b6167&prod&scoped=true&lang=css
|
|
4274
|
+
|
|
4275
|
+
;// ./components/UserMessage.vue
|
|
4276
|
+
|
|
4277
|
+
|
|
4278
|
+
|
|
4279
|
+
;
|
|
4280
|
+
|
|
4281
|
+
|
|
4282
|
+
/* normalize component */
|
|
4283
|
+
|
|
4284
|
+
var UserMessage_component = normalizeComponent(
|
|
4285
|
+
components_UserMessagevue_type_script_lang_js,
|
|
4286
|
+
UserMessagevue_type_template_id_6a2b6167_scoped_true_render,
|
|
4287
|
+
UserMessagevue_type_template_id_6a2b6167_scoped_true_staticRenderFns,
|
|
4288
|
+
false,
|
|
4289
|
+
null,
|
|
4290
|
+
"6a2b6167",
|
|
4291
|
+
null
|
|
4292
|
+
|
|
4293
|
+
)
|
|
4294
|
+
|
|
4295
|
+
/* harmony default export */ var UserMessage = (UserMessage_component.exports);
|
|
4296
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/AiMessage.vue?vue&type=template&id=3347daf6&scoped=true
|
|
4297
|
+
var AiMessagevue_type_template_id_3347daf6_scoped_true_render = function render() {
|
|
4298
|
+
var _vm = this,
|
|
4299
|
+
_c = _vm._self._c;
|
|
4300
|
+
return _c('div', {
|
|
4301
|
+
staticClass: "chat-window-message-ai"
|
|
4302
|
+
}, [_c('div', {
|
|
4303
|
+
staticClass: "ai-render"
|
|
4304
|
+
}, [_c('div', {
|
|
4305
|
+
staticClass: "ai-thinking",
|
|
4306
|
+
on: {
|
|
4307
|
+
"click": function ($event) {
|
|
4308
|
+
return _vm.$emit('thinking-click');
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
}, [_c('div', {
|
|
4312
|
+
staticClass: "ai-thinking-time"
|
|
4313
|
+
}, [_vm._v("思考用时" + _vm._s(_vm.message.time) + "秒")]), _vm.thinkStatus ? _c('div', {
|
|
4314
|
+
staticClass: "ai-thinking-content"
|
|
4315
|
+
}, [_vm._v(_vm._s(_vm.message.thinking))]) : _vm._e()]), _c('div', {
|
|
4316
|
+
staticClass: "ai-content"
|
|
4317
|
+
}, [_vm._v(_vm._s(_vm.message.content))])])]);
|
|
4318
|
+
};
|
|
4319
|
+
var AiMessagevue_type_template_id_3347daf6_scoped_true_staticRenderFns = [];
|
|
4320
|
+
|
|
4321
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/AiMessage.vue?vue&type=script&lang=js
|
|
4322
|
+
/* harmony default export */ var AiMessagevue_type_script_lang_js = ({
|
|
4323
|
+
name: 'AiMessage',
|
|
4324
|
+
props: {
|
|
4325
|
+
message: {
|
|
4326
|
+
type: Object,
|
|
4327
|
+
required: true
|
|
4328
|
+
},
|
|
4329
|
+
thinkStatus: {
|
|
4330
|
+
type: Boolean,
|
|
4331
|
+
default: true
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
});
|
|
4335
|
+
;// ./components/AiMessage.vue?vue&type=script&lang=js
|
|
4336
|
+
/* harmony default export */ var components_AiMessagevue_type_script_lang_js = (AiMessagevue_type_script_lang_js);
|
|
4337
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/AiMessage.vue?vue&type=style&index=0&id=3347daf6&prod&scoped=true&lang=css
|
|
4338
|
+
// extracted by mini-css-extract-plugin
|
|
4339
|
+
|
|
4340
|
+
;// ./components/AiMessage.vue?vue&type=style&index=0&id=3347daf6&prod&scoped=true&lang=css
|
|
4341
|
+
|
|
4342
|
+
;// ./components/AiMessage.vue
|
|
4343
|
+
|
|
4344
|
+
|
|
4345
|
+
|
|
4346
|
+
;
|
|
4347
|
+
|
|
4348
|
+
|
|
4349
|
+
/* normalize component */
|
|
4350
|
+
|
|
4351
|
+
var AiMessage_component = normalizeComponent(
|
|
4352
|
+
components_AiMessagevue_type_script_lang_js,
|
|
4353
|
+
AiMessagevue_type_template_id_3347daf6_scoped_true_render,
|
|
4354
|
+
AiMessagevue_type_template_id_3347daf6_scoped_true_staticRenderFns,
|
|
4355
|
+
false,
|
|
4356
|
+
null,
|
|
4357
|
+
"3347daf6",
|
|
4358
|
+
null
|
|
4359
|
+
|
|
4360
|
+
)
|
|
4361
|
+
|
|
4362
|
+
/* harmony default export */ var AiMessage = (AiMessage_component.exports);
|
|
4363
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatMessageList.vue?vue&type=script&lang=js
|
|
4364
|
+
|
|
4365
|
+
|
|
4366
|
+
/* harmony default export */ var ChatMessageListvue_type_script_lang_js = ({
|
|
4367
|
+
name: 'ChatMessageList',
|
|
4368
|
+
components: {
|
|
4369
|
+
UserMessage: UserMessage,
|
|
4370
|
+
AiMessage: AiMessage
|
|
4371
|
+
},
|
|
4372
|
+
props: {
|
|
4373
|
+
messages: {
|
|
4374
|
+
type: Array,
|
|
4375
|
+
required: true
|
|
4376
|
+
},
|
|
4377
|
+
thinkStatus: {
|
|
4378
|
+
type: Boolean,
|
|
4379
|
+
default: true
|
|
4380
|
+
}
|
|
4381
|
+
},
|
|
4382
|
+
methods: {
|
|
4383
|
+
scrollToBottom() {
|
|
4384
|
+
this.$nextTick(() => {
|
|
4385
|
+
const chatArea = this.$refs.chatArea;
|
|
4386
|
+
if (chatArea) {
|
|
4387
|
+
chatArea.scrollTop = chatArea.scrollHeight;
|
|
4388
|
+
}
|
|
4389
|
+
});
|
|
4390
|
+
}
|
|
4391
|
+
},
|
|
4392
|
+
watch: {
|
|
4393
|
+
messages: {
|
|
4394
|
+
handler() {
|
|
4395
|
+
this.scrollToBottom();
|
|
4396
|
+
},
|
|
4397
|
+
deep: true
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
});
|
|
4401
|
+
;// ./components/ChatMessageList.vue?vue&type=script&lang=js
|
|
4402
|
+
/* harmony default export */ var components_ChatMessageListvue_type_script_lang_js = (ChatMessageListvue_type_script_lang_js);
|
|
4403
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatMessageList.vue?vue&type=style&index=0&id=ba7356ea&prod&scoped=true&lang=css
|
|
4404
|
+
// extracted by mini-css-extract-plugin
|
|
4405
|
+
|
|
4406
|
+
;// ./components/ChatMessageList.vue?vue&type=style&index=0&id=ba7356ea&prod&scoped=true&lang=css
|
|
4407
|
+
|
|
4408
|
+
;// ./components/ChatMessageList.vue
|
|
4409
|
+
|
|
4410
|
+
|
|
4411
|
+
|
|
4412
|
+
;
|
|
4413
|
+
|
|
4414
|
+
|
|
4415
|
+
/* normalize component */
|
|
4416
|
+
|
|
4417
|
+
var ChatMessageList_component = normalizeComponent(
|
|
4418
|
+
components_ChatMessageListvue_type_script_lang_js,
|
|
4419
|
+
ChatMessageListvue_type_template_id_ba7356ea_scoped_true_render,
|
|
4420
|
+
ChatMessageListvue_type_template_id_ba7356ea_scoped_true_staticRenderFns,
|
|
4421
|
+
false,
|
|
4422
|
+
null,
|
|
4423
|
+
"ba7356ea",
|
|
4424
|
+
null
|
|
4425
|
+
|
|
4426
|
+
)
|
|
4427
|
+
|
|
4428
|
+
/* harmony default export */ var ChatMessageList = (ChatMessageList_component.exports);
|
|
4429
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatInputBox.vue?vue&type=template&id=6f416073&scoped=true
|
|
4430
|
+
var ChatInputBoxvue_type_template_id_6f416073_scoped_true_render = function render() {
|
|
4431
|
+
var _vm = this,
|
|
4432
|
+
_c = _vm._self._c;
|
|
4433
|
+
return _c('div', {
|
|
4434
|
+
staticClass: "chat-window-footer"
|
|
4435
|
+
}, [_c('div', {
|
|
4436
|
+
staticClass: "chat-window-textarea"
|
|
4437
|
+
}, [_c('el-input', {
|
|
4438
|
+
staticClass: "chat-window-input",
|
|
4439
|
+
attrs: {
|
|
4440
|
+
"type": "textarea",
|
|
4441
|
+
"placeholder": "有什么我能帮您的吗?",
|
|
4442
|
+
"rows": "2",
|
|
4443
|
+
"resize": "none",
|
|
4444
|
+
"value": _vm.value
|
|
4445
|
+
},
|
|
4446
|
+
on: {
|
|
4447
|
+
"input": function ($event) {
|
|
4448
|
+
return _vm.$emit('input', $event);
|
|
4449
|
+
}
|
|
4450
|
+
},
|
|
4451
|
+
nativeOn: {
|
|
4452
|
+
"keydown": function ($event) {
|
|
4453
|
+
return _vm.handleKeyDown.apply(null, arguments);
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
}), _c('div', {
|
|
4457
|
+
staticClass: "chat-window-bar"
|
|
4458
|
+
}, [_c('div', {
|
|
4459
|
+
staticClass: "chat-window-send",
|
|
4460
|
+
on: {
|
|
4461
|
+
"click": function ($event) {
|
|
4462
|
+
return _vm.$emit('send');
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
}, [_c('svg', {
|
|
4466
|
+
attrs: {
|
|
4467
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
4468
|
+
"width": "20",
|
|
4469
|
+
"height": "20",
|
|
4470
|
+
"viewBox": "0 0 20 20",
|
|
4471
|
+
"fill": "none"
|
|
4472
|
+
}
|
|
4473
|
+
}, [_c('g', {
|
|
4474
|
+
attrs: {
|
|
4475
|
+
"clip-path": "url(#clip0_640_2107)"
|
|
4476
|
+
}
|
|
4477
|
+
}, [_c('path', {
|
|
4478
|
+
attrs: {
|
|
4479
|
+
"d": "M18.6427 2.37822C19.3253 2.47432 19.8025 3.10738 19.7065 3.79002C19.6871 3.97072 19.5381 4.41327 19.5403 4.41161L14.9673 17.8079L14.9632 17.8093C14.7858 18.3838 14.212 18.7607 13.5971 18.6744C13.4173 18.6492 13.2504 18.5862 13.1055 18.4949L13.0973 18.4977L9.83449 16.3686C9.58371 16.2584 9.4276 15.9939 9.46729 15.7115C9.5154 15.3691 9.83278 15.1317 10.1751 15.1798C10.293 15.1964 10.3988 15.2448 10.4853 15.3161L13.4054 17.2314L13.4073 17.2317C13.4452 17.2566 13.4882 17.2746 13.5364 17.2814C13.6911 17.3029 13.8371 17.2052 13.8793 17.0593L18.0469 4.89796L8.27396 14.3367L7.77435 17.8916C7.72706 18.2281 7.41369 18.464 7.07727 18.4169C6.74073 18.3696 6.50469 18.0564 6.55198 17.7198L7.07633 13.9889C7.08231 13.9464 7.09382 13.9066 7.10727 13.867C7.13549 13.7645 7.19079 13.6657 7.27291 13.5866L17.0754 4.12041L2.68514 8.17767L2.68487 8.1796C2.58481 8.21873 2.50686 8.31058 2.49042 8.42643C2.47412 8.5424 2.52417 8.65007 2.6093 8.71729L2.60903 8.71922L3.28261 9.16101L3.28013 9.16461C3.47505 9.29254 3.58819 9.52563 3.55386 9.77111C3.50575 10.1134 3.18836 10.3509 2.84602 10.3028C2.75512 10.29 2.6708 10.2584 2.59833 10.2127L2.59806 10.2147L1.37843 9.42001L1.37951 9.41227C1.02215 9.14901 0.816644 8.70195 0.882687 8.23203C0.951867 7.74096 1.29791 7.35545 1.73968 7.21445L1.73995 7.21251L17.7833 2.57104C18.0287 2.41036 18.3294 2.3342 18.6427 2.37822Z",
|
|
4480
|
+
"fill": "#013378"
|
|
4481
|
+
}
|
|
4482
|
+
}), _c('path', {
|
|
4483
|
+
attrs: {
|
|
4484
|
+
"d": "M3.1309 10.9936C3.2178 10.5684 3.82528 10.5684 3.91218 10.9936C4.10411 11.9326 4.83794 12.6664 5.77697 12.8584C6.20213 12.9453 6.20213 13.5527 5.77697 13.6397C4.83794 13.8316 4.10411 14.5654 3.91218 15.5044C3.82528 15.9296 3.2178 15.9296 3.1309 15.5044C2.93897 14.5654 2.20513 13.8316 1.26611 13.6397C0.840944 13.5527 0.840944 12.9453 1.26611 12.8584C2.20513 12.6664 2.93897 11.9326 3.1309 10.9936Z",
|
|
4485
|
+
"fill": "#2B80F6"
|
|
4486
|
+
}
|
|
4487
|
+
}), _c('path', {
|
|
4488
|
+
attrs: {
|
|
4489
|
+
"d": "M6.20382 8.56242C6.25596 8.30732 6.62045 8.30732 6.67259 8.56242C6.78775 9.12583 7.22805 9.56613 7.79146 9.68129C8.04656 9.73343 8.04656 10.0979 7.79146 10.1501C7.22805 10.2652 6.78775 10.7055 6.67259 11.2689C6.62045 11.524 6.25596 11.524 6.20382 11.2689C6.08866 10.7055 5.64836 10.2652 5.08495 10.1501C4.82985 10.0979 4.82985 9.73343 5.08495 9.68129C5.64836 9.56613 6.08866 9.12583 6.20382 8.56242Z",
|
|
4490
|
+
"fill": "#2B80F6"
|
|
4491
|
+
}
|
|
4492
|
+
})]), _c('defs', [_c('clipPath', {
|
|
4493
|
+
attrs: {
|
|
4494
|
+
"id": "clip0_640_2107"
|
|
4495
|
+
}
|
|
4496
|
+
}, [_c('rect', {
|
|
4497
|
+
attrs: {
|
|
4498
|
+
"width": "20",
|
|
4499
|
+
"height": "20",
|
|
4500
|
+
"fill": "white"
|
|
4501
|
+
}
|
|
4502
|
+
})])])])])])], 1)]);
|
|
4503
|
+
};
|
|
4504
|
+
var ChatInputBoxvue_type_template_id_6f416073_scoped_true_staticRenderFns = [];
|
|
4505
|
+
|
|
4506
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatInputBox.vue?vue&type=script&lang=js
|
|
4507
|
+
/* harmony default export */ var ChatInputBoxvue_type_script_lang_js = ({
|
|
4508
|
+
name: 'ChatInputBox',
|
|
4509
|
+
props: {
|
|
4510
|
+
value: {
|
|
4511
|
+
type: String,
|
|
4512
|
+
default: ''
|
|
4513
|
+
}
|
|
4514
|
+
},
|
|
4515
|
+
methods: {
|
|
4516
|
+
handleKeyDown(e) {
|
|
4517
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
4518
|
+
e.preventDefault();
|
|
4519
|
+
this.$emit('send');
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
});
|
|
4524
|
+
;// ./components/ChatInputBox.vue?vue&type=script&lang=js
|
|
4525
|
+
/* harmony default export */ var components_ChatInputBoxvue_type_script_lang_js = (ChatInputBoxvue_type_script_lang_js);
|
|
4526
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatInputBox.vue?vue&type=style&index=0&id=6f416073&prod&scoped=true&lang=css
|
|
4527
|
+
// extracted by mini-css-extract-plugin
|
|
4528
|
+
|
|
4529
|
+
;// ./components/ChatInputBox.vue?vue&type=style&index=0&id=6f416073&prod&scoped=true&lang=css
|
|
4530
|
+
|
|
4531
|
+
;// ./components/ChatInputBox.vue
|
|
4532
|
+
|
|
4533
|
+
|
|
4534
|
+
|
|
4535
|
+
;
|
|
4536
|
+
|
|
4537
|
+
|
|
4538
|
+
/* normalize component */
|
|
4539
|
+
|
|
4540
|
+
var ChatInputBox_component = normalizeComponent(
|
|
4541
|
+
components_ChatInputBoxvue_type_script_lang_js,
|
|
4542
|
+
ChatInputBoxvue_type_template_id_6f416073_scoped_true_render,
|
|
4543
|
+
ChatInputBoxvue_type_template_id_6f416073_scoped_true_staticRenderFns,
|
|
4544
|
+
false,
|
|
4545
|
+
null,
|
|
4546
|
+
"6f416073",
|
|
4547
|
+
null
|
|
4548
|
+
|
|
4549
|
+
)
|
|
4550
|
+
|
|
4551
|
+
/* harmony default export */ var ChatInputBox = (ChatInputBox_component.exports);
|
|
4552
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowDialog.vue?vue&type=script&lang=js
|
|
4553
|
+
|
|
4554
|
+
|
|
4555
|
+
|
|
4556
|
+
/* harmony default export */ var ChatWindowDialogvue_type_script_lang_js = ({
|
|
4557
|
+
name: 'ChatWindowDialog',
|
|
4558
|
+
components: {
|
|
4559
|
+
ChatWindowHeader: ChatWindowHeader,
|
|
4560
|
+
ChatMessageList: ChatMessageList,
|
|
4561
|
+
ChatInputBox: ChatInputBox
|
|
4562
|
+
},
|
|
4563
|
+
props: {
|
|
4564
|
+
value: {
|
|
4565
|
+
type: Boolean,
|
|
4566
|
+
required: true
|
|
4567
|
+
},
|
|
4568
|
+
messages: {
|
|
4569
|
+
type: Array,
|
|
4570
|
+
required: true
|
|
4571
|
+
},
|
|
4572
|
+
inputMessage: {
|
|
4573
|
+
type: String,
|
|
4574
|
+
default: ''
|
|
4575
|
+
},
|
|
4576
|
+
thinkStatus: {
|
|
4577
|
+
type: Boolean,
|
|
4578
|
+
default: true
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
});
|
|
4582
|
+
;// ./components/ChatWindowDialog.vue?vue&type=script&lang=js
|
|
4583
|
+
/* harmony default export */ var components_ChatWindowDialogvue_type_script_lang_js = (ChatWindowDialogvue_type_script_lang_js);
|
|
4584
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowDialog.vue?vue&type=style&index=0&id=5eca994a&prod&scoped=true&lang=css
|
|
4585
|
+
// extracted by mini-css-extract-plugin
|
|
4586
|
+
|
|
4587
|
+
;// ./components/ChatWindowDialog.vue?vue&type=style&index=0&id=5eca994a&prod&scoped=true&lang=css
|
|
4588
|
+
|
|
4589
|
+
;// ./components/ChatWindowDialog.vue
|
|
4590
|
+
|
|
4591
|
+
|
|
4592
|
+
|
|
4593
|
+
;
|
|
4594
|
+
|
|
4595
|
+
|
|
4596
|
+
/* normalize component */
|
|
4597
|
+
|
|
4598
|
+
var ChatWindowDialog_component = normalizeComponent(
|
|
4599
|
+
components_ChatWindowDialogvue_type_script_lang_js,
|
|
4600
|
+
ChatWindowDialogvue_type_template_id_5eca994a_scoped_true_render,
|
|
4601
|
+
ChatWindowDialogvue_type_template_id_5eca994a_scoped_true_staticRenderFns,
|
|
4602
|
+
false,
|
|
4603
|
+
null,
|
|
4604
|
+
"5eca994a",
|
|
4605
|
+
null
|
|
4606
|
+
|
|
4607
|
+
)
|
|
4608
|
+
|
|
4609
|
+
/* harmony default export */ var ChatWindowDialog = (ChatWindowDialog_component.exports);
|
|
4610
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.detached.js
|
|
4611
|
+
var es_array_buffer_detached = __webpack_require__(6573);
|
|
4612
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer.js
|
|
4613
|
+
var es_array_buffer_transfer = __webpack_require__(8100);
|
|
4614
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer-to-fixed-length.js
|
|
4615
|
+
var es_array_buffer_transfer_to_fixed_length = __webpack_require__(7936);
|
|
4616
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.with.js
|
|
4617
|
+
var es_typed_array_with = __webpack_require__(9577);
|
|
4618
|
+
;// ./components/mixins/audioMixin.js
|
|
4619
|
+
|
|
4620
|
+
|
|
4621
|
+
|
|
4622
|
+
|
|
4623
|
+
/* harmony default export */ var audioMixin = ({
|
|
3974
4624
|
data() {
|
|
3975
4625
|
return {
|
|
3976
|
-
audioSrc: '/minio/lingxiaoai/byt.mp3',
|
|
3977
|
-
// 音频URL
|
|
3978
|
-
inputMessage: '',
|
|
3979
|
-
// 输入消息
|
|
3980
|
-
visible: false,
|
|
3981
|
-
// 窗口是否可见
|
|
3982
|
-
messages: [{
|
|
3983
|
-
id: 1,
|
|
3984
|
-
type: 'user',
|
|
3985
|
-
sender: '',
|
|
3986
|
-
time: '',
|
|
3987
|
-
content: '你好,欢迎来到凌霄大模型AI对话。'
|
|
3988
|
-
}, {
|
|
3989
|
-
id: 2,
|
|
3990
|
-
type: 'ai',
|
|
3991
|
-
sender: 'AI',
|
|
3992
|
-
time: '',
|
|
3993
|
-
thinking: '嗯,用户问的是回转窑的工业应用。首先,我需要回忆一下之前对话的内容。用户之前让我解释了水泥的制作流程,特别是提到了回转窑在高温煅烧熟料中的作用。',
|
|
3994
|
-
charts: [{
|
|
3995
|
-
title: '',
|
|
3996
|
-
options: {}
|
|
3997
|
-
}],
|
|
3998
|
-
content: '回转窑(Rotary Kiln)是一种长筒形旋转煅烧设备(类似倾斜安装的大管子),因其独特的旋转运动和高温耐火衬里设计,在多个工业领域都有广泛应用'
|
|
3999
|
-
}],
|
|
4000
|
-
// 消息列表
|
|
4001
4626
|
isRecording: false,
|
|
4002
|
-
// 正在录制
|
|
4003
4627
|
isMicAvailable: false,
|
|
4004
|
-
// 麦克风是否可用
|
|
4005
|
-
mediaRecorder: null,
|
|
4006
|
-
// 媒体录制器
|
|
4007
|
-
ws: null,
|
|
4008
|
-
// WebSocket连接
|
|
4009
|
-
// wsUrl: 'wss://mes.shnfonline.top:8316/ai_model/ws/voice-stream', // WebSocket URL
|
|
4010
|
-
wsUrl: 'ws://192.168.8.9:9999/ai_model/ws/voice-stream',
|
|
4011
|
-
// WebSocket URL
|
|
4012
|
-
isConnected: false,
|
|
4013
|
-
// WebSocket是否已连接
|
|
4014
4628
|
audioContext: null,
|
|
4015
|
-
// 音频上下文
|
|
4016
4629
|
microphone: null,
|
|
4017
|
-
// 麦克风输入节点
|
|
4018
4630
|
processor: null,
|
|
4019
|
-
|
|
4020
|
-
robotStatus: 'leaving',
|
|
4021
|
-
// 机器人状态 waiting, speaking, leaving, entering
|
|
4022
|
-
avaterStatus: 'normal',
|
|
4023
|
-
// 头像状态 normal output thinking
|
|
4024
|
-
buffer: '',
|
|
4025
|
-
// 音频缓冲区
|
|
4026
|
-
currentMessage: null,
|
|
4027
|
-
// 当前消息
|
|
4028
|
-
inTag: false,
|
|
4029
|
-
// 是否在标签页
|
|
4030
|
-
tagBuilder: '',
|
|
4031
|
-
// 标签构建器
|
|
4032
|
-
audioBuffer: new Float32Array(0) // 音频缓冲区
|
|
4631
|
+
audioBuffer: new Float32Array(0)
|
|
4033
4632
|
};
|
|
4034
4633
|
},
|
|
4035
|
-
computed: {
|
|
4036
|
-
avaterText() {
|
|
4037
|
-
const textMap = {
|
|
4038
|
-
'normal': '凌霄AI',
|
|
4039
|
-
'thinking': '思考中',
|
|
4040
|
-
'output': '语音中'
|
|
4041
|
-
};
|
|
4042
|
-
return textMap[this.avaterStatus];
|
|
4043
|
-
}
|
|
4044
|
-
},
|
|
4045
|
-
mounted() {
|
|
4046
|
-
this.initWebSocket();
|
|
4047
|
-
|
|
4048
|
-
// 处理append-to-body逻辑
|
|
4049
|
-
if (this.appendToBody) {
|
|
4050
|
-
this.appendToBodyHandler();
|
|
4051
|
-
}
|
|
4052
|
-
},
|
|
4053
|
-
unmounted() {
|
|
4054
|
-
this.closeWebSocket();
|
|
4055
|
-
this.stopRecording();
|
|
4056
|
-
},
|
|
4057
|
-
beforeDestroy() {
|
|
4058
|
-
// 组件销毁前,如果元素被移动到body中,需要移除
|
|
4059
|
-
if (this.appendToBody && this.$el.parentElement === document.body) {
|
|
4060
|
-
document.body.removeChild(this.$el);
|
|
4061
|
-
}
|
|
4062
|
-
this.closeWebSocket();
|
|
4063
|
-
this.stopRecording();
|
|
4064
|
-
},
|
|
4065
4634
|
methods: {
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4635
|
+
async initAudio() {
|
|
4636
|
+
if (this.isRecording) return;
|
|
4637
|
+
try {
|
|
4638
|
+
this.isMicAvailable = true;
|
|
4639
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
4640
|
+
audio: {
|
|
4641
|
+
sampleRate: this.SAMPLE_RATE,
|
|
4642
|
+
channelCount: 1,
|
|
4643
|
+
noiseSuppression: true,
|
|
4644
|
+
echoCancellation: true
|
|
4645
|
+
}
|
|
4646
|
+
});
|
|
4647
|
+
this.audioContext = new AudioContext({
|
|
4648
|
+
sampleRate: this.SAMPLE_RATE
|
|
4649
|
+
});
|
|
4650
|
+
this.microphone = this.audioContext.createMediaStreamSource(stream);
|
|
4651
|
+
this.processor = this.audioContext.createScriptProcessor(this.FRAME_SIZE, 1, 1);
|
|
4652
|
+
this.processor.onaudioprocess = this.processAudio;
|
|
4653
|
+
this.microphone.connect(this.processor);
|
|
4654
|
+
this.processor.connect(this.audioContext.destination);
|
|
4655
|
+
this.isRecording = true;
|
|
4656
|
+
console.log(`录音中 (采样率: ${this.audioContext.sampleRate}Hz)`);
|
|
4657
|
+
} catch (error) {
|
|
4658
|
+
console.error("音频初始化失败:", error);
|
|
4659
|
+
this.isRecording = false;
|
|
4660
|
+
this.isMicAvailable = false;
|
|
4077
4661
|
}
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
title: '角色管理'
|
|
4093
|
-
}];
|
|
4094
|
-
// 检查当前时间是否达到跳转点
|
|
4095
|
-
timeJumpPoints.forEach(point => {
|
|
4096
|
-
// 使用一定的误差范围,确保不会因为播放进度的微小差异而错过跳转点
|
|
4097
|
-
if (currentTime >= point.time && currentTime < point.time + 0.5 && !this.jumpedTimePoints.has(point.time)) {
|
|
4098
|
-
this.jumpedTimePoints.add(point.time);
|
|
4099
|
-
console.log(`到达时间点 ${point.time} 秒,跳转到 ${point.title}`);
|
|
4100
|
-
this.$appOptions.store.dispatch('tags/addTagview', {
|
|
4101
|
-
path: point.url,
|
|
4102
|
-
fullPath: point.url,
|
|
4103
|
-
label: point.title,
|
|
4104
|
-
name: point.title,
|
|
4105
|
-
meta: {
|
|
4106
|
-
title: point.title
|
|
4107
|
-
},
|
|
4108
|
-
query: {},
|
|
4109
|
-
params: {}
|
|
4110
|
-
});
|
|
4111
|
-
this.$appOptions.router.push({
|
|
4112
|
-
path: point.url
|
|
4113
|
-
});
|
|
4662
|
+
},
|
|
4663
|
+
processAudio(event) {
|
|
4664
|
+
if (!this.isRecording) return;
|
|
4665
|
+
const inputData = event.inputBuffer.getChannelData(0);
|
|
4666
|
+
const tempBuffer = new Float32Array(this.audioBuffer.length + inputData.length);
|
|
4667
|
+
tempBuffer.set(this.audioBuffer, 0);
|
|
4668
|
+
tempBuffer.set(inputData, this.audioBuffer.length);
|
|
4669
|
+
this.audioBuffer = tempBuffer;
|
|
4670
|
+
while (this.audioBuffer.length >= this.FRAME_SIZE) {
|
|
4671
|
+
const frame = this.audioBuffer.slice(0, this.FRAME_SIZE);
|
|
4672
|
+
this.audioBuffer = this.audioBuffer.slice(this.FRAME_SIZE);
|
|
4673
|
+
const pcmData = this.floatTo16BitPCM(frame);
|
|
4674
|
+
if (this.ws && this.ws.readyState === this.ws.OPEN) {
|
|
4675
|
+
this.ws.send(pcmData);
|
|
4114
4676
|
}
|
|
4115
|
-
}
|
|
4116
|
-
|
|
4677
|
+
}
|
|
4678
|
+
},
|
|
4679
|
+
floatTo16BitPCM(input) {
|
|
4680
|
+
const output = new Int16Array(input.length);
|
|
4681
|
+
for (let i = 0; i < input.length; i++) {
|
|
4682
|
+
const s = Math.max(-1, Math.min(1, input[i]));
|
|
4683
|
+
output[i] = s < 0 ? s * 0x8000 : s * 0x7FFF;
|
|
4684
|
+
}
|
|
4685
|
+
return output.buffer;
|
|
4686
|
+
},
|
|
4687
|
+
stopRecording() {
|
|
4688
|
+
if (!this.isRecording) return;
|
|
4689
|
+
if (this.microphone) this.microphone.disconnect();
|
|
4690
|
+
if (this.processor) this.processor.disconnect();
|
|
4691
|
+
if (this.analyser) this.analyser.disconnect();
|
|
4692
|
+
if (this.audioContext) {
|
|
4693
|
+
this.audioContext.close().catch(e => {
|
|
4694
|
+
console.error("关闭音频上下文失败:", e);
|
|
4695
|
+
});
|
|
4696
|
+
}
|
|
4697
|
+
this.isRecording = false;
|
|
4117
4698
|
},
|
|
4118
4699
|
play() {
|
|
4119
4700
|
this.robotStatus = 'speaking';
|
|
@@ -4129,42 +4710,65 @@ const FRAME_SIZE = 512;
|
|
|
4129
4710
|
this.$refs.audioPlayer.currentTime = 0;
|
|
4130
4711
|
this.jumpedTimePoints.clear();
|
|
4131
4712
|
},
|
|
4713
|
+
analyzeAudioCommand(command) {
|
|
4714
|
+
console.log('分析音频命令:', command);
|
|
4715
|
+
if (command === 'C5') {
|
|
4716
|
+
this.robotStatus = 'entering';
|
|
4717
|
+
setTimeout(() => {
|
|
4718
|
+
this.robotStatus = 'speaking';
|
|
4719
|
+
this.play();
|
|
4720
|
+
}, 3000);
|
|
4721
|
+
} else if (command === 'C8') {
|
|
4722
|
+
this.robotStatus = 'speaking';
|
|
4723
|
+
this.play();
|
|
4724
|
+
} else if (command === 'C7') {
|
|
4725
|
+
this.robotStatus = 'waiting';
|
|
4726
|
+
this.pause();
|
|
4727
|
+
} else if (command === 'C6') {
|
|
4728
|
+
this.robotStatus = 'leaving';
|
|
4729
|
+
this.stop();
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
});
|
|
4734
|
+
;// ./components/mixins/webSocketMixin.js
|
|
4735
|
+
|
|
4736
|
+
|
|
4737
|
+
|
|
4738
|
+
/* harmony default export */ var webSocketMixin = ({
|
|
4739
|
+
data() {
|
|
4740
|
+
return {
|
|
4741
|
+
ws: null,
|
|
4742
|
+
wsUrl: 'ws://192.168.8.9:9999/ai_model/ws/voice-stream',
|
|
4743
|
+
isConnected: false,
|
|
4744
|
+
reconnectCount: 0,
|
|
4745
|
+
// 重连尝试次数
|
|
4746
|
+
maxReconnectAttempts: 3 // 最大重连尝试次数
|
|
4747
|
+
};
|
|
4748
|
+
},
|
|
4749
|
+
methods: {
|
|
4132
4750
|
initWebSocket() {
|
|
4133
4751
|
try {
|
|
4134
4752
|
this.ws = new WebSocket(this.wsUrl);
|
|
4135
4753
|
this.ws.binaryType = 'arraybuffer';
|
|
4136
4754
|
this.ws.onopen = async () => {
|
|
4137
|
-
console.log('连接成功');
|
|
4755
|
+
console.log('WebSocket 连接成功');
|
|
4138
4756
|
this.isConnected = true;
|
|
4139
4757
|
this.initAudio();
|
|
4140
4758
|
};
|
|
4141
4759
|
this.ws.onmessage = event => {
|
|
4142
4760
|
try {
|
|
4143
4761
|
console.log("收到原始消息:", event.data);
|
|
4144
|
-
// 二进制数据直接返回
|
|
4145
4762
|
if (event.data instanceof ArrayBuffer) {
|
|
4146
4763
|
console.log("收到二进制音频数据");
|
|
4147
4764
|
return;
|
|
4148
4765
|
}
|
|
4149
|
-
// 解析JSON数据
|
|
4150
4766
|
const data = JSON.parse(event.data);
|
|
4151
4767
|
console.log("解析后的数据:", data);
|
|
4152
4768
|
if (data.type === 'config') {
|
|
4153
4769
|
console.log('配置信息:', data);
|
|
4154
4770
|
} else if (data.code === 0) {
|
|
4155
|
-
|
|
4156
|
-
console.log('检测到唤醒词...');
|
|
4157
|
-
this.avaterStatus = 'normal';
|
|
4158
|
-
} else if (data.data.type === 'Collecting') {
|
|
4159
|
-
console.log('状态: 采集中...');
|
|
4160
|
-
this.avaterStatus = 'thinking';
|
|
4161
|
-
} else if (data.data.type === 'command') {
|
|
4162
|
-
// 根据指令改变机器人的状态
|
|
4163
|
-
console.log('状态: 处理中...');
|
|
4164
|
-
this.analyzeAudioCommand(data.data.category);
|
|
4165
|
-
} else {
|
|
4166
|
-
console.log('状态: 其他...');
|
|
4167
|
-
}
|
|
4771
|
+
this.handleWebSocketMessage(data.data);
|
|
4168
4772
|
} else {
|
|
4169
4773
|
console.error("服务器返回错误:", data.msg);
|
|
4170
4774
|
}
|
|
@@ -4173,28 +4777,336 @@ const FRAME_SIZE = 512;
|
|
|
4173
4777
|
}
|
|
4174
4778
|
};
|
|
4175
4779
|
this.ws.onclose = () => {
|
|
4176
|
-
console.log('连接关闭');
|
|
4780
|
+
console.log('WebSocket 连接关闭');
|
|
4177
4781
|
this.isConnected = false;
|
|
4178
4782
|
if (this.isRecording) {
|
|
4179
4783
|
this.stopRecording();
|
|
4180
4784
|
}
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4785
|
+
this.reconnectCount++;
|
|
4786
|
+
console.log(`已尝试重连 ${this.reconnectCount} 次`);
|
|
4787
|
+
if (this.reconnectCount <= this.maxReconnectAttempts) {
|
|
4788
|
+
setTimeout(() => {
|
|
4789
|
+
console.log('尝试重新建立连接');
|
|
4790
|
+
if (!this.isConnected) {
|
|
4791
|
+
this.initWebSocket();
|
|
4792
|
+
}
|
|
4793
|
+
}, 3000);
|
|
4794
|
+
}
|
|
4795
|
+
};
|
|
4796
|
+
this.ws.onerror = error => {
|
|
4797
|
+
console.error('WebSocket 错误:', error);
|
|
4188
4798
|
};
|
|
4189
4799
|
} catch (error) {
|
|
4190
4800
|
console.error('WebSocket连接失败:', error);
|
|
4191
4801
|
}
|
|
4192
4802
|
},
|
|
4803
|
+
handleWebSocketMessage(data) {
|
|
4804
|
+
if (data.type === 'detection') {
|
|
4805
|
+
console.log('检测到唤醒词');
|
|
4806
|
+
this.avaterStatus = 'normal';
|
|
4807
|
+
} else if (data.type === 'Collecting') {
|
|
4808
|
+
console.log('状态: 采集中');
|
|
4809
|
+
this.avaterStatus = 'thinking';
|
|
4810
|
+
} else if (data.type === 'command') {
|
|
4811
|
+
console.log('状态: 处理中');
|
|
4812
|
+
this.analyzeAudioCommand(data.category);
|
|
4813
|
+
} else {
|
|
4814
|
+
console.log('状态: 其他');
|
|
4815
|
+
}
|
|
4816
|
+
},
|
|
4193
4817
|
closeWebSocket() {
|
|
4194
4818
|
if (this.ws) {
|
|
4195
4819
|
this.ws.close();
|
|
4196
4820
|
}
|
|
4197
|
-
}
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
});
|
|
4824
|
+
;// ./components/utils/StreamParser.js
|
|
4825
|
+
|
|
4826
|
+
|
|
4827
|
+
/**
|
|
4828
|
+
* SSE (Server-Sent Events) 流解析器
|
|
4829
|
+
* 优化点:
|
|
4830
|
+
* 1. 使用状态机模式处理标签解析
|
|
4831
|
+
* 2. 批量更新减少DOM操作
|
|
4832
|
+
* 3. 内存优化:避免频繁字符串拼接
|
|
4833
|
+
* 4. 可配置的更新频率
|
|
4834
|
+
*/
|
|
4835
|
+
class StreamParser {
|
|
4836
|
+
constructor(options = {}) {
|
|
4837
|
+
this.options = {
|
|
4838
|
+
updateInterval: 16,
|
|
4839
|
+
// 更新间隔(ms),默认约60fps
|
|
4840
|
+
batchSize: 100,
|
|
4841
|
+
// 批处理大小
|
|
4842
|
+
debug: false,
|
|
4843
|
+
// 是否开启调试
|
|
4844
|
+
...options
|
|
4845
|
+
};
|
|
4846
|
+
this.reset();
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
/**
|
|
4850
|
+
* 重置解析器状态
|
|
4851
|
+
*/
|
|
4852
|
+
reset() {
|
|
4853
|
+
this.buffer = '';
|
|
4854
|
+
this.contentBuffer = []; // 使用数组缓冲,避免频繁字符串拼接
|
|
4855
|
+
this.thinkingBuffer = [];
|
|
4856
|
+
this.inTag = false;
|
|
4857
|
+
this.tagBuffer = '';
|
|
4858
|
+
this.updateTimer = null;
|
|
4859
|
+
this.status = 'output'; // thinking | output
|
|
4860
|
+
this.metrics = {
|
|
4861
|
+
startTime: Date.now(),
|
|
4862
|
+
chunks: 0,
|
|
4863
|
+
events: 0,
|
|
4864
|
+
chars: 0
|
|
4865
|
+
};
|
|
4866
|
+
}
|
|
4867
|
+
|
|
4868
|
+
/**
|
|
4869
|
+
* 处理流数据块
|
|
4870
|
+
* @param {string} chunk - 接收到的数据块
|
|
4871
|
+
* @param {Function} callback - 更新回调函数
|
|
4872
|
+
*/
|
|
4873
|
+
processChunk(chunk, callback) {
|
|
4874
|
+
this.metrics.chunks++;
|
|
4875
|
+
this.buffer += chunk;
|
|
4876
|
+
|
|
4877
|
+
// SSE 格式:事件由双换行符分隔
|
|
4878
|
+
const events = this.buffer.split('\n\n');
|
|
4879
|
+
|
|
4880
|
+
// 保留最后一个可能不完整的事件
|
|
4881
|
+
this.buffer = events.pop() || '';
|
|
4882
|
+
|
|
4883
|
+
// 处理完整的事件
|
|
4884
|
+
for (const event of events) {
|
|
4885
|
+
if (event.trim()) {
|
|
4886
|
+
this.metrics.events++;
|
|
4887
|
+
this.processEvent(event, callback);
|
|
4888
|
+
}
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4892
|
+
/**
|
|
4893
|
+
* 处理单个SSE事件
|
|
4894
|
+
*/
|
|
4895
|
+
processEvent(eventStr, callback) {
|
|
4896
|
+
const lines = eventStr.split('\n');
|
|
4897
|
+
for (const line of lines) {
|
|
4898
|
+
// 解析 data: 行
|
|
4899
|
+
if (line.startsWith('data:')) {
|
|
4900
|
+
const data = line.substring(5).trim();
|
|
4901
|
+
if (data === '[DONE]') {
|
|
4902
|
+
this.flush(callback);
|
|
4903
|
+
return;
|
|
4904
|
+
}
|
|
4905
|
+
try {
|
|
4906
|
+
const parsed = JSON.parse(data);
|
|
4907
|
+
const content = parsed?.choices?.[0]?.delta?.content;
|
|
4908
|
+
if (content) {
|
|
4909
|
+
this.metrics.chars += content.length;
|
|
4910
|
+
this.parseContent(content, callback);
|
|
4911
|
+
}
|
|
4912
|
+
} catch (error) {
|
|
4913
|
+
if (this.options.debug) {
|
|
4914
|
+
console.warn('[StreamParser] JSON解析失败:', data);
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4921
|
+
/**
|
|
4922
|
+
* 使用状态机解析内容和标签
|
|
4923
|
+
*/
|
|
4924
|
+
parseContent(content, callback) {
|
|
4925
|
+
let i = 0;
|
|
4926
|
+
while (i < content.length) {
|
|
4927
|
+
if (this.inTag) {
|
|
4928
|
+
// 在标签内部,查找标签结束
|
|
4929
|
+
const endIndex = content.indexOf('>', i);
|
|
4930
|
+
if (endIndex !== -1) {
|
|
4931
|
+
// 找到标签结束
|
|
4932
|
+
this.tagBuffer += content.substring(i, endIndex + 1);
|
|
4933
|
+
this.handleTag(this.tagBuffer);
|
|
4934
|
+
this.tagBuffer = '';
|
|
4935
|
+
this.inTag = false;
|
|
4936
|
+
i = endIndex + 1;
|
|
4937
|
+
} else {
|
|
4938
|
+
// 标签未结束,缓存剩余部分
|
|
4939
|
+
this.tagBuffer += content.substring(i);
|
|
4940
|
+
break;
|
|
4941
|
+
}
|
|
4942
|
+
} else {
|
|
4943
|
+
// 不在标签内,查找标签开始
|
|
4944
|
+
const startIndex = content.indexOf('<', i);
|
|
4945
|
+
if (startIndex !== -1) {
|
|
4946
|
+
// 找到标签开始,先处理前面的文本
|
|
4947
|
+
if (startIndex > i) {
|
|
4948
|
+
this.appendText(content.substring(i, startIndex));
|
|
4949
|
+
}
|
|
4950
|
+
|
|
4951
|
+
// 检查是否是完整标签
|
|
4952
|
+
const endIndex = content.indexOf('>', startIndex);
|
|
4953
|
+
if (endIndex !== -1) {
|
|
4954
|
+
// 完整标签
|
|
4955
|
+
const tag = content.substring(startIndex, endIndex + 1);
|
|
4956
|
+
this.handleTag(tag);
|
|
4957
|
+
i = endIndex + 1;
|
|
4958
|
+
} else {
|
|
4959
|
+
// 不完整标签,标记进入标签状态
|
|
4960
|
+
this.inTag = true;
|
|
4961
|
+
this.tagBuffer = content.substring(startIndex);
|
|
4962
|
+
break;
|
|
4963
|
+
}
|
|
4964
|
+
} else {
|
|
4965
|
+
// 没有标签,全部是文本
|
|
4966
|
+
this.appendText(content.substring(i));
|
|
4967
|
+
break;
|
|
4968
|
+
}
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4972
|
+
// 定时批量更新
|
|
4973
|
+
this.scheduleUpdate(callback);
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
/**
|
|
4977
|
+
* 处理标签
|
|
4978
|
+
*/
|
|
4979
|
+
handleTag(tag) {
|
|
4980
|
+
const tagName = tag.toLowerCase();
|
|
4981
|
+
if (tagName === '<think>') {
|
|
4982
|
+
this.status = 'thinking';
|
|
4983
|
+
} else if (tagName === '</think>') {
|
|
4984
|
+
this.status = 'output';
|
|
4985
|
+
}
|
|
4986
|
+
// 可扩展:支持更多标签类型
|
|
4987
|
+
// else if (tagName.startsWith('<code')) {
|
|
4988
|
+
// this.status = 'code';
|
|
4989
|
+
// }
|
|
4990
|
+
}
|
|
4991
|
+
|
|
4992
|
+
/**
|
|
4993
|
+
* 添加文本到缓冲区
|
|
4994
|
+
*/
|
|
4995
|
+
appendText(text) {
|
|
4996
|
+
if (!text) return;
|
|
4997
|
+
if (this.status === 'thinking') {
|
|
4998
|
+
this.thinkingBuffer.push(text);
|
|
4999
|
+
} else {
|
|
5000
|
+
this.contentBuffer.push(text);
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
|
|
5004
|
+
/**
|
|
5005
|
+
* 计划更新(防抖)
|
|
5006
|
+
*/
|
|
5007
|
+
scheduleUpdate(callback) {
|
|
5008
|
+
if (this.updateTimer) return;
|
|
5009
|
+
this.updateTimer = setTimeout(() => {
|
|
5010
|
+
this.flush(callback);
|
|
5011
|
+
this.updateTimer = null;
|
|
5012
|
+
}, this.options.updateInterval);
|
|
5013
|
+
}
|
|
5014
|
+
|
|
5015
|
+
/**
|
|
5016
|
+
* 立即刷新缓冲区
|
|
5017
|
+
*/
|
|
5018
|
+
flush(callback) {
|
|
5019
|
+
if (!callback) return;
|
|
5020
|
+
const hasThinking = this.thinkingBuffer.length > 0;
|
|
5021
|
+
const hasContent = this.contentBuffer.length > 0;
|
|
5022
|
+
if (!hasThinking && !hasContent) return;
|
|
5023
|
+
|
|
5024
|
+
// 使用 join 比字符串拼接性能更好
|
|
5025
|
+
const result = {
|
|
5026
|
+
thinking: hasThinking ? this.thinkingBuffer.join('') : null,
|
|
5027
|
+
content: hasContent ? this.contentBuffer.join('') : null,
|
|
5028
|
+
status: this.status
|
|
5029
|
+
};
|
|
5030
|
+
|
|
5031
|
+
// 清空缓冲区
|
|
5032
|
+
this.thinkingBuffer = [];
|
|
5033
|
+
this.contentBuffer = [];
|
|
5034
|
+
|
|
5035
|
+
// 回调更新
|
|
5036
|
+
callback(result);
|
|
5037
|
+
}
|
|
5038
|
+
|
|
5039
|
+
/**
|
|
5040
|
+
* 完成解析
|
|
5041
|
+
*/
|
|
5042
|
+
finish(callback) {
|
|
5043
|
+
this.flush(callback);
|
|
5044
|
+
if (this.updateTimer) {
|
|
5045
|
+
clearTimeout(this.updateTimer);
|
|
5046
|
+
this.updateTimer = null;
|
|
5047
|
+
}
|
|
5048
|
+
if (this.options.debug) {
|
|
5049
|
+
const duration = Date.now() - this.metrics.startTime;
|
|
5050
|
+
console.log('[StreamParser] 解析完成:', {
|
|
5051
|
+
耗时: `${duration}ms`,
|
|
5052
|
+
数据块: this.metrics.chunks,
|
|
5053
|
+
事件数: this.metrics.events,
|
|
5054
|
+
字符数: this.metrics.chars,
|
|
5055
|
+
平均速度: `${(this.metrics.chars / duration * 1000).toFixed(0)} chars/s`
|
|
5056
|
+
});
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
|
|
5060
|
+
/**
|
|
5061
|
+
* 销毁解析器
|
|
5062
|
+
*/
|
|
5063
|
+
destroy() {
|
|
5064
|
+
if (this.updateTimer) {
|
|
5065
|
+
clearTimeout(this.updateTimer);
|
|
5066
|
+
}
|
|
5067
|
+
this.reset();
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
|
|
5071
|
+
/**
|
|
5072
|
+
* 使用示例:
|
|
5073
|
+
*
|
|
5074
|
+
* const parser = new StreamParser({ debug: true });
|
|
5075
|
+
*
|
|
5076
|
+
* // 处理流
|
|
5077
|
+
* for await (const chunk of stream) {
|
|
5078
|
+
* parser.processChunk(chunk, (result) => {
|
|
5079
|
+
* if (result.thinking) {
|
|
5080
|
+
* message.thinking += result.thinking;
|
|
5081
|
+
* }
|
|
5082
|
+
* if (result.content) {
|
|
5083
|
+
* message.content += result.content;
|
|
5084
|
+
* }
|
|
5085
|
+
* this.$forceUpdate();
|
|
5086
|
+
* });
|
|
5087
|
+
* }
|
|
5088
|
+
*
|
|
5089
|
+
* // 完成
|
|
5090
|
+
* parser.finish();
|
|
5091
|
+
*/
|
|
5092
|
+
;// ./components/mixins/messageMixin.js
|
|
5093
|
+
|
|
5094
|
+
|
|
5095
|
+
/* harmony default export */ var messageMixin = ({
|
|
5096
|
+
data() {
|
|
5097
|
+
return {
|
|
5098
|
+
streamParser: null
|
|
5099
|
+
};
|
|
5100
|
+
},
|
|
5101
|
+
created() {
|
|
5102
|
+
// 初始化流解析器
|
|
5103
|
+
this.streamParser = new StreamParser({
|
|
5104
|
+
updateInterval: 16,
|
|
5105
|
+
// 约60fps
|
|
5106
|
+
debug: "production" === 'development'
|
|
5107
|
+
});
|
|
5108
|
+
},
|
|
5109
|
+
methods: {
|
|
4198
5110
|
createAiMessage() {
|
|
4199
5111
|
const message = {
|
|
4200
5112
|
id: this.messages.length + 1,
|
|
@@ -4221,59 +5133,21 @@ const FRAME_SIZE = 512;
|
|
|
4221
5133
|
this.inputMessage = '';
|
|
4222
5134
|
return message;
|
|
4223
5135
|
},
|
|
4224
|
-
async initAudio() {
|
|
4225
|
-
if (this.isRecording) return;
|
|
4226
|
-
try {
|
|
4227
|
-
this.isMicAvailable = true;
|
|
4228
|
-
// 2. 获取麦克风权限
|
|
4229
|
-
const stream = await navigator.mediaDevices.getUserMedia({
|
|
4230
|
-
audio: {
|
|
4231
|
-
sampleRate: SAMPLE_RATE,
|
|
4232
|
-
// 请求指定采样率
|
|
4233
|
-
channelCount: 1,
|
|
4234
|
-
// 单声道
|
|
4235
|
-
noiseSuppression: true,
|
|
4236
|
-
echoCancellation: true
|
|
4237
|
-
}
|
|
4238
|
-
});
|
|
4239
|
-
|
|
4240
|
-
// 3. 创建音频处理环境
|
|
4241
|
-
this.audioContext = new AudioContext({
|
|
4242
|
-
sampleRate: SAMPLE_RATE
|
|
4243
|
-
});
|
|
4244
|
-
const actualSampleRate = this.audioContext.sampleRate;
|
|
4245
|
-
this.microphone = this.audioContext.createMediaStreamSource(stream);
|
|
4246
|
-
|
|
4247
|
-
// 4. 创建音频处理器
|
|
4248
|
-
this.processor = this.audioContext.createScriptProcessor(FRAME_SIZE, 1, 1);
|
|
4249
|
-
this.processor.onaudioprocess = this.processAudio;
|
|
4250
|
-
// 连接处理链
|
|
4251
|
-
this.microphone.connect(this.processor);
|
|
4252
|
-
this.processor.connect(this.audioContext.destination);
|
|
4253
|
-
this.isRecording = true;
|
|
4254
|
-
console.log(`状态: 录音中 (采样率: ${actualSampleRate}Hz)`);
|
|
4255
|
-
} catch (error) {
|
|
4256
|
-
console.error("音频初始化失败:", error);
|
|
4257
|
-
this.isRecording = false;
|
|
4258
|
-
this.isMicAvailable = false;
|
|
4259
|
-
}
|
|
4260
|
-
},
|
|
4261
5136
|
async handleSend() {
|
|
4262
5137
|
if (!this.inputMessage.trim()) {
|
|
4263
5138
|
return;
|
|
4264
5139
|
}
|
|
4265
5140
|
const message = this.inputMessage.trim();
|
|
4266
|
-
// 初始化信息
|
|
4267
|
-
this.initState();
|
|
4268
|
-
// 发送消息
|
|
4269
5141
|
this.createUserMessage(message);
|
|
4270
|
-
// 创建AI消息
|
|
4271
5142
|
this.createAiMessage();
|
|
5143
|
+
|
|
5144
|
+
// 重置解析器
|
|
5145
|
+
this.streamParser.reset();
|
|
4272
5146
|
try {
|
|
5147
|
+
const startTime = Date.now();
|
|
4273
5148
|
const controller = new AbortController();
|
|
4274
|
-
const token = `Bearer
|
|
5149
|
+
const token = `Bearer ac627d0a-8346-4ae9-b93a-f37ff6210adc`;
|
|
4275
5150
|
const response = await fetch('/bytserver/api-model/chat/stream', {
|
|
4276
|
-
timeout: 30000,
|
|
4277
5151
|
method: 'POST',
|
|
4278
5152
|
signal: controller.signal,
|
|
4279
5153
|
headers: {
|
|
@@ -4285,337 +5159,208 @@ const FRAME_SIZE = 512;
|
|
|
4285
5159
|
})
|
|
4286
5160
|
});
|
|
4287
5161
|
if (!response.ok) {
|
|
4288
|
-
throw new Error(
|
|
5162
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
4289
5163
|
}
|
|
4290
|
-
const render = response.body.getReader();
|
|
4291
|
-
const decoder = new TextDecoder();
|
|
4292
5164
|
|
|
4293
|
-
//
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
}
|
|
4305
|
-
} catch (error) {
|
|
4306
|
-
console.error('发送消息失败:', error);
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
analyzeAudioCommand(command) {
|
|
4312
|
-
console.log('分析音频命令:', command);
|
|
4313
|
-
// 解析到开始导览,执行机器人进入动画
|
|
4314
|
-
if (command === 'C5') {
|
|
4315
|
-
this.robotStatus = 'entering';
|
|
4316
|
-
setTimeout(() => {
|
|
4317
|
-
this.robotStatus = 'speaking';
|
|
4318
|
-
this.play();
|
|
4319
|
-
}, 3000);
|
|
4320
|
-
}
|
|
4321
|
-
// 继续导览
|
|
4322
|
-
else if (command === 'C8') {
|
|
4323
|
-
this.robotStatus = 'speaking';
|
|
4324
|
-
this.play();
|
|
4325
|
-
}
|
|
4326
|
-
// 解析到暂停导览,执行机器人暂停动画
|
|
4327
|
-
else if (command === 'C7') {
|
|
4328
|
-
this.robotStatus = 'waiting';
|
|
4329
|
-
this.pause();
|
|
4330
|
-
}
|
|
4331
|
-
// 解析到结束导览,执行机器人离开动画
|
|
4332
|
-
else if (command === 'C6') {
|
|
4333
|
-
this.robotStatus = 'leaving';
|
|
4334
|
-
this.stop();
|
|
5165
|
+
// 使用优化的流处理
|
|
5166
|
+
await this.consumeStream(response.body);
|
|
5167
|
+
|
|
5168
|
+
// 完成解析
|
|
5169
|
+
this.streamParser.finish(this.handleStreamUpdate);
|
|
5170
|
+
|
|
5171
|
+
// 记录耗时
|
|
5172
|
+
const duration = Date.now() - startTime;
|
|
5173
|
+
if (this.currentMessage) {
|
|
5174
|
+
this.currentMessage.time = (duration / 1000).toFixed(2);
|
|
5175
|
+
}
|
|
5176
|
+
console.log(`流处理完成,总耗时: ${duration}ms`);
|
|
5177
|
+
} catch (error) {
|
|
5178
|
+
console.error('发送消息失败:', error);
|
|
5179
|
+
if (this.currentMessage) {
|
|
5180
|
+
this.currentMessage.content = '抱歉,发生了错误,请重试。';
|
|
5181
|
+
this.$forceUpdate();
|
|
5182
|
+
}
|
|
4335
5183
|
}
|
|
4336
5184
|
},
|
|
4337
|
-
|
|
4338
|
-
|
|
5185
|
+
/**
|
|
5186
|
+
* 消费流数据
|
|
5187
|
+
*/
|
|
5188
|
+
async consumeStream(readableStream) {
|
|
5189
|
+
const reader = readableStream.getReader();
|
|
5190
|
+
const decoder = new TextDecoder('utf-8');
|
|
4339
5191
|
try {
|
|
4340
|
-
this.buffer += chunk;
|
|
4341
|
-
|
|
4342
5192
|
// eslint-disable-next-line no-constant-condition
|
|
4343
5193
|
while (true) {
|
|
4344
|
-
const
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
5194
|
+
const {
|
|
5195
|
+
done,
|
|
5196
|
+
value
|
|
5197
|
+
} = await reader.read();
|
|
5198
|
+
if (done) break;
|
|
5199
|
+
const chunk = decoder.decode(value, {
|
|
5200
|
+
stream: true
|
|
5201
|
+
});
|
|
5202
|
+
|
|
5203
|
+
// 使用解析器处理数据块
|
|
5204
|
+
this.streamParser.processChunk(chunk, this.handleStreamUpdate);
|
|
4350
5205
|
}
|
|
4351
|
-
}
|
|
4352
|
-
|
|
4353
|
-
this.streaming = false;
|
|
4354
|
-
this.response = this.$t('3d.chat.dataFormatError');
|
|
4355
|
-
this.$forceUpdate();
|
|
5206
|
+
} finally {
|
|
5207
|
+
reader.releaseLock();
|
|
4356
5208
|
}
|
|
4357
5209
|
},
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
} catch (e) {
|
|
4368
|
-
console.warn('JSON解析跳过:', e.message);
|
|
4369
|
-
}
|
|
4370
|
-
});
|
|
4371
|
-
},
|
|
4372
|
-
safeJsonParse(jsonStr) {
|
|
4373
|
-
try {
|
|
4374
|
-
return JSON.parse(jsonStr);
|
|
4375
|
-
} catch (error) {
|
|
4376
|
-
console.warn('JSON parse failed:', jsonStr);
|
|
4377
|
-
return null;
|
|
5210
|
+
/**
|
|
5211
|
+
* 处理流更新回调
|
|
5212
|
+
*/
|
|
5213
|
+
handleStreamUpdate(result) {
|
|
5214
|
+
if (!this.currentMessage) return;
|
|
5215
|
+
|
|
5216
|
+
// 更新思考内容
|
|
5217
|
+
if (result.thinking) {
|
|
5218
|
+
this.currentMessage.thinking += result.thinking;
|
|
4378
5219
|
}
|
|
4379
|
-
},
|
|
4380
|
-
processContentDelta(delta) {
|
|
4381
|
-
const content = delta.content || '';
|
|
4382
|
-
if (!content || !this.currentMessage) return;
|
|
4383
|
-
for (let i = 0; i < content.length; i++) {
|
|
4384
|
-
const char = content[i];
|
|
4385
|
-
|
|
4386
|
-
// 处理正在拼接的标签
|
|
4387
|
-
if (this.inTag) {
|
|
4388
|
-
this.tagBuilder += char;
|
|
4389
|
-
if (char === '>') {
|
|
4390
|
-
const tag = this.tagBuilder;
|
|
4391
|
-
if (tag === '<think>') {
|
|
4392
|
-
this.avaterStatus = 'thinking';
|
|
4393
|
-
} else if (tag === '</think>') {
|
|
4394
|
-
this.avaterStatus = 'output';
|
|
4395
|
-
} else {
|
|
4396
|
-
console.log('无效标签:', tag);
|
|
4397
|
-
}
|
|
4398
|
-
|
|
4399
|
-
// 重置
|
|
4400
|
-
this.inTag = false;
|
|
4401
|
-
this.tagBuilder = '';
|
|
4402
|
-
}
|
|
4403
|
-
continue;
|
|
4404
|
-
}
|
|
4405
5220
|
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
continue;
|
|
4411
|
-
}
|
|
5221
|
+
// 更新回复内容
|
|
5222
|
+
if (result.content) {
|
|
5223
|
+
this.currentMessage.content += result.content;
|
|
5224
|
+
}
|
|
4412
5225
|
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
}
|
|
5226
|
+
// 更新状态
|
|
5227
|
+
if (result.status === 'thinking') {
|
|
5228
|
+
this.avaterStatus = 'thinking';
|
|
5229
|
+
} else {
|
|
5230
|
+
this.avaterStatus = 'output';
|
|
4419
5231
|
}
|
|
5232
|
+
|
|
5233
|
+
// 触发视图更新
|
|
4420
5234
|
this.$forceUpdate();
|
|
4421
|
-
}
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
5235
|
+
}
|
|
5236
|
+
},
|
|
5237
|
+
beforeDestroy() {
|
|
5238
|
+
// 清理解析器
|
|
5239
|
+
if (this.streamParser) {
|
|
5240
|
+
this.streamParser.destroy();
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
});
|
|
5244
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindow.vue?vue&type=script&lang=js
|
|
4426
5245
|
|
|
4427
|
-
// 累积音频数据
|
|
4428
|
-
const tempBuffer = new Float32Array(this.audioBuffer.length + inputData.length);
|
|
4429
|
-
tempBuffer.set(this.audioBuffer, 0);
|
|
4430
|
-
tempBuffer.set(inputData, this.audioBuffer.length);
|
|
4431
|
-
this.audioBuffer = tempBuffer;
|
|
4432
5246
|
|
|
4433
|
-
// 当累积足够一帧时发送
|
|
4434
|
-
while (this.audioBuffer.length >= FRAME_SIZE) {
|
|
4435
|
-
const frame = this.audioBuffer.slice(0, FRAME_SIZE);
|
|
4436
|
-
this.audioBuffer = this.audioBuffer.slice(FRAME_SIZE);
|
|
4437
5247
|
|
|
4438
|
-
// 转换为16位PCM
|
|
4439
|
-
const pcmData = this.floatTo16BitPCM(frame);
|
|
4440
5248
|
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
5249
|
+
|
|
5250
|
+
|
|
5251
|
+
|
|
5252
|
+
|
|
5253
|
+
|
|
5254
|
+
|
|
5255
|
+
|
|
5256
|
+
|
|
5257
|
+
|
|
5258
|
+
|
|
5259
|
+
|
|
5260
|
+
|
|
5261
|
+
const SAMPLE_RATE = 16000;
|
|
5262
|
+
const FRAME_SIZE = 512;
|
|
5263
|
+
/* harmony default export */ var ChatWindowvue_type_script_lang_js = ({
|
|
5264
|
+
name: 'ChatWindow',
|
|
5265
|
+
components: {
|
|
5266
|
+
ChatRobot: ChatRobot,
|
|
5267
|
+
ChatAvatar: ChatAvatar,
|
|
5268
|
+
ChatWindowDialog: ChatWindowDialog
|
|
5269
|
+
},
|
|
5270
|
+
mixins: [audioMixin, webSocketMixin, messageMixin],
|
|
5271
|
+
props: {
|
|
5272
|
+
appendToBody: {
|
|
5273
|
+
type: Boolean,
|
|
5274
|
+
default: true
|
|
5275
|
+
}
|
|
5276
|
+
},
|
|
5277
|
+
data() {
|
|
5278
|
+
return {
|
|
5279
|
+
audioSrc: '/minio/lingxiaoai/byt.mp3',
|
|
5280
|
+
inputMessage: '',
|
|
5281
|
+
visible: false,
|
|
5282
|
+
messages: [],
|
|
5283
|
+
robotStatus: 'leaving',
|
|
5284
|
+
avaterStatus: 'normal',
|
|
5285
|
+
currentMessage: null,
|
|
5286
|
+
thinkStatus: true,
|
|
5287
|
+
jumpedTimePoints: new Set(),
|
|
5288
|
+
SAMPLE_RATE,
|
|
5289
|
+
FRAME_SIZE
|
|
5290
|
+
};
|
|
5291
|
+
},
|
|
5292
|
+
mounted() {
|
|
5293
|
+
this.initWebSocket();
|
|
5294
|
+
if (this.appendToBody) {
|
|
5295
|
+
this.appendToBodyHandler();
|
|
5296
|
+
}
|
|
5297
|
+
},
|
|
5298
|
+
beforeDestroy() {
|
|
5299
|
+
if (this.appendToBody && this.$el.parentElement === document.body) {
|
|
5300
|
+
document.body.removeChild(this.$el);
|
|
5301
|
+
}
|
|
5302
|
+
this.closeWebSocket();
|
|
5303
|
+
this.stopRecording();
|
|
5304
|
+
},
|
|
5305
|
+
methods: {
|
|
4455
5306
|
toggleWindow() {
|
|
4456
5307
|
this.visible = !this.visible;
|
|
4457
5308
|
},
|
|
4458
|
-
|
|
4459
|
-
this.
|
|
5309
|
+
handleThinkingClick() {
|
|
5310
|
+
this.thinkStatus = !this.thinkStatus;
|
|
4460
5311
|
},
|
|
4461
|
-
|
|
5312
|
+
handleOverlayClick() {
|
|
4462
5313
|
this.visible = false;
|
|
4463
5314
|
},
|
|
4464
|
-
scrollToBottom() {
|
|
4465
|
-
this.$nextTick(() => {
|
|
4466
|
-
const chatArea = this.$refs.chatArea;
|
|
4467
|
-
if (chatArea) {
|
|
4468
|
-
chatArea.scrollTop = chatArea.scrollHeight;
|
|
4469
|
-
}
|
|
4470
|
-
});
|
|
4471
|
-
},
|
|
4472
|
-
handleKeyDown(e) {
|
|
4473
|
-
if (e.key === 'Enter' && !e.shiftKey) {
|
|
4474
|
-
e.preventDefault();
|
|
4475
|
-
this.handleSend();
|
|
4476
|
-
}
|
|
4477
|
-
},
|
|
4478
|
-
stopRecording() {
|
|
4479
|
-
if (!this.isRecording) return;
|
|
4480
|
-
if (this.microphone) this.microphone.disconnect();
|
|
4481
|
-
if (this.processor) this.processor.disconnect();
|
|
4482
|
-
if (this.analyser) this.analyser.disconnect();
|
|
4483
|
-
if (this.audioContext) {
|
|
4484
|
-
this.audioContext.close().catch(e => {
|
|
4485
|
-
console.error("关闭音频上下文失败:", e);
|
|
4486
|
-
});
|
|
4487
|
-
}
|
|
4488
|
-
this.isRecording = false;
|
|
4489
|
-
},
|
|
4490
|
-
// 添加到body的处理函数
|
|
4491
5315
|
appendToBodyHandler() {
|
|
4492
|
-
// 确保DOM已经渲染完成
|
|
4493
5316
|
this.$nextTick(() => {
|
|
4494
|
-
// 检查元素是否已经在body中
|
|
4495
5317
|
if (this.$el.parentElement !== document.body) {
|
|
4496
|
-
// 将组件的根元素移动到body中
|
|
4497
5318
|
document.body.appendChild(this.$el);
|
|
4498
5319
|
}
|
|
4499
5320
|
});
|
|
4500
5321
|
},
|
|
4501
|
-
//
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
5322
|
+
// 音频时间更新处理
|
|
5323
|
+
onTimeUpdate() {
|
|
5324
|
+
const audio = this.$refs.audioPlayer;
|
|
5325
|
+
const currentTime = audio.currentTime;
|
|
5326
|
+
if (!this.jumpedTimePoints) {
|
|
5327
|
+
this.jumpedTimePoints = new Set();
|
|
5328
|
+
}
|
|
5329
|
+
fetch('/minio/lingxiaoai/timeJumpPoints.json').then(response => response.json()).then(data => {
|
|
5330
|
+
console.log('时间跳转点:', data);
|
|
5331
|
+
data.forEach(point => {
|
|
5332
|
+
if (currentTime >= point.time && currentTime < point.time + 0.5 && !this.jumpedTimePoints.has(point.time)) {
|
|
5333
|
+
this.jumpedTimePoints.add(point.time);
|
|
5334
|
+
this.$appOptions.store.dispatch('tags/addTagview', {
|
|
5335
|
+
path: point.url,
|
|
5336
|
+
fullPath: point.url,
|
|
5337
|
+
label: point.title,
|
|
5338
|
+
name: point.title,
|
|
5339
|
+
meta: {
|
|
5340
|
+
title: point.title
|
|
5341
|
+
},
|
|
5342
|
+
query: {},
|
|
5343
|
+
params: {}
|
|
5344
|
+
});
|
|
5345
|
+
this.$appOptions.router.push({
|
|
5346
|
+
path: point.url
|
|
5347
|
+
});
|
|
5348
|
+
}
|
|
5349
|
+
});
|
|
5350
|
+
}).catch(error => console.error('获取时间跳转点失败:', error));
|
|
5351
|
+
},
|
|
5352
|
+
onAudioEnded() {
|
|
5353
|
+
this.robotStatus = 'leaving';
|
|
5354
|
+
this.jumpedTimePoints.clear();
|
|
4512
5355
|
}
|
|
4513
5356
|
}
|
|
4514
5357
|
});
|
|
4515
5358
|
;// ./components/ChatWindow.vue?vue&type=script&lang=js
|
|
4516
5359
|
/* harmony default export */ var components_ChatWindowvue_type_script_lang_js = (ChatWindowvue_type_script_lang_js);
|
|
4517
|
-
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindow.vue?vue&type=style&index=0&id=
|
|
5360
|
+
;// ./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/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindow.vue?vue&type=style&index=0&id=5792943c&prod&scoped=true&lang=css
|
|
4518
5361
|
// extracted by mini-css-extract-plugin
|
|
4519
5362
|
|
|
4520
|
-
;// ./components/ChatWindow.vue?vue&type=style&index=0&id=
|
|
4521
|
-
|
|
4522
|
-
;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
4523
|
-
/* globals __VUE_SSR_CONTEXT__ */
|
|
4524
|
-
|
|
4525
|
-
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
4526
|
-
// This module is a runtime utility for cleaner component module output and will
|
|
4527
|
-
// be included in the final webpack user bundle.
|
|
4528
|
-
|
|
4529
|
-
function normalizeComponent(
|
|
4530
|
-
scriptExports,
|
|
4531
|
-
render,
|
|
4532
|
-
staticRenderFns,
|
|
4533
|
-
functionalTemplate,
|
|
4534
|
-
injectStyles,
|
|
4535
|
-
scopeId,
|
|
4536
|
-
moduleIdentifier /* server only */,
|
|
4537
|
-
shadowMode /* vue-cli only */
|
|
4538
|
-
) {
|
|
4539
|
-
// Vue.extend constructor export interop
|
|
4540
|
-
var options =
|
|
4541
|
-
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
4542
|
-
|
|
4543
|
-
// render functions
|
|
4544
|
-
if (render) {
|
|
4545
|
-
options.render = render
|
|
4546
|
-
options.staticRenderFns = staticRenderFns
|
|
4547
|
-
options._compiled = true
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
// functional template
|
|
4551
|
-
if (functionalTemplate) {
|
|
4552
|
-
options.functional = true
|
|
4553
|
-
}
|
|
4554
|
-
|
|
4555
|
-
// scopedId
|
|
4556
|
-
if (scopeId) {
|
|
4557
|
-
options._scopeId = 'data-v-' + scopeId
|
|
4558
|
-
}
|
|
4559
|
-
|
|
4560
|
-
var hook
|
|
4561
|
-
if (moduleIdentifier) {
|
|
4562
|
-
// server build
|
|
4563
|
-
hook = function (context) {
|
|
4564
|
-
// 2.3 injection
|
|
4565
|
-
context =
|
|
4566
|
-
context || // cached call
|
|
4567
|
-
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
4568
|
-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
4569
|
-
// 2.2 with runInNewContext: true
|
|
4570
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
4571
|
-
context = __VUE_SSR_CONTEXT__
|
|
4572
|
-
}
|
|
4573
|
-
// inject component styles
|
|
4574
|
-
if (injectStyles) {
|
|
4575
|
-
injectStyles.call(this, context)
|
|
4576
|
-
}
|
|
4577
|
-
// register component module identifier for async chunk inferrence
|
|
4578
|
-
if (context && context._registeredComponents) {
|
|
4579
|
-
context._registeredComponents.add(moduleIdentifier)
|
|
4580
|
-
}
|
|
4581
|
-
}
|
|
4582
|
-
// used by ssr in case component is cached and beforeCreate
|
|
4583
|
-
// never gets called
|
|
4584
|
-
options._ssrRegister = hook
|
|
4585
|
-
} else if (injectStyles) {
|
|
4586
|
-
hook = shadowMode
|
|
4587
|
-
? function () {
|
|
4588
|
-
injectStyles.call(
|
|
4589
|
-
this,
|
|
4590
|
-
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
4591
|
-
)
|
|
4592
|
-
}
|
|
4593
|
-
: injectStyles
|
|
4594
|
-
}
|
|
4595
|
-
|
|
4596
|
-
if (hook) {
|
|
4597
|
-
if (options.functional) {
|
|
4598
|
-
// for template-only hot-reload because in that case the render fn doesn't
|
|
4599
|
-
// go through the normalizer
|
|
4600
|
-
options._injectStyles = hook
|
|
4601
|
-
// register for functional component in vue file
|
|
4602
|
-
var originalRender = options.render
|
|
4603
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
4604
|
-
hook.call(context)
|
|
4605
|
-
return originalRender(h, context)
|
|
4606
|
-
}
|
|
4607
|
-
} else {
|
|
4608
|
-
// inject component registration as beforeCreate hook
|
|
4609
|
-
var existing = options.beforeCreate
|
|
4610
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
|
|
4614
|
-
return {
|
|
4615
|
-
exports: scriptExports,
|
|
4616
|
-
options: options
|
|
4617
|
-
}
|
|
4618
|
-
}
|
|
5363
|
+
;// ./components/ChatWindow.vue?vue&type=style&index=0&id=5792943c&prod&scoped=true&lang=css
|
|
4619
5364
|
|
|
4620
5365
|
;// ./components/ChatWindow.vue
|
|
4621
5366
|
|
|
@@ -4626,18 +5371,18 @@ function normalizeComponent(
|
|
|
4626
5371
|
|
|
4627
5372
|
/* normalize component */
|
|
4628
5373
|
|
|
4629
|
-
var
|
|
5374
|
+
var ChatWindow_component = normalizeComponent(
|
|
4630
5375
|
components_ChatWindowvue_type_script_lang_js,
|
|
4631
5376
|
render,
|
|
4632
5377
|
staticRenderFns,
|
|
4633
5378
|
false,
|
|
4634
5379
|
null,
|
|
4635
|
-
"
|
|
5380
|
+
"5792943c",
|
|
4636
5381
|
null
|
|
4637
5382
|
|
|
4638
5383
|
)
|
|
4639
5384
|
|
|
4640
|
-
/* harmony default export */ var ChatWindow = (
|
|
5385
|
+
/* harmony default export */ var ChatWindow = (ChatWindow_component.exports);
|
|
4641
5386
|
;// ./components/index.js
|
|
4642
5387
|
|
|
4643
5388
|
|