byt-lingxiao-ai 0.3.4 → 0.3.6

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.
@@ -28450,7 +28450,7 @@ if (typeof window !== 'undefined') {
28450
28450
  var es_iterator_constructor = __webpack_require__(8111);
28451
28451
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
28452
28452
  var es_iterator_for_each = __webpack_require__(7588);
28453
- ;// ./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=382b928f&scoped=true
28453
+ ;// ./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=244aa1c1&scoped=true
28454
28454
  var render = function render() {
28455
28455
  var _vm = this,
28456
28456
  _c = _vm._self._c;
@@ -28484,7 +28484,8 @@ var render = function render() {
28484
28484
  attrs: {
28485
28485
  "messages": _vm.messages,
28486
28486
  "input-message": _vm.inputMessage,
28487
- "think-status": _vm.thinkStatus
28487
+ "think-status": _vm.thinkStatus,
28488
+ "chat-id": _vm.chatId
28488
28489
  },
28489
28490
  on: {
28490
28491
  "update:inputMessage": function ($event) {
@@ -28741,8 +28742,8 @@ var ChatAvatar_component = normalizeComponent(
28741
28742
  )
28742
28743
 
28743
28744
  /* harmony default export */ var ChatAvatar = (ChatAvatar_component.exports);
28744
- ;// ./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=1424b8b1&scoped=true
28745
- var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render = function render() {
28745
+ ;// ./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=23a76780&scoped=true
28746
+ var ChatWindowDialogvue_type_template_id_23a76780_scoped_true_render = function render() {
28746
28747
  var _vm = this,
28747
28748
  _c = _vm._self._c;
28748
28749
  return _c('div', {
@@ -28766,6 +28767,9 @@ var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render = function
28766
28767
  }
28767
28768
  }
28768
28769
  }, [_c('ChatWindowHeader', {
28770
+ attrs: {
28771
+ "chat-id": _vm.chatId
28772
+ },
28769
28773
  on: {
28770
28774
  "close": function ($event) {
28771
28775
  return _vm.$emit('input', false);
@@ -28797,10 +28801,10 @@ var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render = function
28797
28801
  }
28798
28802
  })], 1)]);
28799
28803
  };
28800
- var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_staticRenderFns = [];
28804
+ var ChatWindowDialogvue_type_template_id_23a76780_scoped_true_staticRenderFns = [];
28801
28805
 
28802
- ;// ./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=428ec56e&scoped=true
28803
- var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_render = function render() {
28806
+ ;// ./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=90d9b166&scoped=true
28807
+ var ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_render = function render() {
28804
28808
  var _vm = this,
28805
28809
  _c = _vm._self._c;
28806
28810
  return _c('div', {
@@ -28885,26 +28889,30 @@ var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_render = function
28885
28889
  }
28886
28890
  })])])]);
28887
28891
  };
28888
- var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_staticRenderFns = [];
28892
+ var ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_staticRenderFns = [];
28889
28893
 
28890
28894
  ;// ./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
28891
28895
  /* harmony default export */ var ChatWindowHeadervue_type_script_lang_js = ({
28892
28896
  name: 'ChatWindowHeader',
28897
+ props: {
28898
+ chatId: {
28899
+ type: String,
28900
+ default: ''
28901
+ }
28902
+ },
28893
28903
  methods: {
28894
28904
  handleOpen() {
28895
- // const chatId = ''
28896
- // const baseUrl = window.location.protocol + '//' + window.location.hostname + ':3100/c/' + chatId;
28897
- const baseUrl = window.location.protocol + '//' + window.location.hostname + ':3100/';
28905
+ const baseUrl = window.location.protocol + '//' + window.location.hostname + ':3100/c/' + this.chatId;
28898
28906
  window.open(baseUrl, '_blank');
28899
28907
  }
28900
28908
  }
28901
28909
  });
28902
28910
  ;// ./components/ChatWindowHeader.vue?vue&type=script&lang=js
28903
28911
  /* harmony default export */ var components_ChatWindowHeadervue_type_script_lang_js = (ChatWindowHeadervue_type_script_lang_js);
28904
- ;// ./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=428ec56e&prod&scoped=true&lang=css
28912
+ ;// ./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=90d9b166&prod&scoped=true&lang=css
28905
28913
  // extracted by mini-css-extract-plugin
28906
28914
 
28907
- ;// ./components/ChatWindowHeader.vue?vue&type=style&index=0&id=428ec56e&prod&scoped=true&lang=css
28915
+ ;// ./components/ChatWindowHeader.vue?vue&type=style&index=0&id=90d9b166&prod&scoped=true&lang=css
28908
28916
 
28909
28917
  ;// ./components/ChatWindowHeader.vue
28910
28918
 
@@ -28917,11 +28925,11 @@ var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_staticRenderFns =
28917
28925
 
28918
28926
  var ChatWindowHeader_component = normalizeComponent(
28919
28927
  components_ChatWindowHeadervue_type_script_lang_js,
28920
- ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_render,
28921
- ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_staticRenderFns,
28928
+ ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_render,
28929
+ ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_staticRenderFns,
28922
28930
  false,
28923
28931
  null,
28924
- "428ec56e",
28932
+ "90d9b166",
28925
28933
  null
28926
28934
 
28927
28935
  )
@@ -29009,8 +29017,8 @@ var UserMessage_component = normalizeComponent(
29009
29017
  )
29010
29018
 
29011
29019
  /* harmony default export */ var UserMessage = (UserMessage_component.exports);
29012
- ;// ./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=5ac07584&scoped=true
29013
- var AiMessagevue_type_template_id_5ac07584_scoped_true_render = function render() {
29020
+ ;// ./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=6cbccb01&scoped=true
29021
+ var AiMessagevue_type_template_id_6cbccb01_scoped_true_render = function render() {
29014
29022
  var _vm = this,
29015
29023
  _c = _vm._self._c;
29016
29024
  return _c('div', {
@@ -29043,10 +29051,8 @@ var AiMessagevue_type_template_id_5ac07584_scoped_true_render = function render(
29043
29051
  }
29044
29052
  })])]);
29045
29053
  };
29046
- var AiMessagevue_type_template_id_5ac07584_scoped_true_staticRenderFns = [];
29054
+ var AiMessagevue_type_template_id_6cbccb01_scoped_true_staticRenderFns = [];
29047
29055
 
29048
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
29049
- var es_iterator_filter = __webpack_require__(2489);
29050
29056
  ;// ./node_modules/@babel/runtime/helpers/esm/typeof.js
29051
29057
  function _typeof(o) {
29052
29058
  "@babel/helpers - typeof";
@@ -29090,6 +29096,8 @@ function _defineProperty(e, r, t) {
29090
29096
  }) : e[r] = t, e;
29091
29097
  }
29092
29098
 
29099
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
29100
+ var es_iterator_filter = __webpack_require__(2489);
29093
29101
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
29094
29102
  var es_iterator_map = __webpack_require__(1701);
29095
29103
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
@@ -30819,10 +30827,6 @@ var lib = __webpack_require__(2750);
30819
30827
 
30820
30828
 
30821
30829
 
30822
-
30823
-
30824
-
30825
-
30826
30830
  d.setOptions({
30827
30831
  highlight: function (code, lang) {
30828
30832
  if (lang && es.getLanguage(lang)) {
@@ -30835,115 +30839,6 @@ d.setOptions({
30835
30839
  breaks: true,
30836
30840
  gfm: true
30837
30841
  });
30838
- function parseMarkdown(text) {
30839
- if (!text) return '';
30840
- let html = text;
30841
- html = html.replace(/```(\w+)?\n([\s\S]*?)```/g, (match, lang, code) => {
30842
- return `<pre><code class="language-${lang || 'text'}">${escapeHtml(code.trim())}</code></pre>`;
30843
- });
30844
- html = html.replace(/`([^`]+)`/g, '<code>$1</code>');
30845
- html = parseTable(html);
30846
- html = html.replace(/^#### (.*$)/gm, '<h4>$1</h4>');
30847
- html = html.replace(/^### (.*$)/gm, '<h3>$1</h3>');
30848
- html = html.replace(/^## (.*$)/gm, '<h2>$1</h2>');
30849
- html = html.replace(/^# (.*$)/gm, '<h1>$1</h1>');
30850
- html = html.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
30851
- html = html.replace(/\*(.*?)\*/g, '<em>$1</em>');
30852
- html = html.replace(/~~(.*?)~~/g, '<del>$1</del>');
30853
- html = html.replace(/^\s*[-*+]\s+(.+)$/gm, '<li>$1</li>');
30854
- html = html.replace(/(<li>.*?<\/li>)/gs, '<ul>$1</ul>');
30855
- html = html.replace(/^\s*\d+\.\s+(.+)$/gm, '<li>$1</li>');
30856
- html = html.replace(/^>\s+(.+)$/gm, '<blockquote>$1</blockquote>');
30857
- // 解析Markdown链接
30858
- html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>');
30859
- html = html.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" />');
30860
- html = html.replace(/^-{3,}$/gm, '<hr>');
30861
- // 解析简单URL
30862
- // const simpleUrlRegex = /(https?:\/\/[^\s<>"']+)/g;
30863
- // html = html.replace(simpleUrlRegex, (match) => {
30864
- // return `<a href="${match}" aria-current="page">${match}</a>`;
30865
- // });
30866
-
30867
- // html = html.replace(/\n/g, '<br>');
30868
-
30869
- return html;
30870
- }
30871
- // 解析表格
30872
- function parseTable(text) {
30873
- const lines = text.split('\n');
30874
- let result = [];
30875
- let inTable = false;
30876
- let tableRows = [];
30877
- for (let i = 0; i < lines.length; i++) {
30878
- const line = lines[i].trim();
30879
-
30880
- // 检测表格行
30881
- if (line.includes('|') && line.split('|').length >= 3) {
30882
- if (!inTable) {
30883
- inTable = true;
30884
- tableRows = [];
30885
- }
30886
- tableRows.push(line);
30887
-
30888
- // 检查下一行是否还是表格
30889
- if (i === lines.length - 1 || !lines[i + 1].includes('|')) {
30890
- // 表格结束
30891
- result.push(renderTable(tableRows));
30892
- inTable = false;
30893
- tableRows = [];
30894
- }
30895
- } else {
30896
- if (inTable) {
30897
- // 表格意外结束
30898
- result.push(renderTable(tableRows));
30899
- inTable = false;
30900
- tableRows = [];
30901
- }
30902
- result.push(line);
30903
- }
30904
- }
30905
- return result.join('\n');
30906
- }
30907
- // 渲染表格
30908
- function renderTable(rows) {
30909
- if (rows.length < 2) return rows.join('\n');
30910
- let html = '<div class="table-wrapper"><table class="markdown-table">';
30911
-
30912
- // 表头
30913
- const headerCells = rows[0].split('|').filter(cell => cell.trim());
30914
- html += '<thead><tr>';
30915
- headerCells.forEach(cell => {
30916
- html += `<th>${cell.trim()}</th>`;
30917
- });
30918
- html += '</tr></thead>';
30919
-
30920
- // 表体(跳过分隔行)
30921
- html += '<tbody>';
30922
- for (let i = 2; i < rows.length; i++) {
30923
- const cells = rows[i].split('|').filter(cell => cell.trim());
30924
- if (cells.length > 0) {
30925
- html += '<tr>';
30926
- cells.forEach(cell => {
30927
- html += `<td><div class="table-cell">${cell.trim()}</div></td>`;
30928
- });
30929
- html += '</tr>';
30930
- }
30931
- }
30932
- html += '</tbody>';
30933
- html += '</table></div>';
30934
- return html;
30935
- }
30936
- // HTML 转义
30937
- function escapeHtml(text) {
30938
- const map = {
30939
- '&': '&amp;',
30940
- '<': '&lt;',
30941
- '>': '&gt;',
30942
- '"': '&quot;',
30943
- "'": '&#039;'
30944
- };
30945
- return text.replace(/[&<>"']/g, m => map[m]);
30946
- }
30947
30842
  /* harmony default export */ var AiMessagevue_type_script_lang_js = ({
30948
30843
  name: 'AiMessage',
30949
30844
  props: {
@@ -30957,7 +30852,7 @@ function escapeHtml(text) {
30957
30852
  return this.message.thinkingExpanded !== false;
30958
30853
  },
30959
30854
  renderedContent() {
30960
- return parseMarkdown(this.message.content);
30855
+ return d.parse(this.message.content || '');
30961
30856
  },
30962
30857
  isLoading() {
30963
30858
  return this.message.loading === true;
@@ -30971,10 +30866,10 @@ function escapeHtml(text) {
30971
30866
  });
30972
30867
  ;// ./components/AiMessage.vue?vue&type=script&lang=js
30973
30868
  /* harmony default export */ var components_AiMessagevue_type_script_lang_js = (AiMessagevue_type_script_lang_js);
30974
- ;// ./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=5ac07584&prod&scoped=true&lang=css
30869
+ ;// ./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=6cbccb01&prod&scoped=true&lang=css
30975
30870
  // extracted by mini-css-extract-plugin
30976
30871
 
30977
- ;// ./components/AiMessage.vue?vue&type=style&index=0&id=5ac07584&prod&scoped=true&lang=css
30872
+ ;// ./components/AiMessage.vue?vue&type=style&index=0&id=6cbccb01&prod&scoped=true&lang=css
30978
30873
 
30979
30874
  ;// ./components/AiMessage.vue
30980
30875
 
@@ -30987,11 +30882,11 @@ function escapeHtml(text) {
30987
30882
 
30988
30883
  var AiMessage_component = normalizeComponent(
30989
30884
  components_AiMessagevue_type_script_lang_js,
30990
- AiMessagevue_type_template_id_5ac07584_scoped_true_render,
30991
- AiMessagevue_type_template_id_5ac07584_scoped_true_staticRenderFns,
30885
+ AiMessagevue_type_template_id_6cbccb01_scoped_true_render,
30886
+ AiMessagevue_type_template_id_6cbccb01_scoped_true_staticRenderFns,
30992
30887
  false,
30993
30888
  null,
30994
- "5ac07584",
30889
+ "6cbccb01",
30995
30890
  null
30996
30891
 
30997
30892
  )
@@ -31233,15 +31128,19 @@ var ChatInputBox_component = normalizeComponent(
31233
31128
  loading: {
31234
31129
  type: Boolean,
31235
31130
  default: false
31131
+ },
31132
+ chatId: {
31133
+ type: String,
31134
+ default: ''
31236
31135
  }
31237
31136
  }
31238
31137
  });
31239
31138
  ;// ./components/ChatWindowDialog.vue?vue&type=script&lang=js
31240
31139
  /* harmony default export */ var components_ChatWindowDialogvue_type_script_lang_js = (ChatWindowDialogvue_type_script_lang_js);
31241
- ;// ./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=1424b8b1&prod&scoped=true&lang=css
31140
+ ;// ./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=23a76780&prod&scoped=true&lang=css
31242
31141
  // extracted by mini-css-extract-plugin
31243
31142
 
31244
- ;// ./components/ChatWindowDialog.vue?vue&type=style&index=0&id=1424b8b1&prod&scoped=true&lang=css
31143
+ ;// ./components/ChatWindowDialog.vue?vue&type=style&index=0&id=23a76780&prod&scoped=true&lang=css
31245
31144
 
31246
31145
  ;// ./components/ChatWindowDialog.vue
31247
31146
 
@@ -31254,11 +31153,11 @@ var ChatInputBox_component = normalizeComponent(
31254
31153
 
31255
31154
  var ChatWindowDialog_component = normalizeComponent(
31256
31155
  components_ChatWindowDialogvue_type_script_lang_js,
31257
- ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render,
31258
- ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_staticRenderFns,
31156
+ ChatWindowDialogvue_type_template_id_23a76780_scoped_true_render,
31157
+ ChatWindowDialogvue_type_template_id_23a76780_scoped_true_staticRenderFns,
31259
31158
  false,
31260
31159
  null,
31261
- "1424b8b1",
31160
+ "23a76780",
31262
31161
  null
31263
31162
 
31264
31163
  )
@@ -31297,8 +31196,9 @@ var es_typed_array_with = __webpack_require__(9577);
31297
31196
  audio: {
31298
31197
  sampleRate: this.SAMPLE_RATE,
31299
31198
  channelCount: 1,
31300
- noiseSuppression: true,
31301
- echoCancellation: true
31199
+ noiseSuppression: false,
31200
+ echoCancellation: false,
31201
+ autoGainControl: false
31302
31202
  }
31303
31203
  });
31304
31204
  this.audioContext = new AudioContext({
@@ -31358,6 +31258,7 @@ var es_typed_array_with = __webpack_require__(9577);
31358
31258
  this.$refs.audioPlayer.play();
31359
31259
  },
31360
31260
  pause() {
31261
+ console.log('暂停播放');
31361
31262
  this.robotStatus = 'waiting';
31362
31263
  this.$refs.audioPlayer.pause();
31363
31264
  },
@@ -31383,17 +31284,21 @@ var es_typed_array_with = __webpack_require__(9577);
31383
31284
  this.pause();
31384
31285
  } else if (command === 'C6') {
31385
31286
  this.robotStatus = 'leaving';
31287
+ this.avaterStatus = 'normal';
31386
31288
  this.stop();
31387
31289
  }
31388
31290
  }
31389
31291
  }
31390
31292
  });
31391
31293
  ;// ./components/config/index.js
31392
- const baseUrl = window.location.protocol + '//' + window.location.hostname;
31294
+ const protocol = window.location.protocol;
31295
+ const host = window.location.hostname;
31296
+ const baseUrl = `${protocol}//${host}`;
31393
31297
  const chatPort = '3100';
31298
+ const voicePort = '3101';
31394
31299
  console.log(baseUrl, chatPort);
31395
- const API_URL = 'http://192.168.8.87:3100/lingxiao-byt/api/v1/mcp/ask';
31396
- const WS_URL = 'ws://192.168.8.9:9999/ai_model/ws/voice-stream';
31300
+ const API_URL = `${baseUrl}:${chatPort}/lingxiao-byt/api/v1/mcp/ask`;
31301
+ const WS_URL = `ws://${host}:${voicePort}/ai_model/ws/voice-stream`;
31397
31302
  const AUDIO_URL = '/minio/lingxiaoai/byt.mp3';
31398
31303
  const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json';
31399
31304
  ;// ./components/mixins/webSocketMixin.js
@@ -31469,15 +31374,32 @@ const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json';
31469
31374
  handleWebSocketMessage(data) {
31470
31375
  if (data.type === 'detection') {
31471
31376
  console.log('检测到唤醒词');
31377
+ console.log('当前状态:', this.avaterStatus);
31378
+ if (this.robotStatus === 'speaking') {
31379
+ this.robotStatus = 'waiting';
31380
+ }
31472
31381
  this.avaterStatus = 'normal';
31382
+
31383
+ // 性能检测起点
31384
+ this.startTime = Date.now(); // <-- 新增计时器
31385
+ console.log(`[Timer] 指令发送开始计时: ${this.startTime}ms`);
31473
31386
  } else if (data.type === 'Collecting') {
31474
31387
  console.log('状态: 采集中');
31475
31388
  this.avaterStatus = 'thinking';
31476
31389
  } else if (data.type === 'command') {
31477
31390
  console.log('状态: 处理中');
31391
+
31392
+ // 性能检测终点
31393
+ if (this.startTime) {
31394
+ const latency = Date.now() - this.startTime;
31395
+ console.log(`[Latency] 完整命令处理耗时: ${latency}ms`); // 记录端到端延迟
31396
+ this.startTime = null;
31397
+ }
31478
31398
  this.analyzeAudioCommand(data.category);
31479
31399
  } else {
31480
31400
  console.log('状态: 其他');
31401
+ this.avaterStatus = 'normal';
31402
+ this.robotStatus = 'leaving';
31481
31403
  }
31482
31404
  },
31483
31405
  closeWebSocket() {
@@ -31489,214 +31411,99 @@ const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json';
31489
31411
  });
31490
31412
  ;// ./components/utils/StreamParser.js
31491
31413
 
31492
-
31493
31414
  class StreamParser {
31494
31415
  constructor(options = {}) {
31495
31416
  this.options = {
31496
31417
  updateInterval: 16,
31497
- // 更新间隔(ms),默认约60fps
31498
- batchSize: 100,
31499
- // 批处理大小
31418
+ // 每16ms刷新一次(约60fps
31500
31419
  debug: false,
31501
- // 是否开启调试
31502
31420
  ...options
31503
31421
  };
31504
31422
  this.reset();
31505
31423
  }
31506
31424
 
31507
- /**
31508
- * 重置解析器状态
31509
- */
31425
+ // 重置解析器状态
31510
31426
  reset() {
31511
31427
  this.buffer = '';
31512
- this.contentBuffer = []; // 使用数组缓冲,避免频繁字符串拼接
31428
+ this.contentBuffer = [];
31513
31429
  this.thinkingBuffer = [];
31514
31430
  this.inTag = false;
31515
31431
  this.tagBuffer = '';
31516
31432
  this.updateTimer = null;
31517
31433
  this.status = 'output'; // thinking | output
31518
- this.metrics = {
31519
- startTime: Date.now(),
31520
- chunks: 0,
31521
- events: 0,
31522
- chars: 0
31523
- };
31524
31434
  }
31525
31435
 
31526
- /**
31527
- * 处理流数据块
31528
- * @param {string} chunk - 接收到的数据块
31529
- * @param {Function} callback - 更新回调函数
31530
- */
31436
+ // 处理接收到的流数据块
31531
31437
  processChunk(chunk, callback) {
31532
- this.metrics.chunks++;
31533
- this.buffer += chunk;
31534
- if (this.options.debug) {
31535
- console.log('[StreamParser] 收到chunk:', chunk.substring(0, 100));
31536
- }
31537
-
31538
- // 尝试解析为 SSE 格式
31539
- if (this.buffer.includes('data:')) {
31540
- this.processSSEFormat(callback);
31541
- } else {
31542
- // 直接处理纯文本流
31543
- this.processPlainText(callback);
31544
- }
31438
+ if (!chunk) return;
31439
+ this.parseContent(chunk, callback);
31545
31440
  }
31546
31441
 
31547
- /**
31548
- * 处理标准 SSE 格式
31549
- */
31550
- processSSEFormat(callback) {
31551
- // SSE 格式:事件由双换行符分隔
31552
- const events = this.buffer.split('\n\n');
31553
-
31554
- // 保留最后一个可能不完整的事件
31555
- this.buffer = events.pop() || '';
31556
-
31557
- // 处理完整的事件
31558
- for (const event of events) {
31559
- if (event.trim()) {
31560
- this.metrics.events++;
31561
- this.processSSEEvent(event, callback);
31562
- }
31563
- }
31564
- }
31565
-
31566
- /**
31567
- * 处理纯文本流格式
31568
- */
31569
- processPlainText(callback) {
31570
- const content = this.buffer;
31571
- this.buffer = ''; // 清空缓冲区
31572
-
31573
- if (content) {
31574
- this.metrics.chars += content.length;
31575
- if (this.options.debug) {
31576
- console.log('[StreamParser] 处理纯文本:', content);
31577
- }
31578
- this.parseContent(content, callback);
31579
- }
31580
- }
31581
-
31582
- /**
31583
- * 处理单个SSE事件
31584
- */
31585
- processSSEEvent(eventStr, callback) {
31586
- const lines = eventStr.split('\n');
31587
- for (const line of lines) {
31588
- // 解析 data: 行
31589
- if (line.startsWith('data:')) {
31590
- const data = line.substring(5).trim();
31591
- if (data === '[DONE]') {
31592
- this.flush(callback);
31593
- return;
31594
- }
31595
- try {
31596
- const parsed = JSON.parse(data);
31597
- const content = parsed?.choices?.[0]?.delta?.content;
31598
- if (content) {
31599
- this.metrics.chars += content.length;
31600
- if (this.options.debug) {
31601
- console.log('[StreamParser] 解析SSE内容:', content);
31602
- }
31603
- this.parseContent(content, callback);
31604
- }
31605
- } catch (error) {
31606
- if (this.options.debug) {
31607
- console.warn('[StreamParser] JSON解析失败:', data, error);
31608
- }
31609
- }
31610
- }
31611
- }
31612
- }
31613
-
31614
- /**
31615
- * 使用状态机解析内容和标签
31616
- */
31442
+ // 核心内容解析,支持 <think> 标签
31617
31443
  parseContent(content, callback) {
31618
31444
  let i = 0;
31619
31445
  while (i < content.length) {
31620
31446
  if (this.inTag) {
31621
- // 在标签内部,查找标签结束
31622
31447
  const endIndex = content.indexOf('>', i);
31623
31448
  if (endIndex !== -1) {
31624
- // 找到标签结束
31625
31449
  this.tagBuffer += content.substring(i, endIndex + 1);
31626
31450
  this.handleTag(this.tagBuffer);
31627
31451
  this.tagBuffer = '';
31628
31452
  this.inTag = false;
31629
31453
  i = endIndex + 1;
31630
31454
  } else {
31631
- // 标签未结束,缓存剩余部分
31455
+ // 标签未闭合,超过50字符强制输出,防止阻塞
31632
31456
  this.tagBuffer += content.substring(i);
31457
+ if (this.tagBuffer.length > 50) {
31458
+ this.appendText(this.tagBuffer);
31459
+ this.tagBuffer = '';
31460
+ this.inTag = false;
31461
+ }
31633
31462
  break;
31634
31463
  }
31635
31464
  } else {
31636
- // 不在标签内,查找标签开始
31637
31465
  const startIndex = content.indexOf('<', i);
31638
31466
  if (startIndex !== -1) {
31639
- // 找到标签开始,先处理前面的文本
31640
- if (startIndex > i) {
31641
- this.appendText(content.substring(i, startIndex));
31642
- }
31643
-
31644
- // 检查是否是完整标签
31467
+ if (startIndex > i) this.appendText(content.substring(i, startIndex));
31645
31468
  const endIndex = content.indexOf('>', startIndex);
31646
31469
  if (endIndex !== -1) {
31647
- // 完整标签
31648
31470
  const tag = content.substring(startIndex, endIndex + 1);
31649
31471
  this.handleTag(tag);
31650
31472
  i = endIndex + 1;
31651
31473
  } else {
31652
- // 不完整标签,标记进入标签状态
31653
- this.inTag = true;
31654
- this.tagBuffer = content.substring(startIndex);
31655
- break;
31474
+ const nextChar = content[startIndex + 1];
31475
+ if (!/[a-zA-Z/]/.test(nextChar)) {
31476
+ // 很可能不是标签,直接当文本输出
31477
+ this.appendText('<');
31478
+ i = startIndex + 1;
31479
+ } else {
31480
+ this.inTag = true;
31481
+ this.tagBuffer = content.substring(startIndex);
31482
+ break;
31483
+ }
31656
31484
  }
31657
31485
  } else {
31658
- // 没有标签,全部是文本
31659
31486
  this.appendText(content.substring(i));
31660
31487
  break;
31661
31488
  }
31662
31489
  }
31663
31490
  }
31664
-
31665
- // 定时批量更新
31666
31491
  this.scheduleUpdate(callback);
31667
31492
  }
31668
31493
 
31669
- /**
31670
- * 处理标签
31671
- */
31494
+ // 处理标签
31672
31495
  handleTag(tag) {
31673
- const tagName = tag.toLowerCase();
31674
- if (this.options.debug) {
31675
- console.log('[StreamParser] 处理标签:', tag);
31676
- }
31677
- if (tagName === '<think>') {
31678
- this.status = 'thinking';
31679
- } else if (tagName === '</think>') {
31680
- this.status = 'output';
31681
- }
31682
- // 可扩展:支持更多标签类型
31496
+ const t = tag.toLowerCase();
31497
+ if (t === '<think>') this.status = 'thinking';else if (t === '</think>') this.status = 'output';
31683
31498
  }
31684
31499
 
31685
- /**
31686
- * 添加文本到缓冲区
31687
- */
31500
+ // 添加文本到缓冲区
31688
31501
  appendText(text) {
31689
31502
  if (!text) return;
31690
- if (this.status === 'thinking') {
31691
- this.thinkingBuffer.push(text);
31692
- } else {
31693
- this.contentBuffer.push(text);
31694
- }
31503
+ if (this.status === 'thinking') this.thinkingBuffer.push(text);else this.contentBuffer.push(text);
31695
31504
  }
31696
31505
 
31697
- /**
31698
- * 计划更新(防抖)
31699
- */
31506
+ // 防抖刷新
31700
31507
  scheduleUpdate(callback) {
31701
31508
  if (this.updateTimer) return;
31702
31509
  this.updateTimer = setTimeout(() => {
@@ -31705,81 +31512,59 @@ class StreamParser {
31705
31512
  }, this.options.updateInterval);
31706
31513
  }
31707
31514
 
31708
- /**
31709
- * 立即刷新缓冲区
31710
- */
31515
+ // 刷新缓冲区
31711
31516
  flush(callback) {
31712
- if (!callback) {
31713
- console.warn('[StreamParser] flush: callback 为空');
31714
- return;
31715
- }
31716
- const hasThinking = this.thinkingBuffer.length > 0;
31717
- const hasContent = this.contentBuffer.length > 0;
31718
- if (!hasThinking && !hasContent) return;
31719
-
31720
- // 使用 join 比字符串拼接性能更好
31517
+ if (!callback) return;
31721
31518
  const result = {
31722
- thinking: hasThinking ? this.thinkingBuffer.join('') : null,
31723
- content: hasContent ? this.contentBuffer.join('') : null,
31519
+ thinking: this.thinkingBuffer.length ? this.thinkingBuffer.join('') : null,
31520
+ content: this.contentBuffer.length ? this.contentBuffer.join('') : null,
31724
31521
  status: this.status
31725
31522
  };
31726
- if (this.options.debug) {
31727
- console.log('[StreamParser] 刷新缓冲区:', {
31728
- thinking: result.thinking?.length || 0,
31729
- content: result.content?.length || 0,
31730
- status: result.status,
31731
- thinkingPreview: result.thinking?.substring(0, 50),
31732
- contentPreview: result.content?.substring(0, 50)
31733
- });
31734
- }
31735
-
31736
- // 清空缓冲区
31737
31523
  this.thinkingBuffer = [];
31738
31524
  this.contentBuffer = [];
31739
-
31740
- // 回调更新
31741
- try {
31742
- callback(result);
31743
- } catch (error) {
31744
- console.error('[StreamParser] 回调执行错误:', error);
31745
- }
31525
+ callback(result);
31746
31526
  }
31747
31527
 
31748
- /**
31749
- * 完成解析
31750
- */
31528
+ // 完成解析
31751
31529
  finish(callback) {
31752
- this.flush(callback);
31753
- if (this.updateTimer) {
31754
- clearTimeout(this.updateTimer);
31755
- this.updateTimer = null;
31756
- }
31757
- if (this.options.debug) {
31758
- const duration = Date.now() - this.metrics.startTime;
31759
- console.log('[StreamParser] 解析完成:', {
31760
- 耗时: `${duration}ms`,
31761
- 数据块: this.metrics.chunks,
31762
- 事件数: this.metrics.events,
31763
- 字符数: this.metrics.chars,
31764
- 平均速度: `${(this.metrics.chars / duration * 1000).toFixed(0)} chars/s`
31765
- });
31530
+ if (this.inTag && this.tagBuffer) {
31531
+ this.appendText(this.tagBuffer);
31532
+ this.tagBuffer = '';
31533
+ this.inTag = false;
31766
31534
  }
31535
+ this.flush(callback);
31536
+ if (this.updateTimer) clearTimeout(this.updateTimer);
31767
31537
  }
31768
31538
 
31769
- /**
31770
- * 销毁解析器
31771
- */
31539
+ // 销毁解析器
31772
31540
  destroy() {
31773
- if (this.updateTimer) {
31774
- clearTimeout(this.updateTimer);
31775
- }
31541
+ if (this.updateTimer) clearTimeout(this.updateTimer);
31776
31542
  this.reset();
31777
31543
  }
31778
31544
  }
31545
+ ;// ./components/utils/Cookie.js
31546
+ const setCookie = (name, value, days) => {
31547
+ const d = new Date();
31548
+ d.setTime(d.getTime() + days * 24 * 60 * 60 * 1000);
31549
+ const expires = `expires=${d.toUTCString()}`;
31550
+ document.cookie = `${name}=${value}; ${expires}`;
31551
+ };
31552
+ const getCookie = cname => {
31553
+ const name = `${cname}=`;
31554
+ const ca = document.cookie.split(';');
31555
+ for (let i = 0; i < ca.length; i++) {
31556
+ let c = ca[i];
31557
+ while (c.charAt(0) === ' ') c = c.substring(1);
31558
+ if (c.indexOf(name) !== -1) return c.substring(name.length, c.length);
31559
+ }
31560
+ return '';
31561
+ };
31562
+
31779
31563
  ;// ./components/mixins/messageMixin.js
31780
31564
 
31781
31565
 
31782
31566
 
31567
+
31783
31568
  /* harmony default export */ var messageMixin = ({
31784
31569
  data() {
31785
31570
  return {
@@ -31835,17 +31620,16 @@ class StreamParser {
31835
31620
  this.streamParser.reset();
31836
31621
  try {
31837
31622
  const startTime = Date.now();
31838
- const controller = new AbortController();
31839
- const token = `Bearer e298f087-85bc-48c2-afb9-7c69ffc911aa`;
31623
+ const token = getCookie('bonyear-access_token') || `44e7f112-63f3-429d-908d-2c97ec380de2`;
31840
31624
  const response = await fetch(API_URL, {
31841
31625
  method: 'POST',
31842
- signal: controller.signal,
31843
31626
  headers: {
31844
31627
  'Content-Type': 'application/json',
31845
- 'Authorization': token
31628
+ 'Authorization': `Bearer ${token}`
31846
31629
  },
31847
31630
  body: JSON.stringify({
31848
- content: message
31631
+ content: message,
31632
+ chat_id: this.chatId
31849
31633
  })
31850
31634
  });
31851
31635
  if (!response.ok) {
@@ -31899,9 +31683,10 @@ class StreamParser {
31899
31683
  const chunk = decoder.decode(value, {
31900
31684
  stream: true
31901
31685
  });
31902
-
31686
+ console.log('收到数据块:', chunk);
31903
31687
  // 使用解析器处理数据块,确保this指向正确
31904
31688
  this.streamParser.processChunk(chunk, function (result) {
31689
+ console.log('处理数据块:', result);
31905
31690
  self.handleStreamUpdate(result);
31906
31691
  });
31907
31692
  }
@@ -31924,6 +31709,7 @@ class StreamParser {
31924
31709
  }
31925
31710
 
31926
31711
  // 更新回复内容
31712
+ console.log('更新回复内容:', result.content);
31927
31713
  if (result.content) {
31928
31714
  this.currentMessage.content += result.content;
31929
31715
  }
@@ -31946,6 +31732,14 @@ class StreamParser {
31946
31732
  }
31947
31733
  }
31948
31734
  });
31735
+ ;// ./components/utils/Uuid.js
31736
+ function generateUuid() {
31737
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
31738
+ var r = Math.random() * 16 | 0,
31739
+ v = c === 'x' ? r : r & 0x3 | 0x8;
31740
+ return v.toString(16);
31741
+ });
31742
+ }
31949
31743
  ;// ./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
31950
31744
 
31951
31745
 
@@ -31964,8 +31758,10 @@ class StreamParser {
31964
31758
 
31965
31759
 
31966
31760
 
31761
+
31967
31762
  const SAMPLE_RATE = 16000;
31968
31763
  const FRAME_SIZE = 512;
31764
+ const startTime = null;
31969
31765
  /* harmony default export */ var ChatWindowvue_type_script_lang_js = ({
31970
31766
  name: 'ChatWindow',
31971
31767
  components: {
@@ -31982,6 +31778,7 @@ const FRAME_SIZE = 512;
31982
31778
  },
31983
31779
  data() {
31984
31780
  return {
31781
+ chatId: generateUuid(),
31985
31782
  audioSrc: AUDIO_URL,
31986
31783
  inputMessage: '',
31987
31784
  visible: false,
@@ -31993,6 +31790,8 @@ const FRAME_SIZE = 512;
31993
31790
  jumpedTimePoints: new Set(),
31994
31791
  SAMPLE_RATE,
31995
31792
  FRAME_SIZE,
31793
+ startTime,
31794
+ // 检查性能使用
31996
31795
  dragThreshold: 5,
31997
31796
  // 拖拽阈值
31998
31797
  isDragging: false,
@@ -32045,6 +31844,7 @@ const FRAME_SIZE = 512;
32045
31844
  },
32046
31845
  methods: {
32047
31846
  toggleWindow() {
31847
+ if (this.avaterStatus === 'thinking') return;
32048
31848
  this.visible = !this.visible;
32049
31849
  if (this.visible) {
32050
31850
  this.currentX = this.initialX;
@@ -32165,10 +31965,10 @@ const FRAME_SIZE = 512;
32165
31965
  });
32166
31966
  ;// ./components/ChatWindow.vue?vue&type=script&lang=js
32167
31967
  /* harmony default export */ var components_ChatWindowvue_type_script_lang_js = (ChatWindowvue_type_script_lang_js);
32168
- ;// ./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=382b928f&prod&scoped=true&lang=css
31968
+ ;// ./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=244aa1c1&prod&scoped=true&lang=css
32169
31969
  // extracted by mini-css-extract-plugin
32170
31970
 
32171
- ;// ./components/ChatWindow.vue?vue&type=style&index=0&id=382b928f&prod&scoped=true&lang=css
31971
+ ;// ./components/ChatWindow.vue?vue&type=style&index=0&id=244aa1c1&prod&scoped=true&lang=css
32172
31972
 
32173
31973
  ;// ./components/ChatWindow.vue
32174
31974
 
@@ -32185,7 +31985,7 @@ var ChatWindow_component = normalizeComponent(
32185
31985
  staticRenderFns,
32186
31986
  false,
32187
31987
  null,
32188
- "382b928f",
31988
+ "244aa1c1",
32189
31989
  null
32190
31990
 
32191
31991
  )