ai-assistant-pro 0.0.6 → 0.0.8

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.
@@ -7428,7 +7428,7 @@ if (typeof window !== 'undefined') {
7428
7428
  // Indicate to webpack that this file can be concatenated
7429
7429
  /* harmony default export */ var setPublicPath = (null);
7430
7430
 
7431
- ;// CONCATENATED MODULE: ./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/demo/src/main.vue?vue&type=template&id=69b9f6b0&scoped=true
7431
+ ;// CONCATENATED MODULE: ./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/demo/src/main.vue?vue&type=template&id=77093a83&scoped=true
7432
7432
  var render = function render() {
7433
7433
  var _vm = this,
7434
7434
  _c = _vm._self._c;
@@ -7464,6 +7464,9 @@ var render = function render() {
7464
7464
  })])]), _vm.courseFlag ? [_c('div', {
7465
7465
  staticClass: "ai-main-content"
7466
7466
  }, [!_vm.chatShow ? _c('hot-search', {
7467
+ attrs: {
7468
+ "resId": _vm.resId
7469
+ },
7467
7470
  on: {
7468
7471
  "select-module": _vm.selectModule
7469
7472
  }
@@ -7471,9 +7474,11 @@ var render = function render() {
7471
7474
  ref: "chatRef",
7472
7475
  attrs: {
7473
7476
  "resId": _vm.resId,
7477
+ "open-course-id": _vm.openCourseId,
7474
7478
  "chatId": _vm.chatId,
7475
7479
  "key-word": _vm.aiMessageKeyWord,
7476
- "message-data": _vm.messageList
7480
+ "message-data": _vm.messageList,
7481
+ "chat-major-id": _vm.chatMajorId
7477
7482
  },
7478
7483
  on: {
7479
7484
  "on-reanser": _vm.reanserMethod,
@@ -7534,236 +7539,41 @@ var render = function render() {
7534
7539
  };
7535
7540
  var staticRenderFns = [];
7536
7541
 
7537
- ;// CONCATENATED MODULE: ./components/demo/src/main.vue?vue&type=template&id=69b9f6b0&scoped=true
7542
+ ;// CONCATENATED MODULE: ./components/demo/src/main.vue?vue&type=template&id=77093a83&scoped=true
7538
7543
 
7539
- ;// CONCATENATED MODULE: ./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/demo/src/hot-search.vue?vue&type=template&id=73bfe44c&scoped=true
7540
- var hot_searchvue_type_template_id_73bfe44c_scoped_true_render = function render() {
7544
+ ;// CONCATENATED MODULE: ./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/demo/src/hot-search.vue?vue&type=template&id=abf2ffc4&scoped=true
7545
+ var hot_searchvue_type_template_id_abf2ffc4_scoped_true_render = function render() {
7541
7546
  var _vm = this,
7542
7547
  _c = _vm._self._c;
7543
- return _vm._m(0);
7548
+ return _c('div', {
7549
+ staticClass: "hot-search-contain"
7550
+ }, [_vm._m(0), _c('div', {
7551
+ staticClass: "robot-message"
7552
+ }, [_vm.prologue ? [_vm._v(" " + _vm._s(_vm.prologue) + " ")] : [_c('p', [_vm._v("Hi,我是学习助手。")]), _c('p', [_vm._v("在这里你可以获得专业、准确的课程讲解,包括对公式的深入理解和细腻的解答。")])], _vm._l(_vm.aiMessage, function (list, index) {
7553
+ return _c('div', {
7554
+ key: index,
7555
+ staticClass: "hot-list",
7556
+ on: {
7557
+ "click": function ($event) {
7558
+ return _vm.selectModule(list);
7559
+ }
7560
+ }
7561
+ }, [_vm._v(" " + _vm._s(list) + " "), _c('i', {
7562
+ staticClass: "el-icon-arrow-right go-icon"
7563
+ })]);
7564
+ })], 2)]);
7544
7565
  };
7545
- var hot_searchvue_type_template_id_73bfe44c_scoped_true_staticRenderFns = [function () {
7566
+ var hot_searchvue_type_template_id_abf2ffc4_scoped_true_staticRenderFns = [function () {
7546
7567
  var _vm = this,
7547
7568
  _c = _vm._self._c;
7548
7569
  return _c('div', {
7549
- staticClass: "hot-search-contain"
7550
- }, [_c('div', {
7551
7570
  staticClass: "robot"
7552
7571
  }, [_c('div', {
7553
7572
  staticClass: "robot-image-div"
7554
- })]), _c('div', {
7555
- staticClass: "robot-message"
7556
- }, [_c('p', [_vm._v("Hi,我是学习助手。")]), _c('p', [_vm._v("在这里你可以获得专业、准确的课程讲解,包括对公式的深入理解和细腻的解答。")])])]);
7573
+ })]);
7557
7574
  }];
7558
7575
 
7559
- ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue?vue&type=template&id=73bfe44c&scoped=true
7560
-
7561
- ;// CONCATENATED MODULE: ./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/demo/src/hot-search.vue?vue&type=script&lang=js
7562
- /* harmony default export */ var hot_searchvue_type_script_lang_js = ({
7563
- name: 'HotSearch',
7564
- data() {
7565
- return {
7566
- aiMessage: [{
7567
- value: '请解释一下牛顿第二定律的公式和物理意义。',
7568
- id: 1
7569
- }, {
7570
- value: '电磁感应定律是如何描述的?请给出相关公式并解释。',
7571
- id: 2
7572
- }, {
7573
- value: '在光学中,光的干涉现象是如何产生的?能否用公式来表示?',
7574
- id: 3
7575
- }]
7576
- };
7577
- },
7578
- methods: {
7579
- selectModule(list) {
7580
- this.$emit('select-module', list);
7581
- }
7582
- }
7583
- });
7584
- ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue?vue&type=script&lang=js
7585
- /* harmony default export */ var src_hot_searchvue_type_script_lang_js = (hot_searchvue_type_script_lang_js);
7586
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/hot-search.vue?vue&type=style&index=0&id=73bfe44c&prod&lang=scss&scoped=true
7587
- // extracted by mini-css-extract-plugin
7588
-
7589
- ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue?vue&type=style&index=0&id=73bfe44c&prod&lang=scss&scoped=true
7590
-
7591
- ;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
7592
- /* globals __VUE_SSR_CONTEXT__ */
7593
-
7594
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
7595
- // This module is a runtime utility for cleaner component module output and will
7596
- // be included in the final webpack user bundle.
7597
-
7598
- function normalizeComponent(
7599
- scriptExports,
7600
- render,
7601
- staticRenderFns,
7602
- functionalTemplate,
7603
- injectStyles,
7604
- scopeId,
7605
- moduleIdentifier /* server only */,
7606
- shadowMode /* vue-cli only */
7607
- ) {
7608
- // Vue.extend constructor export interop
7609
- var options =
7610
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
7611
-
7612
- // render functions
7613
- if (render) {
7614
- options.render = render
7615
- options.staticRenderFns = staticRenderFns
7616
- options._compiled = true
7617
- }
7618
-
7619
- // functional template
7620
- if (functionalTemplate) {
7621
- options.functional = true
7622
- }
7623
-
7624
- // scopedId
7625
- if (scopeId) {
7626
- options._scopeId = 'data-v-' + scopeId
7627
- }
7628
-
7629
- var hook
7630
- if (moduleIdentifier) {
7631
- // server build
7632
- hook = function (context) {
7633
- // 2.3 injection
7634
- context =
7635
- context || // cached call
7636
- (this.$vnode && this.$vnode.ssrContext) || // stateful
7637
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
7638
- // 2.2 with runInNewContext: true
7639
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
7640
- context = __VUE_SSR_CONTEXT__
7641
- }
7642
- // inject component styles
7643
- if (injectStyles) {
7644
- injectStyles.call(this, context)
7645
- }
7646
- // register component module identifier for async chunk inferrence
7647
- if (context && context._registeredComponents) {
7648
- context._registeredComponents.add(moduleIdentifier)
7649
- }
7650
- }
7651
- // used by ssr in case component is cached and beforeCreate
7652
- // never gets called
7653
- options._ssrRegister = hook
7654
- } else if (injectStyles) {
7655
- hook = shadowMode
7656
- ? function () {
7657
- injectStyles.call(
7658
- this,
7659
- (options.functional ? this.parent : this).$root.$options.shadowRoot
7660
- )
7661
- }
7662
- : injectStyles
7663
- }
7664
-
7665
- if (hook) {
7666
- if (options.functional) {
7667
- // for template-only hot-reload because in that case the render fn doesn't
7668
- // go through the normalizer
7669
- options._injectStyles = hook
7670
- // register for functional component in vue file
7671
- var originalRender = options.render
7672
- options.render = function renderWithStyleInjection(h, context) {
7673
- hook.call(context)
7674
- return originalRender(h, context)
7675
- }
7676
- } else {
7677
- // inject component registration as beforeCreate hook
7678
- var existing = options.beforeCreate
7679
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
7680
- }
7681
- }
7682
-
7683
- return {
7684
- exports: scriptExports,
7685
- options: options
7686
- }
7687
- }
7688
-
7689
- ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue
7690
-
7691
-
7692
-
7693
- ;
7694
-
7695
-
7696
- /* normalize component */
7697
-
7698
- var component = normalizeComponent(
7699
- src_hot_searchvue_type_script_lang_js,
7700
- hot_searchvue_type_template_id_73bfe44c_scoped_true_render,
7701
- hot_searchvue_type_template_id_73bfe44c_scoped_true_staticRenderFns,
7702
- false,
7703
- null,
7704
- "73bfe44c",
7705
- null
7706
-
7707
- )
7708
-
7709
- /* harmony default export */ var hot_search = (component.exports);
7710
- ;// CONCATENATED MODULE: ./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/demo/src/chat.vue?vue&type=template&id=80375d7a&scoped=true
7711
- var chatvue_type_template_id_80375d7a_scoped_true_render = function render() {
7712
- var _vm = this,
7713
- _c = _vm._self._c;
7714
- return _c('div', {
7715
- ref: "chatContainer",
7716
- staticClass: "chat-contain"
7717
- }, _vm._l(_vm.messageData, function (list, index) {
7718
- return _c('div', {
7719
- key: index,
7720
- staticClass: "message",
7721
- class: {
7722
- 'user-list': list.type === 'user'
7723
- }
7724
- }, [list.type === 'robot' ? _c('div', {
7725
- staticClass: "robot"
7726
- }, [_c('div', {
7727
- staticClass: "robot-image-div"
7728
- })]) : _c('div', {
7729
- staticClass: "robot user"
7730
- }, [_vm._v("user")]), _c('div', {
7731
- staticClass: "robot-message",
7732
- class: {
7733
- 'user-info': list.type === 'user'
7734
- }
7735
- }, [_c('div', {
7736
- domProps: {
7737
- "innerHTML": _vm._s(list.message)
7738
- }
7739
- }), list.type === 'robot' && list.links.length > 0 ? _c('div', {
7740
- staticClass: "link"
7741
- }, [_c('div', {
7742
- staticClass: "link-title"
7743
- }, [_vm._v("相关链接")]), _c('div', {
7744
- staticClass: "link-content"
7745
- }, _vm._l(list.links, function (item) {
7746
- return _c('div', {
7747
- staticClass: "links"
7748
- }, [_c('a', {
7749
- attrs: {
7750
- "href": 'https://ai-yuliao.hep.com.cn' + item.documentUrl,
7751
- "target": "_blank"
7752
- }
7753
- }, [_c('span', [_vm._v(_vm._s(item.title))])])]);
7754
- }), 0)]) : _vm._e(), list.type === 'robot' ? _c('chat-tools', {
7755
- attrs: {
7756
- "chatId": _vm.chatId,
7757
- "detail-data": list
7758
- },
7759
- on: {
7760
- "on-reanswer": list => _vm.reanswer(list, index),
7761
- "on-stop-chat": _vm.onStopChat
7762
- }
7763
- }) : _vm._e()], 1)]);
7764
- }), 0);
7765
- };
7766
- var chatvue_type_template_id_80375d7a_scoped_true_staticRenderFns = [];
7576
+ ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue?vue&type=template&id=abf2ffc4&scoped=true
7767
7577
 
7768
7578
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/bind.js
7769
7579
 
@@ -12158,17 +11968,17 @@ const iv = crypto_js_default().enc.Utf8.parse(n);
12158
11968
  // 解密方法
12159
11969
  function decrypt(word) {
12160
11970
  const stringToEncode = 'Hello, World!'; // 要进行 Base64 编码的字符串
12161
- const encodedString = gBase64.encode(stringToEncode); // 进行 Base64 编码
12162
- const decodedString = gBase64.decode(encodedString); // 进行 Base64 解码
11971
+ const encodedString = Base64.encode(stringToEncode); // 进行 Base64 编码
11972
+ const decodedString = Base64.decode(encodedString); // 进行 Base64 解码
12163
11973
 
12164
- let base64 = crypto_js_default().enc.Base64.parse(word);
12165
- let src = crypto_js_default().enc.Base64.stringify(base64);
12166
- let decrypt = crypto_js_default().AES.decrypt(src, key, {
11974
+ let base64 = CryptoJS.enc.Base64.parse(word);
11975
+ let src = CryptoJS.enc.Base64.stringify(base64);
11976
+ let decrypt = CryptoJS.AES.decrypt(src, key, {
12167
11977
  iv: iv,
12168
- mode: (crypto_js_default()).mode.CBC,
12169
- padding: (crypto_js_default()).pad.Pkcs7
11978
+ mode: CryptoJS.mode.CBC,
11979
+ padding: CryptoJS.pad.Pkcs7
12170
11980
  });
12171
- let decryptedStr = decrypt.toString((crypto_js_default()).enc.Utf8);
11981
+ let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
12172
11982
  return decryptedStr.toString();
12173
11983
  }
12174
11984
  ;// CONCATENATED MODULE: ./components/demo/utils/constants.js
@@ -12202,7 +12012,9 @@ const service = lib_axios.create({
12202
12012
  });
12203
12013
  service.interceptors.request.use(config => {
12204
12014
  if (cache.session.getJSON('SRKJ_TOKEN_CACHE')) {
12205
- config.headers["X-Id-Token"] = cache.session.getJSON('SRKJ_TOKEN_CACHE');
12015
+ // config.headers["X-Id-Token"] = cache.session.getJSON('SRKJ_TOKEN_CACHE');
12016
+ if (!config.params) config.params = {};
12017
+ config.params.token = cache.session.getJSON('SRKJ_TOKEN_CACHE');
12206
12018
  }
12207
12019
  // 是否需要防止数据重复提交
12208
12020
  const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
@@ -12235,12 +12047,12 @@ service.interceptors.response.use(res => {
12235
12047
  return res.data;
12236
12048
  }
12237
12049
  let srkjData = res.data;
12238
- if (srkjData) {
12239
- const respData = decrypt(srkjData);
12240
- try {
12241
- srkjData = JSON.parse(respData);
12242
- } catch (e) {}
12243
- }
12050
+ // if (srkjData) {
12051
+ // const respData = decrypt(srkjData);
12052
+ // try {
12053
+ // srkjData = JSON.parse(respData);
12054
+ // } catch (e) {}
12055
+ // }
12244
12056
  if (res.status === 401) {
12245
12057
  external_element_ui_namespaceObject.Message.warning(srkjData.message.description);
12246
12058
  return;
@@ -12250,7 +12062,7 @@ service.interceptors.response.use(res => {
12250
12062
  }
12251
12063
  return srkjData.queryData || srkjData.data || srkjData.token;
12252
12064
  });
12253
- /* harmony default export */ var request = (service);
12065
+ /* harmony default export */ var utils_request = (service);
12254
12066
  ;// CONCATENATED MODULE: ./node_modules/@microsoft/fetch-event-source/lib/esm/parse.js
12255
12067
  async function getBytes(stream, onChunk) {
12256
12068
  const reader = stream.getReader();
@@ -12457,10 +12269,12 @@ function defaultOnOpen(response) {
12457
12269
 
12458
12270
 
12459
12271
  const baseURL = sessionStorage.getItem('AI-INTELLIGENT-TOOLS_BASE_URL') || constants.publicPath;
12460
- const prefix = sessionStorage.getItem('AI-INTELLIGENT-TOOLS_PRE_FIX') || constants.publicPrefix;
12272
+ let prefix = sessionStorage.getItem('AI-INTELLIGENT-TOOLS_PRE_FIX') || constants.publicPrefix;
12273
+ // 0.0.8 版本接口升级
12274
+ prefix += '/plugin/v2';
12461
12275
 
12462
12276
  const ssoAuth = token => {
12463
- return request({
12277
+ return utils_request({
12464
12278
  url: prefix + '/sso/assistant',
12465
12279
  method: 'get',
12466
12280
  params: {
@@ -12476,7 +12290,7 @@ const authUser = headers => {
12476
12290
  });
12477
12291
  };
12478
12292
  const newChat = resId => {
12479
- return request({
12293
+ return utils_request({
12480
12294
  url: prefix + '/assistant/addChat',
12481
12295
  method: 'post',
12482
12296
  params: {
@@ -12485,46 +12299,46 @@ const newChat = resId => {
12485
12299
  });
12486
12300
  };
12487
12301
  const chartClear = chatId => {
12488
- return request({
12302
+ return utils_request({
12489
12303
  url: prefix + `/assistant/chartClear/${chatId}`,
12490
12304
  method: 'post'
12491
12305
  });
12492
12306
  };
12493
12307
  const stopChat = chatId => {
12494
- return request({
12308
+ return utils_request({
12495
12309
  url: prefix + `/assistant/stop/${chatId}`,
12496
12310
  method: 'post'
12497
12311
  });
12498
12312
  };
12499
12313
  const chatEvaluateAdd = params => {
12500
- return request({
12314
+ return utils_request({
12501
12315
  url: prefix + `/assistant/chatEvaluateAdd`,
12502
12316
  method: 'post',
12503
12317
  data: params
12504
12318
  });
12505
12319
  };
12506
12320
  const chatEvaluateCancel = params => {
12507
- return request({
12321
+ return utils_request({
12508
12322
  url: prefix + `/assistant/chatEvaluateCancel`,
12509
12323
  method: 'post',
12510
12324
  data: params
12511
12325
  });
12512
12326
  };
12513
12327
  const pustReanswerToTeacher = params => {
12514
- return request({
12328
+ return utils_request({
12515
12329
  url: prefix + `/assistant/push`,
12516
12330
  method: 'post',
12517
12331
  data: params
12518
12332
  });
12519
12333
  };
12520
12334
  const getDetailList = resId => {
12521
- return request({
12335
+ return utils_request({
12522
12336
  url: prefix + `/assistant/detail/v2/${resId}`,
12523
12337
  method: 'get'
12524
12338
  });
12525
12339
  };
12526
12340
  const countAccess = resId => {
12527
- return request({
12341
+ return utils_request({
12528
12342
  url: prefix + `/assistant/access`,
12529
12343
  method: 'post',
12530
12344
  params: {
@@ -12533,27 +12347,315 @@ const countAccess = resId => {
12533
12347
  });
12534
12348
  };
12535
12349
  const checkCourseIdIsExist = resId => {
12536
- return request({
12350
+ return utils_request({
12537
12351
  url: prefix + `/ia/hasPermission?courseId=${resId}`,
12538
12352
  method: 'get'
12539
12353
  });
12540
12354
  };
12355
+ /**
12356
+ * 开场白及提示词查询
12357
+ * */
12358
+ const queryCallWord = resId => {
12359
+ return utils_request({
12360
+ url: prefix + `/ia/byCourseId?courseId=${resId}`,
12361
+ method: 'get'
12362
+ });
12363
+ };
12364
+
12365
+ /**
12366
+ * 自动追问
12367
+ * @param iaId 请求参数id
12368
+ * @param message 对话对
12369
+ * @returns 返回节点详情数据
12370
+ */
12371
+ async function getAutoQuestioning(iaId, message) {
12372
+ return utils_request.post(`${prefix}/ia/autoFollowUp`, {
12373
+ iaId,
12374
+ messages: message
12375
+ });
12376
+ }
12541
12377
  async function sendMessageEventSource(params, signal, onmessage) {
12542
- return fetchEventSource(`${baseURL}${prefix}/assistant/conversation`, {
12378
+ return fetchEventSource(`${baseURL}${prefix}/assistant/conversation?token=${cache.session.getJSON('SRKJ_TOKEN_CACHE')}`, {
12543
12379
  method: 'POST',
12544
12380
  signal: signal,
12545
12381
  openWhenHidden: true,
12546
12382
  headers: {
12547
- 'Content-Type': 'application/json',
12548
- 'X-Id-Token': cache.session.getJSON('SRKJ_TOKEN_CACHE')
12383
+ 'Content-Type': 'application/json'
12384
+ // 'X-Id-Token': cache.session.getJSON('SRKJ_TOKEN_CACHE'),
12549
12385
  },
12550
12386
  body: JSON.stringify(params),
12551
12387
  onmessage
12552
12388
  });
12553
12389
  }
12554
- ;// CONCATENATED MODULE: ./components/demo/utils/config.js
12390
+ ;// CONCATENATED MODULE: ./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/demo/src/hot-search.vue?vue&type=script&lang=js
12555
12391
 
12392
+ /* harmony default export */ var hot_searchvue_type_script_lang_js = ({
12393
+ name: 'HotSearch',
12394
+ props: {
12395
+ resId: {
12396
+ type: String,
12397
+ default: ''
12398
+ }
12399
+ },
12400
+ data() {
12401
+ return {
12402
+ aiMessage: [
12403
+ // {
12404
+ // value: '请解释一下牛顿第二定律的公式和物理意义。',
12405
+ // id: 1,
12406
+ // },
12407
+ // {
12408
+ // value: '电磁感应定律是如何描述的?请给出相关公式并解释。',
12409
+ // id: 2,
12410
+ // },
12411
+ // {
12412
+ // value: '在光学中,光的干涉现象是如何产生的?能否用公式来表示?',
12413
+ // id: 3,
12414
+ // }
12415
+ ],
12416
+ prologue: ' '
12417
+ };
12418
+ },
12419
+ methods: {
12420
+ selectModule(list) {
12421
+ this.$emit('select-module', list);
12422
+ }
12423
+ },
12424
+ async mounted() {
12425
+ const wordRes = await queryCallWord(this.resId);
12426
+ if (!wordRes) return;
12427
+ const {
12428
+ guideExample,
12429
+ prologue
12430
+ } = wordRes;
12431
+ if (guideExample && guideExample.length > 0) {
12432
+ this.aiMessage = JSON.parse(guideExample);
12433
+ }
12434
+ this.prologue = prologue;
12435
+ }
12436
+ });
12437
+ ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue?vue&type=script&lang=js
12438
+ /* harmony default export */ var src_hot_searchvue_type_script_lang_js = (hot_searchvue_type_script_lang_js);
12439
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/hot-search.vue?vue&type=style&index=0&id=abf2ffc4&prod&lang=scss&scoped=true
12440
+ // extracted by mini-css-extract-plugin
12441
+
12442
+ ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue?vue&type=style&index=0&id=abf2ffc4&prod&lang=scss&scoped=true
12443
+
12444
+ ;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
12445
+ /* globals __VUE_SSR_CONTEXT__ */
12446
+
12447
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
12448
+ // This module is a runtime utility for cleaner component module output and will
12449
+ // be included in the final webpack user bundle.
12450
+
12451
+ function normalizeComponent(
12452
+ scriptExports,
12453
+ render,
12454
+ staticRenderFns,
12455
+ functionalTemplate,
12456
+ injectStyles,
12457
+ scopeId,
12458
+ moduleIdentifier /* server only */,
12459
+ shadowMode /* vue-cli only */
12460
+ ) {
12461
+ // Vue.extend constructor export interop
12462
+ var options =
12463
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
12464
+
12465
+ // render functions
12466
+ if (render) {
12467
+ options.render = render
12468
+ options.staticRenderFns = staticRenderFns
12469
+ options._compiled = true
12470
+ }
12471
+
12472
+ // functional template
12473
+ if (functionalTemplate) {
12474
+ options.functional = true
12475
+ }
12476
+
12477
+ // scopedId
12478
+ if (scopeId) {
12479
+ options._scopeId = 'data-v-' + scopeId
12480
+ }
12481
+
12482
+ var hook
12483
+ if (moduleIdentifier) {
12484
+ // server build
12485
+ hook = function (context) {
12486
+ // 2.3 injection
12487
+ context =
12488
+ context || // cached call
12489
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
12490
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
12491
+ // 2.2 with runInNewContext: true
12492
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
12493
+ context = __VUE_SSR_CONTEXT__
12494
+ }
12495
+ // inject component styles
12496
+ if (injectStyles) {
12497
+ injectStyles.call(this, context)
12498
+ }
12499
+ // register component module identifier for async chunk inferrence
12500
+ if (context && context._registeredComponents) {
12501
+ context._registeredComponents.add(moduleIdentifier)
12502
+ }
12503
+ }
12504
+ // used by ssr in case component is cached and beforeCreate
12505
+ // never gets called
12506
+ options._ssrRegister = hook
12507
+ } else if (injectStyles) {
12508
+ hook = shadowMode
12509
+ ? function () {
12510
+ injectStyles.call(
12511
+ this,
12512
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
12513
+ )
12514
+ }
12515
+ : injectStyles
12516
+ }
12517
+
12518
+ if (hook) {
12519
+ if (options.functional) {
12520
+ // for template-only hot-reload because in that case the render fn doesn't
12521
+ // go through the normalizer
12522
+ options._injectStyles = hook
12523
+ // register for functional component in vue file
12524
+ var originalRender = options.render
12525
+ options.render = function renderWithStyleInjection(h, context) {
12526
+ hook.call(context)
12527
+ return originalRender(h, context)
12528
+ }
12529
+ } else {
12530
+ // inject component registration as beforeCreate hook
12531
+ var existing = options.beforeCreate
12532
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
12533
+ }
12534
+ }
12535
+
12536
+ return {
12537
+ exports: scriptExports,
12538
+ options: options
12539
+ }
12540
+ }
12541
+
12542
+ ;// CONCATENATED MODULE: ./components/demo/src/hot-search.vue
12543
+
12544
+
12545
+
12546
+ ;
12547
+
12548
+
12549
+ /* normalize component */
12550
+
12551
+ var component = normalizeComponent(
12552
+ src_hot_searchvue_type_script_lang_js,
12553
+ hot_searchvue_type_template_id_abf2ffc4_scoped_true_render,
12554
+ hot_searchvue_type_template_id_abf2ffc4_scoped_true_staticRenderFns,
12555
+ false,
12556
+ null,
12557
+ "abf2ffc4",
12558
+ null
12559
+
12560
+ )
12556
12561
 
12562
+ /* harmony default export */ var hot_search = (component.exports);
12563
+ ;// CONCATENATED MODULE: ./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/demo/src/chat.vue?vue&type=template&id=069a8301&scoped=true
12564
+ var chatvue_type_template_id_069a8301_scoped_true_render = function render() {
12565
+ var _vm = this,
12566
+ _c = _vm._self._c;
12567
+ return _c('div', {
12568
+ ref: "chatContainer",
12569
+ staticClass: "chat-contain"
12570
+ }, _vm._l(_vm.messageData, function (list, index) {
12571
+ return _c('div', {
12572
+ key: index,
12573
+ staticClass: "message",
12574
+ class: {
12575
+ 'user-list': list.type === 'user'
12576
+ }
12577
+ }, [list.type === 'robot' ? _c('div', {
12578
+ staticClass: "robot"
12579
+ }, [_c('div', {
12580
+ staticClass: "robot-image-div"
12581
+ })]) : _c('div', {
12582
+ staticClass: "robot user"
12583
+ }, [_vm._v("user")]), _c('div', {
12584
+ staticClass: "robot-message",
12585
+ class: {
12586
+ 'user-info': list.type === 'user'
12587
+ }
12588
+ }, [_c('div', {
12589
+ domProps: {
12590
+ "innerHTML": _vm._s(list.message)
12591
+ }
12592
+ }), list.type === 'robot' && list.links.length > 0 ? _c('div', {
12593
+ staticClass: "link"
12594
+ }, [!list.allIdWithStart ? _c('div', [_c('div', {
12595
+ staticClass: "link-title"
12596
+ }, [_vm._v("参考文件")]), _c('div', {
12597
+ staticClass: "link-content"
12598
+ }, [_vm._l(list.links, function (item) {
12599
+ return [!item.title.startsWith(_vm.chatMajorId) ? _c('div', {
12600
+ staticClass: "links"
12601
+ }, [_c('a', {
12602
+ attrs: {
12603
+ "href": 'https://ai-yuliao.hep.com.cn' + item.documentUrl,
12604
+ "target": "_blank"
12605
+ }
12606
+ }, [_c('span', [_vm._v(_vm._s(item.title))])])]) : _vm._e()];
12607
+ })], 2)]) : _vm._e()]) : _vm._e(), list.type === 'robot' && list.connectUrl.length > 0 ? _c('div', {
12608
+ staticClass: "link"
12609
+ }, [_c('div', {
12610
+ staticClass: "link-title"
12611
+ }, [_vm._v("相关链接")]), _c('div', {
12612
+ staticClass: "link-content"
12613
+ }, [_vm._l(list.connectUrl, function (item) {
12614
+ return [_c('div', {
12615
+ staticClass: "links"
12616
+ }, [_c('a', {
12617
+ attrs: {
12618
+ "href": item.iaUrl,
12619
+ "target": "_blank"
12620
+ }
12621
+ }, [_c('span', [_vm._v(_vm._s(item.iaUrlName))])])])];
12622
+ })], 2)]) : _vm._e(), list.type === 'robot' && _vm.finish && list.followUps && list.followUps.length > 0 ? _c('div', [_c('div', {
12623
+ staticClass: "link-title"
12624
+ }, [_vm._v("智能追问")]), _c('div', {
12625
+ staticClass: "link-content"
12626
+ }, _vm._l(list.followUps, function (list, index) {
12627
+ return _c('div', {
12628
+ key: index,
12629
+ staticClass: "hot-list",
12630
+ on: {
12631
+ "click": function ($event) {
12632
+ return _vm.selectModule(list);
12633
+ }
12634
+ }
12635
+ }, [_vm._v(" " + _vm._s(list) + " "), _c('i', {
12636
+ staticClass: "el-icon-arrow-right go-icon"
12637
+ })]);
12638
+ }), 0)]) : _vm._e(), list.type === 'robot' ? _c('chat-tools', {
12639
+ attrs: {
12640
+ "chatId": _vm.chatId,
12641
+ "detail-data": list,
12642
+ "sending": list.sending,
12643
+ "resId": _vm.resId,
12644
+ "open-course-id": _vm.openCourseId,
12645
+ "is-last": index === _vm.messageData.length - 1
12646
+ },
12647
+ on: {
12648
+ "on-reanswer": list => _vm.reanswer(list, index),
12649
+ "on-stop-chat": _vm.onStopChat
12650
+ }
12651
+ }) : _vm._e()], 1)]);
12652
+ }), 0);
12653
+ };
12654
+ var chatvue_type_template_id_069a8301_scoped_true_staticRenderFns = [];
12655
+
12656
+ ;// CONCATENATED MODULE: ./components/demo/utils/config.js
12657
+
12658
+ // import constants from '../utils/constants';
12557
12659
 
12558
12660
  const errorList = [{
12559
12661
  name: "格式问题",
@@ -12581,25 +12683,31 @@ const cacheMessageList = [{
12581
12683
  type: 'robot',
12582
12684
  message: '电磁感应定律是描述磁场与电场之间关系的物理定律。具体来说,当导体回路中的磁通量发生变化时,会在回路中产生感应电动势。这个感应电动势的大小与磁通量变化的速率成正比,这就是法拉第电磁感应定律。\n' + ' 相关的公式是:ε = -dΦ/dt\n' + ' 其中,ε 表示感应电动势,Φ 表示磁通量,t 表示时间,dΦ/dt 则表示磁通量对时间的变化率。注意这里的负号,它表示感应电动势的方向与磁通量变化的方向相反,这是楞次定律的体现。\n' + ' 解释这个公式时,我们可以理解为:当穿过一个闭合导体回路的磁通量发生变化时,会在回路中产生感应电动势,其大小正比于磁通量变化的速率。这种感应电动势是由于磁场的变化而引发的,它是磁场变化对电场的直接影响,体现了磁场与电场之间的紧密联系。'
12583
12685
  }];
12686
+
12687
+ // export const getUserInfo = async (token) => {
12688
+ // const ssoRes = await ssoAuth(token);
12689
+ // const userRes = await authUser({
12690
+ // 'X-Auth-User': encodeURIComponent(ssoRes.name),
12691
+ // 'X-Auth-Token': ssoRes.password,
12692
+ // 'X-Enterprise-Id': `${constants['X-Enterprise-Id']}`,
12693
+ // 'X-App-Id': `${constants['X-App-Id']}`,
12694
+ // 'X-App-Secret': `${constants['X-App-Secret']}`,
12695
+ // 'X-Auth-User-Type': '1',
12696
+ // });
12697
+ // cache.session.setJSON('SRKJ_TOKEN_CACHE', userRes);
12698
+ // }
12699
+
12584
12700
  const getUserInfo = async token => {
12585
- const ssoRes = await ssoAuth(token);
12586
- const userRes = await authUser({
12587
- 'X-Auth-User': encodeURIComponent(ssoRes.name),
12588
- 'X-Auth-Token': ssoRes.password,
12589
- 'X-Enterprise-Id': `${constants['X-Enterprise-Id']}`,
12590
- 'X-App-Id': `${constants['X-App-Id']}`,
12591
- 'X-App-Secret': `${constants['X-App-Secret']}`,
12592
- 'X-Auth-User-Type': '1'
12593
- });
12594
- cache.session.setJSON('SRKJ_TOKEN_CACHE', userRes);
12701
+ await ssoAuth(token);
12702
+ cache.session.setJSON('SRKJ_TOKEN_CACHE', token);
12595
12703
  };
12596
- ;// CONCATENATED MODULE: ./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/demo/src/chat-tools.vue?vue&type=template&id=2c94312a&scoped=true
12597
- var chat_toolsvue_type_template_id_2c94312a_scoped_true_render = function render() {
12704
+ ;// CONCATENATED MODULE: ./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/demo/src/chat-tools.vue?vue&type=template&id=78eed5c6&scoped=true
12705
+ var chat_toolsvue_type_template_id_78eed5c6_scoped_true_render = function render() {
12598
12706
  var _vm = this,
12599
12707
  _c = _vm._self._c;
12600
12708
  return _c('div', {
12601
12709
  staticClass: "robot-tools"
12602
- }, [_vm.listData.stop || _vm.listData.finish ? _c('div', {
12710
+ }, [(_vm.listData.stop || _vm.listData.finish && !_vm.sending) && _vm.isLast ? _c('div', {
12603
12711
  staticClass: "robot-reanswer",
12604
12712
  staticStyle: {
12605
12713
  "margin-bottom": "8px"
@@ -12617,7 +12725,7 @@ var chat_toolsvue_type_template_id_2c94312a_scoped_true_render = function render
12617
12725
  "color": "#cfcfcf",
12618
12726
  "cursor": "default"
12619
12727
  }
12620
- }, [_vm._v("已停止生成")]) : _vm._e(), !_vm.listData.stop && !_vm.listData.finish ? _c('div', {
12728
+ }, [_vm._v("已停止生成")]) : _vm._e(), !_vm.listData.stop && !_vm.listData.finish && !_vm.sending ? _c('div', {
12621
12729
  staticClass: "stopMsg",
12622
12730
  on: {
12623
12731
  "click": function ($event) {
@@ -12755,9 +12863,9 @@ var chat_toolsvue_type_template_id_2c94312a_scoped_true_render = function render
12755
12863
  }
12756
12864
  }, [_vm._v("提交")])], 1)], 1)])])], 1)]);
12757
12865
  };
12758
- var chat_toolsvue_type_template_id_2c94312a_scoped_true_staticRenderFns = [];
12866
+ var chat_toolsvue_type_template_id_78eed5c6_scoped_true_staticRenderFns = [];
12759
12867
 
12760
- ;// CONCATENATED MODULE: ./components/demo/src/chat-tools.vue?vue&type=template&id=2c94312a&scoped=true
12868
+ ;// CONCATENATED MODULE: ./components/demo/src/chat-tools.vue?vue&type=template&id=78eed5c6&scoped=true
12761
12869
 
12762
12870
  ;// CONCATENATED MODULE: ./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/demo/src/chat-tools.vue?vue&type=script&lang=js
12763
12871
 
@@ -12772,6 +12880,22 @@ var chat_toolsvue_type_template_id_2c94312a_scoped_true_staticRenderFns = [];
12772
12880
  chatId: {
12773
12881
  type: String,
12774
12882
  default: ''
12883
+ },
12884
+ sending: {
12885
+ type: Boolean,
12886
+ default: false
12887
+ },
12888
+ resId: {
12889
+ type: String,
12890
+ default: ''
12891
+ },
12892
+ openCourseId: {
12893
+ type: String,
12894
+ default: ''
12895
+ },
12896
+ isLast: {
12897
+ type: Boolean,
12898
+ default: false
12775
12899
  }
12776
12900
  },
12777
12901
  data() {
@@ -12816,7 +12940,9 @@ var chat_toolsvue_type_template_id_2c94312a_scoped_true_staticRenderFns = [];
12816
12940
  await pustReanswerToTeacher({
12817
12941
  chatId: this.chatId,
12818
12942
  msgId: list.msgId,
12819
- parentMsgId: list.parentMsgId
12943
+ parentMsgId: list.parentMsgId,
12944
+ courseId: this.resId,
12945
+ openCourseId: this.openCourseId
12820
12946
  });
12821
12947
  this.$message.success('已发送给老师');
12822
12948
  }).catch(() => {});
@@ -12861,10 +12987,10 @@ var chat_toolsvue_type_template_id_2c94312a_scoped_true_staticRenderFns = [];
12861
12987
  });
12862
12988
  ;// CONCATENATED MODULE: ./components/demo/src/chat-tools.vue?vue&type=script&lang=js
12863
12989
  /* harmony default export */ var src_chat_toolsvue_type_script_lang_js = (chat_toolsvue_type_script_lang_js);
12864
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat-tools.vue?vue&type=style&index=0&id=2c94312a&prod&lang=scss&scoped=true
12990
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat-tools.vue?vue&type=style&index=0&id=78eed5c6&prod&lang=scss&scoped=true
12865
12991
  // extracted by mini-css-extract-plugin
12866
12992
 
12867
- ;// CONCATENATED MODULE: ./components/demo/src/chat-tools.vue?vue&type=style&index=0&id=2c94312a&prod&lang=scss&scoped=true
12993
+ ;// CONCATENATED MODULE: ./components/demo/src/chat-tools.vue?vue&type=style&index=0&id=78eed5c6&prod&lang=scss&scoped=true
12868
12994
 
12869
12995
  ;// CONCATENATED MODULE: ./components/demo/src/chat-tools.vue
12870
12996
 
@@ -12877,11 +13003,11 @@ var chat_toolsvue_type_template_id_2c94312a_scoped_true_staticRenderFns = [];
12877
13003
 
12878
13004
  var chat_tools_component = normalizeComponent(
12879
13005
  src_chat_toolsvue_type_script_lang_js,
12880
- chat_toolsvue_type_template_id_2c94312a_scoped_true_render,
12881
- chat_toolsvue_type_template_id_2c94312a_scoped_true_staticRenderFns,
13006
+ chat_toolsvue_type_template_id_78eed5c6_scoped_true_render,
13007
+ chat_toolsvue_type_template_id_78eed5c6_scoped_true_staticRenderFns,
12882
13008
  false,
12883
13009
  null,
12884
- "2c94312a",
13010
+ "78eed5c6",
12885
13011
  null
12886
13012
 
12887
13013
  )
@@ -12907,10 +13033,18 @@ const signal = controller.signal;
12907
13033
  type: String,
12908
13034
  default: ''
12909
13035
  },
13036
+ openCourseId: {
13037
+ type: String,
13038
+ default: ''
13039
+ },
12910
13040
  chatId: {
12911
13041
  type: String,
12912
13042
  default: ''
12913
13043
  },
13044
+ chatMajorId: {
13045
+ type: String,
13046
+ default: undefined
13047
+ },
12914
13048
  messageData: {
12915
13049
  type: Array,
12916
13050
  default: cacheMessageList
@@ -12922,6 +13056,7 @@ const signal = controller.signal;
12922
13056
  input: "",
12923
13057
  errors: [],
12924
13058
  errorList: errorList,
13059
+ finish: false,
12925
13060
  cacheKeyWord: '' // 由于外部需要快速清掉 keyword 但是存在重新发送请求的情况,因此需要一个混存记录
12926
13061
  };
12927
13062
  },
@@ -12953,7 +13088,9 @@ const signal = controller.signal;
12953
13088
  },
12954
13089
  async postMessage(list, commonKey, parentMsgId) {
12955
13090
  let reanswerParams = {};
13091
+ this.finish = false;
12956
13092
  if (list) {
13093
+ list.sending = true;
12957
13094
  reanswerParams = {
12958
13095
  reStatus: 1,
12959
13096
  parentMsgId: list.parentMsgId,
@@ -12961,6 +13098,7 @@ const signal = controller.signal;
12961
13098
  content: this.messageData[list.index - 1].message
12962
13099
  };
12963
13100
  this.messageData[list.index].message = '';
13101
+ this.makeAutoMessage();
12964
13102
  }
12965
13103
  const params = {
12966
13104
  messageList: [{
@@ -12974,25 +13112,42 @@ const signal = controller.signal;
12974
13112
  };
12975
13113
  // list 存在说明是重新生成
12976
13114
  if (!list && !commonKey) {
13115
+ const userWord = this.keyWord || this.cacheKeyWord;
12977
13116
  this.messageData.push({
12978
13117
  type: 'user',
12979
- message: this.keyWord.replace(/\n/g, '<br>')
13118
+ message: userWord.replace(/\n/g, '<br>')
13119
+ });
13120
+ setTimeout(() => {
13121
+ this.messageData.push({
13122
+ type: 'robot',
13123
+ message: '',
13124
+ zan: false,
13125
+ cai: false,
13126
+ stop: false,
13127
+ finish: false,
13128
+ sending: true,
13129
+ links: [],
13130
+ connectUrl: [],
13131
+ reAnswerCount: 0
13132
+ });
13133
+ this.makeAutoMessage();
12980
13134
  });
12981
- setTimeout(() => this.messageData.push({
12982
- type: 'robot',
12983
- message: '',
12984
- zan: false,
12985
- cai: false,
12986
- stop: false,
12987
- finish: false,
12988
- links: [],
12989
- reAnswerCount: 0
12990
- }));
12991
13135
  }
12992
13136
  await sendMessageEventSource(params, signal, res => {
12993
13137
  this.makeMessageLine(res, list);
12994
13138
  });
12995
13139
  },
13140
+ makeAutoMessage() {
13141
+ const cacheMessage = [];
13142
+ for (let i = 0; i < this.messageData.length; i++) {
13143
+ const current = this.messageData[i];
13144
+ cacheMessage.push({
13145
+ role: current.type === 'robot' ? 'assistant' : 'user',
13146
+ content: current.message || '正在思考中。'
13147
+ });
13148
+ }
13149
+ this.makeAutoQuestioning(cacheMessage);
13150
+ },
12996
13151
  makeMessageLine(res, list) {
12997
13152
  const {
12998
13153
  content,
@@ -13001,40 +13156,73 @@ const signal = controller.signal;
13001
13156
  msgId,
13002
13157
  parentMsgId,
13003
13158
  reference,
13004
- commonKey
13159
+ commonKey,
13160
+ connectUrl
13005
13161
  } = JSON.parse(res.data);
13006
13162
  let index = list ? list.index : this.messageData.length - 1;
13007
13163
  const currentList = this.messageData[index];
13164
+ let allIdWithStart = true;
13008
13165
  // 结束标识
13009
13166
  if (status === 2 || status === 1) {
13010
13167
  if (commonKey) {
13168
+ currentList.sending = true;
13011
13169
  this.postMessage(list, commonKey, parentMsgId);
13012
13170
  return;
13013
13171
  }
13014
13172
  currentList.finish = true;
13015
13173
  if (reference) {
13016
13174
  currentList.links = JSON.parse(reference);
13175
+ currentList.links.map(item => {
13176
+ if (!item.title.startsWith(this.chatMajorId)) {
13177
+ allIdWithStart = false;
13178
+ }
13179
+ });
13180
+ }
13181
+ if (connectUrl) {
13182
+ currentList.connectUrl = JSON.parse(connectUrl);
13017
13183
  }
13184
+ currentList.allIdWithStart = allIdWithStart;
13018
13185
  this.cacheKeyWord = '';
13186
+ this.finish = true;
13019
13187
  this.$emit('on-message-finish', chatId);
13020
13188
  return;
13021
13189
  }
13022
- currentList.message += content;
13190
+ currentList.message += content.replace(/\n/g, '<br>');
13023
13191
  currentList.msgId = msgId;
13024
13192
  currentList.parentMsgId = parentMsgId;
13025
13193
  currentList.chatId = chatId;
13026
13194
  setTimeout(() => {
13027
13195
  if (!list) this.scrollToBottom();
13028
13196
  }, 100);
13197
+ // 防止出现调用基础模型前导致停止回答id错误
13198
+ setTimeout(() => currentList.sending = false, 500);
13199
+ },
13200
+ async makeAutoQuestioning(messages) {
13201
+ // 首次不触发
13202
+ if (messages.length <= 2) return;
13203
+ const autoRes = await getAutoQuestioning(this.chatMajorId, messages);
13204
+ const {
13205
+ message: {
13206
+ content: {
13207
+ followUps
13208
+ }
13209
+ }
13210
+ } = autoRes;
13211
+ this.messageData[this.messageData.length - 1].followUps = followUps.length > 3 ? followUps.splice(0, 3) : followUps;
13029
13212
  },
13030
13213
  onStopChat(list) {
13031
13214
  this.$emit('on-message-finish', list.chatId);
13032
13215
  },
13216
+ selectModule(message) {
13217
+ this.cacheKeyWord = message;
13218
+ this.postMessage();
13219
+ },
13033
13220
  reanswer(list, index) {
13034
13221
  list.index = index;
13035
13222
  list.stop = false;
13036
13223
  list.finish = false;
13037
13224
  list.links = [];
13225
+ list.connectUrl = [];
13038
13226
  this.postMessage(list);
13039
13227
  this.$emit('on-reanser');
13040
13228
  }
@@ -13042,10 +13230,10 @@ const signal = controller.signal;
13042
13230
  });
13043
13231
  ;// CONCATENATED MODULE: ./components/demo/src/chat.vue?vue&type=script&lang=js
13044
13232
  /* harmony default export */ var src_chatvue_type_script_lang_js = (chatvue_type_script_lang_js);
13045
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat.vue?vue&type=style&index=0&id=80375d7a&prod&lang=scss&scoped=true
13233
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat.vue?vue&type=style&index=0&id=069a8301&prod&lang=scss&scoped=true
13046
13234
  // extracted by mini-css-extract-plugin
13047
13235
 
13048
- ;// CONCATENATED MODULE: ./components/demo/src/chat.vue?vue&type=style&index=0&id=80375d7a&prod&lang=scss&scoped=true
13236
+ ;// CONCATENATED MODULE: ./components/demo/src/chat.vue?vue&type=style&index=0&id=069a8301&prod&lang=scss&scoped=true
13049
13237
 
13050
13238
  ;// CONCATENATED MODULE: ./components/demo/src/chat.vue
13051
13239
 
@@ -13058,11 +13246,11 @@ const signal = controller.signal;
13058
13246
 
13059
13247
  var chat_component = normalizeComponent(
13060
13248
  src_chatvue_type_script_lang_js,
13061
- chatvue_type_template_id_80375d7a_scoped_true_render,
13062
- chatvue_type_template_id_80375d7a_scoped_true_staticRenderFns,
13249
+ chatvue_type_template_id_069a8301_scoped_true_render,
13250
+ chatvue_type_template_id_069a8301_scoped_true_staticRenderFns,
13063
13251
  false,
13064
13252
  null,
13065
- "80375d7a",
13253
+ "069a8301",
13066
13254
  null
13067
13255
 
13068
13256
  )
@@ -13221,6 +13409,10 @@ var api = init(defaultConverter, { path: '/' });
13221
13409
  resId: {
13222
13410
  type: String,
13223
13411
  default: ''
13412
+ },
13413
+ openCourseId: {
13414
+ type: String,
13415
+ default: ''
13224
13416
  }
13225
13417
  },
13226
13418
  watch: {
@@ -13250,7 +13442,8 @@ var api = init(defaultConverter, { path: '/' });
13250
13442
  messageList: [],
13251
13443
  chatId: undefined,
13252
13444
  // 对话id
13253
- stop: false
13445
+ stop: false,
13446
+ chatMajorId: ''
13254
13447
  };
13255
13448
  },
13256
13449
  mounted() {
@@ -13262,10 +13455,15 @@ var api = init(defaultConverter, { path: '/' });
13262
13455
  },
13263
13456
  methods: {
13264
13457
  closeMessage() {
13458
+ if (!this.stopMessage()) {
13459
+ return;
13460
+ }
13265
13461
  this.$emit('close');
13266
13462
  },
13267
- selectModule() {
13463
+ selectModule(hotKey) {
13268
13464
  this.chatShow = true;
13465
+ this.aiMessage = hotKey;
13466
+ this.goChat({});
13269
13467
  },
13270
13468
  showHot() {
13271
13469
  this.chatShow = false;
@@ -13275,8 +13473,20 @@ var api = init(defaultConverter, { path: '/' });
13275
13473
  const listRes = await getDetailList(this.resId);
13276
13474
  if (!listRes || listRes.length < 1) return;
13277
13475
  let currentList = listRes[0].contents.reverse();
13476
+ const {
13477
+ chatMajorId
13478
+ } = listRes[0];
13479
+ this.chatMajorId = chatMajorId && chatMajorId.toString();
13278
13480
  const cacheArray = [];
13279
13481
  currentList.map(list => {
13482
+ let allIdWithStart = true;
13483
+ if (this.chatMajorId && list.references) {
13484
+ list.references.map(item => {
13485
+ if (!item.title.startsWith(this.chatMajorId)) {
13486
+ allIdWithStart = false;
13487
+ }
13488
+ });
13489
+ }
13280
13490
  const obj = {
13281
13491
  type: list.role === 'assistant' ? 'robot' : 'user',
13282
13492
  message: list.content.replace(/\n/g, '<br>'),
@@ -13285,9 +13495,11 @@ var api = init(defaultConverter, { path: '/' });
13285
13495
  stop: list.status === 1,
13286
13496
  finish: true,
13287
13497
  links: list.references || [],
13498
+ connectUrl: list.connectUrls || [],
13288
13499
  reAnswerCount: 0,
13289
13500
  msgId: list.contentId,
13290
- parentMsgId: list.parentMsgId
13501
+ parentMsgId: list.parentMsgId,
13502
+ allIdWithStart
13291
13503
  };
13292
13504
  cacheArray.push(obj);
13293
13505
  });
@@ -13329,6 +13541,14 @@ var api = init(defaultConverter, { path: '/' });
13329
13541
  if (!this.stopMessage()) {
13330
13542
  return;
13331
13543
  }
13544
+ if (this.aiMessage.length > 6000) {
13545
+ this.$message.warning('文字长度不能超过3000字');
13546
+ return;
13547
+ }
13548
+ if (!this.aiMessage.trim()) {
13549
+ this.$message.error('输入内容为空');
13550
+ return;
13551
+ }
13332
13552
  this.aiMessageKeyWord = this.aiMessage;
13333
13553
  this.chatShow = true;
13334
13554
  this.stop = true;
@@ -13358,10 +13578,10 @@ var api = init(defaultConverter, { path: '/' });
13358
13578
  });
13359
13579
  ;// CONCATENATED MODULE: ./components/demo/src/main.vue?vue&type=script&lang=js
13360
13580
  /* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
13361
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/main.vue?vue&type=style&index=0&id=69b9f6b0&prod&lang=scss&scoped=true
13581
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/main.vue?vue&type=style&index=0&id=77093a83&prod&lang=scss&scoped=true
13362
13582
  // extracted by mini-css-extract-plugin
13363
13583
 
13364
- ;// CONCATENATED MODULE: ./components/demo/src/main.vue?vue&type=style&index=0&id=69b9f6b0&prod&lang=scss&scoped=true
13584
+ ;// CONCATENATED MODULE: ./components/demo/src/main.vue?vue&type=style&index=0&id=77093a83&prod&lang=scss&scoped=true
13365
13585
 
13366
13586
  ;// CONCATENATED MODULE: ./components/demo/src/main.vue
13367
13587
 
@@ -13378,7 +13598,7 @@ var main_component = normalizeComponent(
13378
13598
  staticRenderFns,
13379
13599
  false,
13380
13600
  null,
13381
- "69b9f6b0",
13601
+ "77093a83",
13382
13602
  null
13383
13603
 
13384
13604
  )