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.
package/dist/index.umd.js CHANGED
@@ -28460,7 +28460,7 @@ if (typeof window !== 'undefined') {
28460
28460
  var es_iterator_constructor = __webpack_require__(8111);
28461
28461
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
28462
28462
  var es_iterator_for_each = __webpack_require__(7588);
28463
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
28463
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
28464
28464
  var render = function render() {
28465
28465
  var _vm = this,
28466
28466
  _c = _vm._self._c;
@@ -28494,7 +28494,8 @@ var render = function render() {
28494
28494
  attrs: {
28495
28495
  "messages": _vm.messages,
28496
28496
  "input-message": _vm.inputMessage,
28497
- "think-status": _vm.thinkStatus
28497
+ "think-status": _vm.thinkStatus,
28498
+ "chat-id": _vm.chatId
28498
28499
  },
28499
28500
  on: {
28500
28501
  "update:inputMessage": function ($event) {
@@ -28751,8 +28752,8 @@ var ChatAvatar_component = normalizeComponent(
28751
28752
  )
28752
28753
 
28753
28754
  /* harmony default export */ var ChatAvatar = (ChatAvatar_component.exports);
28754
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
28755
- var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render = function render() {
28755
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
28756
+ var ChatWindowDialogvue_type_template_id_23a76780_scoped_true_render = function render() {
28756
28757
  var _vm = this,
28757
28758
  _c = _vm._self._c;
28758
28759
  return _c('div', {
@@ -28776,6 +28777,9 @@ var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render = function
28776
28777
  }
28777
28778
  }
28778
28779
  }, [_c('ChatWindowHeader', {
28780
+ attrs: {
28781
+ "chat-id": _vm.chatId
28782
+ },
28779
28783
  on: {
28780
28784
  "close": function ($event) {
28781
28785
  return _vm.$emit('input', false);
@@ -28807,10 +28811,10 @@ var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render = function
28807
28811
  }
28808
28812
  })], 1)]);
28809
28813
  };
28810
- var ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_staticRenderFns = [];
28814
+ var ChatWindowDialogvue_type_template_id_23a76780_scoped_true_staticRenderFns = [];
28811
28815
 
28812
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
28813
- var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_render = function render() {
28816
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
28817
+ var ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_render = function render() {
28814
28818
  var _vm = this,
28815
28819
  _c = _vm._self._c;
28816
28820
  return _c('div', {
@@ -28895,26 +28899,30 @@ var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_render = function
28895
28899
  }
28896
28900
  })])])]);
28897
28901
  };
28898
- var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_staticRenderFns = [];
28902
+ var ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_staticRenderFns = [];
28899
28903
 
28900
28904
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindowHeader.vue?vue&type=script&lang=js
28901
28905
  /* harmony default export */ var ChatWindowHeadervue_type_script_lang_js = ({
28902
28906
  name: 'ChatWindowHeader',
28907
+ props: {
28908
+ chatId: {
28909
+ type: String,
28910
+ default: ''
28911
+ }
28912
+ },
28903
28913
  methods: {
28904
28914
  handleOpen() {
28905
- // const chatId = ''
28906
- // const baseUrl = window.location.protocol + '//' + window.location.hostname + ':3100/c/' + chatId;
28907
- const baseUrl = window.location.protocol + '//' + window.location.hostname + ':3100/';
28915
+ const baseUrl = window.location.protocol + '//' + window.location.hostname + ':3100/c/' + this.chatId;
28908
28916
  window.open(baseUrl, '_blank');
28909
28917
  }
28910
28918
  }
28911
28919
  });
28912
28920
  ;// ./components/ChatWindowHeader.vue?vue&type=script&lang=js
28913
28921
  /* harmony default export */ var components_ChatWindowHeadervue_type_script_lang_js = (ChatWindowHeadervue_type_script_lang_js);
28914
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
28922
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
28915
28923
  // extracted by mini-css-extract-plugin
28916
28924
 
28917
- ;// ./components/ChatWindowHeader.vue?vue&type=style&index=0&id=428ec56e&prod&scoped=true&lang=css
28925
+ ;// ./components/ChatWindowHeader.vue?vue&type=style&index=0&id=90d9b166&prod&scoped=true&lang=css
28918
28926
 
28919
28927
  ;// ./components/ChatWindowHeader.vue
28920
28928
 
@@ -28927,11 +28935,11 @@ var ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_staticRenderFns =
28927
28935
 
28928
28936
  var ChatWindowHeader_component = normalizeComponent(
28929
28937
  components_ChatWindowHeadervue_type_script_lang_js,
28930
- ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_render,
28931
- ChatWindowHeadervue_type_template_id_428ec56e_scoped_true_staticRenderFns,
28938
+ ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_render,
28939
+ ChatWindowHeadervue_type_template_id_90d9b166_scoped_true_staticRenderFns,
28932
28940
  false,
28933
28941
  null,
28934
- "428ec56e",
28942
+ "90d9b166",
28935
28943
  null
28936
28944
 
28937
28945
  )
@@ -29019,8 +29027,8 @@ var UserMessage_component = normalizeComponent(
29019
29027
  )
29020
29028
 
29021
29029
  /* harmony default export */ var UserMessage = (UserMessage_component.exports);
29022
- ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
29023
- var AiMessagevue_type_template_id_5ac07584_scoped_true_render = function render() {
29030
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.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
29031
+ var AiMessagevue_type_template_id_6cbccb01_scoped_true_render = function render() {
29024
29032
  var _vm = this,
29025
29033
  _c = _vm._self._c;
29026
29034
  return _c('div', {
@@ -29053,10 +29061,8 @@ var AiMessagevue_type_template_id_5ac07584_scoped_true_render = function render(
29053
29061
  }
29054
29062
  })])]);
29055
29063
  };
29056
- var AiMessagevue_type_template_id_5ac07584_scoped_true_staticRenderFns = [];
29064
+ var AiMessagevue_type_template_id_6cbccb01_scoped_true_staticRenderFns = [];
29057
29065
 
29058
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
29059
- var es_iterator_filter = __webpack_require__(2489);
29060
29066
  ;// ./node_modules/@babel/runtime/helpers/esm/typeof.js
29061
29067
  function _typeof(o) {
29062
29068
  "@babel/helpers - typeof";
@@ -29100,6 +29106,8 @@ function _defineProperty(e, r, t) {
29100
29106
  }) : e[r] = t, e;
29101
29107
  }
29102
29108
 
29109
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
29110
+ var es_iterator_filter = __webpack_require__(2489);
29103
29111
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
29104
29112
  var es_iterator_map = __webpack_require__(1701);
29105
29113
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
@@ -30829,10 +30837,6 @@ var lib = __webpack_require__(336);
30829
30837
 
30830
30838
 
30831
30839
 
30832
-
30833
-
30834
-
30835
-
30836
30840
  d.setOptions({
30837
30841
  highlight: function (code, lang) {
30838
30842
  if (lang && es.getLanguage(lang)) {
@@ -30845,115 +30849,6 @@ d.setOptions({
30845
30849
  breaks: true,
30846
30850
  gfm: true
30847
30851
  });
30848
- function parseMarkdown(text) {
30849
- if (!text) return '';
30850
- let html = text;
30851
- html = html.replace(/```(\w+)?\n([\s\S]*?)```/g, (match, lang, code) => {
30852
- return `<pre><code class="language-${lang || 'text'}">${escapeHtml(code.trim())}</code></pre>`;
30853
- });
30854
- html = html.replace(/`([^`]+)`/g, '<code>$1</code>');
30855
- html = parseTable(html);
30856
- html = html.replace(/^#### (.*$)/gm, '<h4>$1</h4>');
30857
- html = html.replace(/^### (.*$)/gm, '<h3>$1</h3>');
30858
- html = html.replace(/^## (.*$)/gm, '<h2>$1</h2>');
30859
- html = html.replace(/^# (.*$)/gm, '<h1>$1</h1>');
30860
- html = html.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
30861
- html = html.replace(/\*(.*?)\*/g, '<em>$1</em>');
30862
- html = html.replace(/~~(.*?)~~/g, '<del>$1</del>');
30863
- html = html.replace(/^\s*[-*+]\s+(.+)$/gm, '<li>$1</li>');
30864
- html = html.replace(/(<li>.*?<\/li>)/gs, '<ul>$1</ul>');
30865
- html = html.replace(/^\s*\d+\.\s+(.+)$/gm, '<li>$1</li>');
30866
- html = html.replace(/^>\s+(.+)$/gm, '<blockquote>$1</blockquote>');
30867
- // 解析Markdown链接
30868
- html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>');
30869
- html = html.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" />');
30870
- html = html.replace(/^-{3,}$/gm, '<hr>');
30871
- // 解析简单URL
30872
- // const simpleUrlRegex = /(https?:\/\/[^\s<>"']+)/g;
30873
- // html = html.replace(simpleUrlRegex, (match) => {
30874
- // return `<a href="${match}" aria-current="page">${match}</a>`;
30875
- // });
30876
-
30877
- // html = html.replace(/\n/g, '<br>');
30878
-
30879
- return html;
30880
- }
30881
- // 解析表格
30882
- function parseTable(text) {
30883
- const lines = text.split('\n');
30884
- let result = [];
30885
- let inTable = false;
30886
- let tableRows = [];
30887
- for (let i = 0; i < lines.length; i++) {
30888
- const line = lines[i].trim();
30889
-
30890
- // 检测表格行
30891
- if (line.includes('|') && line.split('|').length >= 3) {
30892
- if (!inTable) {
30893
- inTable = true;
30894
- tableRows = [];
30895
- }
30896
- tableRows.push(line);
30897
-
30898
- // 检查下一行是否还是表格
30899
- if (i === lines.length - 1 || !lines[i + 1].includes('|')) {
30900
- // 表格结束
30901
- result.push(renderTable(tableRows));
30902
- inTable = false;
30903
- tableRows = [];
30904
- }
30905
- } else {
30906
- if (inTable) {
30907
- // 表格意外结束
30908
- result.push(renderTable(tableRows));
30909
- inTable = false;
30910
- tableRows = [];
30911
- }
30912
- result.push(line);
30913
- }
30914
- }
30915
- return result.join('\n');
30916
- }
30917
- // 渲染表格
30918
- function renderTable(rows) {
30919
- if (rows.length < 2) return rows.join('\n');
30920
- let html = '<div class="table-wrapper"><table class="markdown-table">';
30921
-
30922
- // 表头
30923
- const headerCells = rows[0].split('|').filter(cell => cell.trim());
30924
- html += '<thead><tr>';
30925
- headerCells.forEach(cell => {
30926
- html += `<th>${cell.trim()}</th>`;
30927
- });
30928
- html += '</tr></thead>';
30929
-
30930
- // 表体(跳过分隔行)
30931
- html += '<tbody>';
30932
- for (let i = 2; i < rows.length; i++) {
30933
- const cells = rows[i].split('|').filter(cell => cell.trim());
30934
- if (cells.length > 0) {
30935
- html += '<tr>';
30936
- cells.forEach(cell => {
30937
- html += `<td><div class="table-cell">${cell.trim()}</div></td>`;
30938
- });
30939
- html += '</tr>';
30940
- }
30941
- }
30942
- html += '</tbody>';
30943
- html += '</table></div>';
30944
- return html;
30945
- }
30946
- // HTML 转义
30947
- function escapeHtml(text) {
30948
- const map = {
30949
- '&': '&amp;',
30950
- '<': '&lt;',
30951
- '>': '&gt;',
30952
- '"': '&quot;',
30953
- "'": '&#039;'
30954
- };
30955
- return text.replace(/[&<>"']/g, m => map[m]);
30956
- }
30957
30852
  /* harmony default export */ var AiMessagevue_type_script_lang_js = ({
30958
30853
  name: 'AiMessage',
30959
30854
  props: {
@@ -30967,7 +30862,7 @@ function escapeHtml(text) {
30967
30862
  return this.message.thinkingExpanded !== false;
30968
30863
  },
30969
30864
  renderedContent() {
30970
- return parseMarkdown(this.message.content);
30865
+ return d.parse(this.message.content || '');
30971
30866
  },
30972
30867
  isLoading() {
30973
30868
  return this.message.loading === true;
@@ -30981,10 +30876,10 @@ function escapeHtml(text) {
30981
30876
  });
30982
30877
  ;// ./components/AiMessage.vue?vue&type=script&lang=js
30983
30878
  /* harmony default export */ var components_AiMessagevue_type_script_lang_js = (AiMessagevue_type_script_lang_js);
30984
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
30879
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
30985
30880
  // extracted by mini-css-extract-plugin
30986
30881
 
30987
- ;// ./components/AiMessage.vue?vue&type=style&index=0&id=5ac07584&prod&scoped=true&lang=css
30882
+ ;// ./components/AiMessage.vue?vue&type=style&index=0&id=6cbccb01&prod&scoped=true&lang=css
30988
30883
 
30989
30884
  ;// ./components/AiMessage.vue
30990
30885
 
@@ -30997,11 +30892,11 @@ function escapeHtml(text) {
30997
30892
 
30998
30893
  var AiMessage_component = normalizeComponent(
30999
30894
  components_AiMessagevue_type_script_lang_js,
31000
- AiMessagevue_type_template_id_5ac07584_scoped_true_render,
31001
- AiMessagevue_type_template_id_5ac07584_scoped_true_staticRenderFns,
30895
+ AiMessagevue_type_template_id_6cbccb01_scoped_true_render,
30896
+ AiMessagevue_type_template_id_6cbccb01_scoped_true_staticRenderFns,
31002
30897
  false,
31003
30898
  null,
31004
- "5ac07584",
30899
+ "6cbccb01",
31005
30900
  null
31006
30901
 
31007
30902
  )
@@ -31243,15 +31138,19 @@ var ChatInputBox_component = normalizeComponent(
31243
31138
  loading: {
31244
31139
  type: Boolean,
31245
31140
  default: false
31141
+ },
31142
+ chatId: {
31143
+ type: String,
31144
+ default: ''
31246
31145
  }
31247
31146
  }
31248
31147
  });
31249
31148
  ;// ./components/ChatWindowDialog.vue?vue&type=script&lang=js
31250
31149
  /* harmony default export */ var components_ChatWindowDialogvue_type_script_lang_js = (ChatWindowDialogvue_type_script_lang_js);
31251
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
31150
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
31252
31151
  // extracted by mini-css-extract-plugin
31253
31152
 
31254
- ;// ./components/ChatWindowDialog.vue?vue&type=style&index=0&id=1424b8b1&prod&scoped=true&lang=css
31153
+ ;// ./components/ChatWindowDialog.vue?vue&type=style&index=0&id=23a76780&prod&scoped=true&lang=css
31255
31154
 
31256
31155
  ;// ./components/ChatWindowDialog.vue
31257
31156
 
@@ -31264,11 +31163,11 @@ var ChatInputBox_component = normalizeComponent(
31264
31163
 
31265
31164
  var ChatWindowDialog_component = normalizeComponent(
31266
31165
  components_ChatWindowDialogvue_type_script_lang_js,
31267
- ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_render,
31268
- ChatWindowDialogvue_type_template_id_1424b8b1_scoped_true_staticRenderFns,
31166
+ ChatWindowDialogvue_type_template_id_23a76780_scoped_true_render,
31167
+ ChatWindowDialogvue_type_template_id_23a76780_scoped_true_staticRenderFns,
31269
31168
  false,
31270
31169
  null,
31271
- "1424b8b1",
31170
+ "23a76780",
31272
31171
  null
31273
31172
 
31274
31173
  )
@@ -31307,8 +31206,9 @@ var es_typed_array_with = __webpack_require__(9577);
31307
31206
  audio: {
31308
31207
  sampleRate: this.SAMPLE_RATE,
31309
31208
  channelCount: 1,
31310
- noiseSuppression: true,
31311
- echoCancellation: true
31209
+ noiseSuppression: false,
31210
+ echoCancellation: false,
31211
+ autoGainControl: false
31312
31212
  }
31313
31213
  });
31314
31214
  this.audioContext = new AudioContext({
@@ -31368,6 +31268,7 @@ var es_typed_array_with = __webpack_require__(9577);
31368
31268
  this.$refs.audioPlayer.play();
31369
31269
  },
31370
31270
  pause() {
31271
+ console.log('暂停播放');
31371
31272
  this.robotStatus = 'waiting';
31372
31273
  this.$refs.audioPlayer.pause();
31373
31274
  },
@@ -31393,17 +31294,21 @@ var es_typed_array_with = __webpack_require__(9577);
31393
31294
  this.pause();
31394
31295
  } else if (command === 'C6') {
31395
31296
  this.robotStatus = 'leaving';
31297
+ this.avaterStatus = 'normal';
31396
31298
  this.stop();
31397
31299
  }
31398
31300
  }
31399
31301
  }
31400
31302
  });
31401
31303
  ;// ./components/config/index.js
31402
- const baseUrl = window.location.protocol + '//' + window.location.hostname;
31304
+ const protocol = window.location.protocol;
31305
+ const host = window.location.hostname;
31306
+ const baseUrl = `${protocol}//${host}`;
31403
31307
  const chatPort = '3100';
31308
+ const voicePort = '3101';
31404
31309
  console.log(baseUrl, chatPort);
31405
- const API_URL = 'http://192.168.8.87:3100/lingxiao-byt/api/v1/mcp/ask';
31406
- const WS_URL = 'ws://192.168.8.9:9999/ai_model/ws/voice-stream';
31310
+ const API_URL = `${baseUrl}:${chatPort}/lingxiao-byt/api/v1/mcp/ask`;
31311
+ const WS_URL = `ws://${host}:${voicePort}/ai_model/ws/voice-stream`;
31407
31312
  const AUDIO_URL = '/minio/lingxiaoai/byt.mp3';
31408
31313
  const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json';
31409
31314
  ;// ./components/mixins/webSocketMixin.js
@@ -31479,15 +31384,32 @@ const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json';
31479
31384
  handleWebSocketMessage(data) {
31480
31385
  if (data.type === 'detection') {
31481
31386
  console.log('检测到唤醒词');
31387
+ console.log('当前状态:', this.avaterStatus);
31388
+ if (this.robotStatus === 'speaking') {
31389
+ this.robotStatus = 'waiting';
31390
+ }
31482
31391
  this.avaterStatus = 'normal';
31392
+
31393
+ // 性能检测起点
31394
+ this.startTime = Date.now(); // <-- 新增计时器
31395
+ console.log(`[Timer] 指令发送开始计时: ${this.startTime}ms`);
31483
31396
  } else if (data.type === 'Collecting') {
31484
31397
  console.log('状态: 采集中');
31485
31398
  this.avaterStatus = 'thinking';
31486
31399
  } else if (data.type === 'command') {
31487
31400
  console.log('状态: 处理中');
31401
+
31402
+ // 性能检测终点
31403
+ if (this.startTime) {
31404
+ const latency = Date.now() - this.startTime;
31405
+ console.log(`[Latency] 完整命令处理耗时: ${latency}ms`); // 记录端到端延迟
31406
+ this.startTime = null;
31407
+ }
31488
31408
  this.analyzeAudioCommand(data.category);
31489
31409
  } else {
31490
31410
  console.log('状态: 其他');
31411
+ this.avaterStatus = 'normal';
31412
+ this.robotStatus = 'leaving';
31491
31413
  }
31492
31414
  },
31493
31415
  closeWebSocket() {
@@ -31499,214 +31421,99 @@ const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json';
31499
31421
  });
31500
31422
  ;// ./components/utils/StreamParser.js
31501
31423
 
31502
-
31503
31424
  class StreamParser {
31504
31425
  constructor(options = {}) {
31505
31426
  this.options = {
31506
31427
  updateInterval: 16,
31507
- // 更新间隔(ms),默认约60fps
31508
- batchSize: 100,
31509
- // 批处理大小
31428
+ // 每16ms刷新一次(约60fps
31510
31429
  debug: false,
31511
- // 是否开启调试
31512
31430
  ...options
31513
31431
  };
31514
31432
  this.reset();
31515
31433
  }
31516
31434
 
31517
- /**
31518
- * 重置解析器状态
31519
- */
31435
+ // 重置解析器状态
31520
31436
  reset() {
31521
31437
  this.buffer = '';
31522
- this.contentBuffer = []; // 使用数组缓冲,避免频繁字符串拼接
31438
+ this.contentBuffer = [];
31523
31439
  this.thinkingBuffer = [];
31524
31440
  this.inTag = false;
31525
31441
  this.tagBuffer = '';
31526
31442
  this.updateTimer = null;
31527
31443
  this.status = 'output'; // thinking | output
31528
- this.metrics = {
31529
- startTime: Date.now(),
31530
- chunks: 0,
31531
- events: 0,
31532
- chars: 0
31533
- };
31534
31444
  }
31535
31445
 
31536
- /**
31537
- * 处理流数据块
31538
- * @param {string} chunk - 接收到的数据块
31539
- * @param {Function} callback - 更新回调函数
31540
- */
31446
+ // 处理接收到的流数据块
31541
31447
  processChunk(chunk, callback) {
31542
- this.metrics.chunks++;
31543
- this.buffer += chunk;
31544
- if (this.options.debug) {
31545
- console.log('[StreamParser] 收到chunk:', chunk.substring(0, 100));
31546
- }
31547
-
31548
- // 尝试解析为 SSE 格式
31549
- if (this.buffer.includes('data:')) {
31550
- this.processSSEFormat(callback);
31551
- } else {
31552
- // 直接处理纯文本流
31553
- this.processPlainText(callback);
31554
- }
31448
+ if (!chunk) return;
31449
+ this.parseContent(chunk, callback);
31555
31450
  }
31556
31451
 
31557
- /**
31558
- * 处理标准 SSE 格式
31559
- */
31560
- processSSEFormat(callback) {
31561
- // SSE 格式:事件由双换行符分隔
31562
- const events = this.buffer.split('\n\n');
31563
-
31564
- // 保留最后一个可能不完整的事件
31565
- this.buffer = events.pop() || '';
31566
-
31567
- // 处理完整的事件
31568
- for (const event of events) {
31569
- if (event.trim()) {
31570
- this.metrics.events++;
31571
- this.processSSEEvent(event, callback);
31572
- }
31573
- }
31574
- }
31575
-
31576
- /**
31577
- * 处理纯文本流格式
31578
- */
31579
- processPlainText(callback) {
31580
- const content = this.buffer;
31581
- this.buffer = ''; // 清空缓冲区
31582
-
31583
- if (content) {
31584
- this.metrics.chars += content.length;
31585
- if (this.options.debug) {
31586
- console.log('[StreamParser] 处理纯文本:', content);
31587
- }
31588
- this.parseContent(content, callback);
31589
- }
31590
- }
31591
-
31592
- /**
31593
- * 处理单个SSE事件
31594
- */
31595
- processSSEEvent(eventStr, callback) {
31596
- const lines = eventStr.split('\n');
31597
- for (const line of lines) {
31598
- // 解析 data: 行
31599
- if (line.startsWith('data:')) {
31600
- const data = line.substring(5).trim();
31601
- if (data === '[DONE]') {
31602
- this.flush(callback);
31603
- return;
31604
- }
31605
- try {
31606
- const parsed = JSON.parse(data);
31607
- const content = parsed?.choices?.[0]?.delta?.content;
31608
- if (content) {
31609
- this.metrics.chars += content.length;
31610
- if (this.options.debug) {
31611
- console.log('[StreamParser] 解析SSE内容:', content);
31612
- }
31613
- this.parseContent(content, callback);
31614
- }
31615
- } catch (error) {
31616
- if (this.options.debug) {
31617
- console.warn('[StreamParser] JSON解析失败:', data, error);
31618
- }
31619
- }
31620
- }
31621
- }
31622
- }
31623
-
31624
- /**
31625
- * 使用状态机解析内容和标签
31626
- */
31452
+ // 核心内容解析,支持 <think> 标签
31627
31453
  parseContent(content, callback) {
31628
31454
  let i = 0;
31629
31455
  while (i < content.length) {
31630
31456
  if (this.inTag) {
31631
- // 在标签内部,查找标签结束
31632
31457
  const endIndex = content.indexOf('>', i);
31633
31458
  if (endIndex !== -1) {
31634
- // 找到标签结束
31635
31459
  this.tagBuffer += content.substring(i, endIndex + 1);
31636
31460
  this.handleTag(this.tagBuffer);
31637
31461
  this.tagBuffer = '';
31638
31462
  this.inTag = false;
31639
31463
  i = endIndex + 1;
31640
31464
  } else {
31641
- // 标签未结束,缓存剩余部分
31465
+ // 标签未闭合,超过50字符强制输出,防止阻塞
31642
31466
  this.tagBuffer += content.substring(i);
31467
+ if (this.tagBuffer.length > 50) {
31468
+ this.appendText(this.tagBuffer);
31469
+ this.tagBuffer = '';
31470
+ this.inTag = false;
31471
+ }
31643
31472
  break;
31644
31473
  }
31645
31474
  } else {
31646
- // 不在标签内,查找标签开始
31647
31475
  const startIndex = content.indexOf('<', i);
31648
31476
  if (startIndex !== -1) {
31649
- // 找到标签开始,先处理前面的文本
31650
- if (startIndex > i) {
31651
- this.appendText(content.substring(i, startIndex));
31652
- }
31653
-
31654
- // 检查是否是完整标签
31477
+ if (startIndex > i) this.appendText(content.substring(i, startIndex));
31655
31478
  const endIndex = content.indexOf('>', startIndex);
31656
31479
  if (endIndex !== -1) {
31657
- // 完整标签
31658
31480
  const tag = content.substring(startIndex, endIndex + 1);
31659
31481
  this.handleTag(tag);
31660
31482
  i = endIndex + 1;
31661
31483
  } else {
31662
- // 不完整标签,标记进入标签状态
31663
- this.inTag = true;
31664
- this.tagBuffer = content.substring(startIndex);
31665
- break;
31484
+ const nextChar = content[startIndex + 1];
31485
+ if (!/[a-zA-Z/]/.test(nextChar)) {
31486
+ // 很可能不是标签,直接当文本输出
31487
+ this.appendText('<');
31488
+ i = startIndex + 1;
31489
+ } else {
31490
+ this.inTag = true;
31491
+ this.tagBuffer = content.substring(startIndex);
31492
+ break;
31493
+ }
31666
31494
  }
31667
31495
  } else {
31668
- // 没有标签,全部是文本
31669
31496
  this.appendText(content.substring(i));
31670
31497
  break;
31671
31498
  }
31672
31499
  }
31673
31500
  }
31674
-
31675
- // 定时批量更新
31676
31501
  this.scheduleUpdate(callback);
31677
31502
  }
31678
31503
 
31679
- /**
31680
- * 处理标签
31681
- */
31504
+ // 处理标签
31682
31505
  handleTag(tag) {
31683
- const tagName = tag.toLowerCase();
31684
- if (this.options.debug) {
31685
- console.log('[StreamParser] 处理标签:', tag);
31686
- }
31687
- if (tagName === '<think>') {
31688
- this.status = 'thinking';
31689
- } else if (tagName === '</think>') {
31690
- this.status = 'output';
31691
- }
31692
- // 可扩展:支持更多标签类型
31506
+ const t = tag.toLowerCase();
31507
+ if (t === '<think>') this.status = 'thinking';else if (t === '</think>') this.status = 'output';
31693
31508
  }
31694
31509
 
31695
- /**
31696
- * 添加文本到缓冲区
31697
- */
31510
+ // 添加文本到缓冲区
31698
31511
  appendText(text) {
31699
31512
  if (!text) return;
31700
- if (this.status === 'thinking') {
31701
- this.thinkingBuffer.push(text);
31702
- } else {
31703
- this.contentBuffer.push(text);
31704
- }
31513
+ if (this.status === 'thinking') this.thinkingBuffer.push(text);else this.contentBuffer.push(text);
31705
31514
  }
31706
31515
 
31707
- /**
31708
- * 计划更新(防抖)
31709
- */
31516
+ // 防抖刷新
31710
31517
  scheduleUpdate(callback) {
31711
31518
  if (this.updateTimer) return;
31712
31519
  this.updateTimer = setTimeout(() => {
@@ -31715,81 +31522,59 @@ class StreamParser {
31715
31522
  }, this.options.updateInterval);
31716
31523
  }
31717
31524
 
31718
- /**
31719
- * 立即刷新缓冲区
31720
- */
31525
+ // 刷新缓冲区
31721
31526
  flush(callback) {
31722
- if (!callback) {
31723
- console.warn('[StreamParser] flush: callback 为空');
31724
- return;
31725
- }
31726
- const hasThinking = this.thinkingBuffer.length > 0;
31727
- const hasContent = this.contentBuffer.length > 0;
31728
- if (!hasThinking && !hasContent) return;
31729
-
31730
- // 使用 join 比字符串拼接性能更好
31527
+ if (!callback) return;
31731
31528
  const result = {
31732
- thinking: hasThinking ? this.thinkingBuffer.join('') : null,
31733
- content: hasContent ? this.contentBuffer.join('') : null,
31529
+ thinking: this.thinkingBuffer.length ? this.thinkingBuffer.join('') : null,
31530
+ content: this.contentBuffer.length ? this.contentBuffer.join('') : null,
31734
31531
  status: this.status
31735
31532
  };
31736
- if (this.options.debug) {
31737
- console.log('[StreamParser] 刷新缓冲区:', {
31738
- thinking: result.thinking?.length || 0,
31739
- content: result.content?.length || 0,
31740
- status: result.status,
31741
- thinkingPreview: result.thinking?.substring(0, 50),
31742
- contentPreview: result.content?.substring(0, 50)
31743
- });
31744
- }
31745
-
31746
- // 清空缓冲区
31747
31533
  this.thinkingBuffer = [];
31748
31534
  this.contentBuffer = [];
31749
-
31750
- // 回调更新
31751
- try {
31752
- callback(result);
31753
- } catch (error) {
31754
- console.error('[StreamParser] 回调执行错误:', error);
31755
- }
31535
+ callback(result);
31756
31536
  }
31757
31537
 
31758
- /**
31759
- * 完成解析
31760
- */
31538
+ // 完成解析
31761
31539
  finish(callback) {
31762
- this.flush(callback);
31763
- if (this.updateTimer) {
31764
- clearTimeout(this.updateTimer);
31765
- this.updateTimer = null;
31766
- }
31767
- if (this.options.debug) {
31768
- const duration = Date.now() - this.metrics.startTime;
31769
- console.log('[StreamParser] 解析完成:', {
31770
- 耗时: `${duration}ms`,
31771
- 数据块: this.metrics.chunks,
31772
- 事件数: this.metrics.events,
31773
- 字符数: this.metrics.chars,
31774
- 平均速度: `${(this.metrics.chars / duration * 1000).toFixed(0)} chars/s`
31775
- });
31540
+ if (this.inTag && this.tagBuffer) {
31541
+ this.appendText(this.tagBuffer);
31542
+ this.tagBuffer = '';
31543
+ this.inTag = false;
31776
31544
  }
31545
+ this.flush(callback);
31546
+ if (this.updateTimer) clearTimeout(this.updateTimer);
31777
31547
  }
31778
31548
 
31779
- /**
31780
- * 销毁解析器
31781
- */
31549
+ // 销毁解析器
31782
31550
  destroy() {
31783
- if (this.updateTimer) {
31784
- clearTimeout(this.updateTimer);
31785
- }
31551
+ if (this.updateTimer) clearTimeout(this.updateTimer);
31786
31552
  this.reset();
31787
31553
  }
31788
31554
  }
31555
+ ;// ./components/utils/Cookie.js
31556
+ const setCookie = (name, value, days) => {
31557
+ const d = new Date();
31558
+ d.setTime(d.getTime() + days * 24 * 60 * 60 * 1000);
31559
+ const expires = `expires=${d.toUTCString()}`;
31560
+ document.cookie = `${name}=${value}; ${expires}`;
31561
+ };
31562
+ const getCookie = cname => {
31563
+ const name = `${cname}=`;
31564
+ const ca = document.cookie.split(';');
31565
+ for (let i = 0; i < ca.length; i++) {
31566
+ let c = ca[i];
31567
+ while (c.charAt(0) === ' ') c = c.substring(1);
31568
+ if (c.indexOf(name) !== -1) return c.substring(name.length, c.length);
31569
+ }
31570
+ return '';
31571
+ };
31572
+
31789
31573
  ;// ./components/mixins/messageMixin.js
31790
31574
 
31791
31575
 
31792
31576
 
31577
+
31793
31578
  /* harmony default export */ var messageMixin = ({
31794
31579
  data() {
31795
31580
  return {
@@ -31845,17 +31630,16 @@ class StreamParser {
31845
31630
  this.streamParser.reset();
31846
31631
  try {
31847
31632
  const startTime = Date.now();
31848
- const controller = new AbortController();
31849
- const token = `Bearer e298f087-85bc-48c2-afb9-7c69ffc911aa`;
31633
+ const token = getCookie('bonyear-access_token') || `44e7f112-63f3-429d-908d-2c97ec380de2`;
31850
31634
  const response = await fetch(API_URL, {
31851
31635
  method: 'POST',
31852
- signal: controller.signal,
31853
31636
  headers: {
31854
31637
  'Content-Type': 'application/json',
31855
- 'Authorization': token
31638
+ 'Authorization': `Bearer ${token}`
31856
31639
  },
31857
31640
  body: JSON.stringify({
31858
- content: message
31641
+ content: message,
31642
+ chat_id: this.chatId
31859
31643
  })
31860
31644
  });
31861
31645
  if (!response.ok) {
@@ -31909,9 +31693,10 @@ class StreamParser {
31909
31693
  const chunk = decoder.decode(value, {
31910
31694
  stream: true
31911
31695
  });
31912
-
31696
+ console.log('收到数据块:', chunk);
31913
31697
  // 使用解析器处理数据块,确保this指向正确
31914
31698
  this.streamParser.processChunk(chunk, function (result) {
31699
+ console.log('处理数据块:', result);
31915
31700
  self.handleStreamUpdate(result);
31916
31701
  });
31917
31702
  }
@@ -31934,6 +31719,7 @@ class StreamParser {
31934
31719
  }
31935
31720
 
31936
31721
  // 更新回复内容
31722
+ console.log('更新回复内容:', result.content);
31937
31723
  if (result.content) {
31938
31724
  this.currentMessage.content += result.content;
31939
31725
  }
@@ -31956,6 +31742,14 @@ class StreamParser {
31956
31742
  }
31957
31743
  }
31958
31744
  });
31745
+ ;// ./components/utils/Uuid.js
31746
+ function generateUuid() {
31747
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
31748
+ var r = Math.random() * 16 | 0,
31749
+ v = c === 'x' ? r : r & 0x3 | 0x8;
31750
+ return v.toString(16);
31751
+ });
31752
+ }
31959
31753
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/ChatWindow.vue?vue&type=script&lang=js
31960
31754
 
31961
31755
 
@@ -31974,8 +31768,10 @@ class StreamParser {
31974
31768
 
31975
31769
 
31976
31770
 
31771
+
31977
31772
  const SAMPLE_RATE = 16000;
31978
31773
  const FRAME_SIZE = 512;
31774
+ const startTime = null;
31979
31775
  /* harmony default export */ var ChatWindowvue_type_script_lang_js = ({
31980
31776
  name: 'ChatWindow',
31981
31777
  components: {
@@ -31992,6 +31788,7 @@ const FRAME_SIZE = 512;
31992
31788
  },
31993
31789
  data() {
31994
31790
  return {
31791
+ chatId: generateUuid(),
31995
31792
  audioSrc: AUDIO_URL,
31996
31793
  inputMessage: '',
31997
31794
  visible: false,
@@ -32003,6 +31800,8 @@ const FRAME_SIZE = 512;
32003
31800
  jumpedTimePoints: new Set(),
32004
31801
  SAMPLE_RATE,
32005
31802
  FRAME_SIZE,
31803
+ startTime,
31804
+ // 检查性能使用
32006
31805
  dragThreshold: 5,
32007
31806
  // 拖拽阈值
32008
31807
  isDragging: false,
@@ -32055,6 +31854,7 @@ const FRAME_SIZE = 512;
32055
31854
  },
32056
31855
  methods: {
32057
31856
  toggleWindow() {
31857
+ if (this.avaterStatus === 'thinking') return;
32058
31858
  this.visible = !this.visible;
32059
31859
  if (this.visible) {
32060
31860
  this.currentX = this.initialX;
@@ -32175,10 +31975,10 @@ const FRAME_SIZE = 512;
32175
31975
  });
32176
31976
  ;// ./components/ChatWindow.vue?vue&type=script&lang=js
32177
31977
  /* harmony default export */ var components_ChatWindowvue_type_script_lang_js = (ChatWindowvue_type_script_lang_js);
32178
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
31978
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.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
32179
31979
  // extracted by mini-css-extract-plugin
32180
31980
 
32181
- ;// ./components/ChatWindow.vue?vue&type=style&index=0&id=382b928f&prod&scoped=true&lang=css
31981
+ ;// ./components/ChatWindow.vue?vue&type=style&index=0&id=244aa1c1&prod&scoped=true&lang=css
32182
31982
 
32183
31983
  ;// ./components/ChatWindow.vue
32184
31984
 
@@ -32195,7 +31995,7 @@ var ChatWindow_component = normalizeComponent(
32195
31995
  staticRenderFns,
32196
31996
  false,
32197
31997
  null,
32198
- "382b928f",
31998
+ "244aa1c1",
32199
31999
  null
32200
32000
 
32201
32001
  )