byt-lingxiao-ai 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AiMessage.vue +25 -88
- package/components/ChatWindow.vue +37 -29
- package/components/mixins/messageMixin.js +19 -28
- package/components/mixins/webSocketMixin.js +2 -0
- package/components/utils/StreamParser.js +88 -166
- package/dist/index.common.js +163 -237
- package/dist/index.common.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.umd.js +163 -237
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -28604,7 +28604,7 @@ if (typeof window !== 'undefined') {
|
|
|
28604
28604
|
var es_iterator_constructor = __webpack_require__(8111);
|
|
28605
28605
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
|
|
28606
28606
|
var es_iterator_for_each = __webpack_require__(7588);
|
|
28607
|
-
;// ./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=
|
|
28607
|
+
;// ./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=67cef8d6&scoped=true
|
|
28608
28608
|
var render = function render() {
|
|
28609
28609
|
var _vm = this,
|
|
28610
28610
|
_c = _vm._self._c;
|
|
@@ -29167,8 +29167,8 @@ var UserMessage_component = normalizeComponent(
|
|
|
29167
29167
|
)
|
|
29168
29168
|
|
|
29169
29169
|
/* harmony default export */ var UserMessage = (UserMessage_component.exports);
|
|
29170
|
-
;// ./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=
|
|
29171
|
-
var
|
|
29170
|
+
;// ./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=7f2cec94&scoped=true
|
|
29171
|
+
var AiMessagevue_type_template_id_7f2cec94_scoped_true_render = function render() {
|
|
29172
29172
|
var _vm = this,
|
|
29173
29173
|
_c = _vm._self._c;
|
|
29174
29174
|
return _c('div', {
|
|
@@ -29183,39 +29183,28 @@ var AiMessagevue_type_template_id_0d2964f2_scoped_true_render = function render(
|
|
|
29183
29183
|
staticClass: "dot"
|
|
29184
29184
|
}), _c('div', {
|
|
29185
29185
|
staticClass: "dot"
|
|
29186
|
-
})]) : _vm._e(), _vm.
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
staticClass: "ai-thinking",
|
|
29192
|
-
on: {
|
|
29193
|
-
"click": function ($event) {
|
|
29194
|
-
return _vm.$emit('thinking-toggle');
|
|
29195
|
-
}
|
|
29196
|
-
}
|
|
29197
|
-
}, [_c('div', {
|
|
29198
|
-
staticClass: "ai-thinking-time"
|
|
29199
|
-
}, [_vm._v(" " + _vm._s(_vm.message.time ? `思考用时 ${_vm.message.time} 秒` : '思考中...') + " ")]), _vm.thinkingExpanded ? _c('div', {
|
|
29200
|
-
staticClass: "ai-thinking-content"
|
|
29201
|
-
}, [_vm._v(" " + _vm._s(item.text) + " ")]) : _vm._e()]) : item.type === 'tool' ? _c('div', {
|
|
29202
|
-
staticClass: "ai-tool"
|
|
29203
|
-
}, [_c('div', {
|
|
29204
|
-
staticClass: "ai-tool-header"
|
|
29205
|
-
}, [_vm._v(" 调用工具:" + _vm._s(item.tool.name) + " ")]), _c('details', [_c('summary', [_vm._v("参数")]), _c('pre', [_vm._v(_vm._s(item.tool.args))])]), item.tool.result ? _c('details', [_c('summary', [_vm._v("结果")]), _c('pre', [_vm._v(_vm._s(item.tool.result))])]) : _vm._e()]) : item.type === 'content' ? _c('div', {
|
|
29206
|
-
staticClass: "ai-content markdown-body",
|
|
29207
|
-
domProps: {
|
|
29208
|
-
"innerHTML": _vm._s(_vm.renderMarkdown(item.text))
|
|
29209
|
-
},
|
|
29210
|
-
on: {
|
|
29211
|
-
"click": _vm.handleLinkClick
|
|
29186
|
+
})]) : _vm._e(), _vm.message.thinking ? _c('div', {
|
|
29187
|
+
staticClass: "ai-thinking",
|
|
29188
|
+
on: {
|
|
29189
|
+
"click": function ($event) {
|
|
29190
|
+
return _vm.$emit('thinking-toggle');
|
|
29212
29191
|
}
|
|
29213
|
-
}
|
|
29214
|
-
|
|
29215
|
-
|
|
29216
|
-
}
|
|
29192
|
+
}
|
|
29193
|
+
}, [_c('div', {
|
|
29194
|
+
staticClass: "ai-thinking-time"
|
|
29195
|
+
}, [_vm._v(_vm._s(_vm.message.time ? `思考用时${_vm.message.time}秒` : '思考中...'))]), _vm.thinkingExpanded ? _c('div', {
|
|
29196
|
+
staticClass: "ai-thinking-content"
|
|
29197
|
+
}, [_vm._v(_vm._s(_vm.message.thinking))]) : _vm._e()]) : _vm._e(), _c('div', {
|
|
29198
|
+
staticClass: "ai-content markdown-body",
|
|
29199
|
+
domProps: {
|
|
29200
|
+
"innerHTML": _vm._s(_vm.renderedContent)
|
|
29201
|
+
},
|
|
29202
|
+
on: {
|
|
29203
|
+
"click": _vm.handleLinkClick
|
|
29204
|
+
}
|
|
29205
|
+
})])]);
|
|
29217
29206
|
};
|
|
29218
|
-
var
|
|
29207
|
+
var AiMessagevue_type_template_id_7f2cec94_scoped_true_staticRenderFns = [];
|
|
29219
29208
|
|
|
29220
29209
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.delete.js
|
|
29221
29210
|
var web_url_search_params_delete = __webpack_require__(4603);
|
|
@@ -31001,6 +30990,8 @@ var lib = __webpack_require__(2750);
|
|
|
31001
30990
|
|
|
31002
30991
|
|
|
31003
30992
|
|
|
30993
|
+
|
|
30994
|
+
// 创建自定义渲染器
|
|
31004
30995
|
const renderer = new d.Renderer();
|
|
31005
30996
|
|
|
31006
30997
|
// 自定义链接渲染
|
|
@@ -31020,8 +31011,8 @@ renderer.link = function ({
|
|
|
31020
31011
|
}
|
|
31021
31012
|
};
|
|
31022
31013
|
d.setOptions({
|
|
31023
|
-
renderer,
|
|
31024
|
-
highlight(code, lang) {
|
|
31014
|
+
renderer: renderer,
|
|
31015
|
+
highlight: function (code, lang) {
|
|
31025
31016
|
if (lang && es.getLanguage(lang)) {
|
|
31026
31017
|
return es.highlight(code, {
|
|
31027
31018
|
language: lang
|
|
@@ -31044,34 +31035,19 @@ d.setOptions({
|
|
|
31044
31035
|
thinkingExpanded() {
|
|
31045
31036
|
return this.message.thinkingExpanded !== false;
|
|
31046
31037
|
},
|
|
31038
|
+
renderedContent() {
|
|
31039
|
+
return d.parse(this.message.content || '');
|
|
31040
|
+
},
|
|
31047
31041
|
isLoading() {
|
|
31048
31042
|
return this.message.loading === true;
|
|
31049
|
-
}
|
|
31050
|
-
|
|
31051
|
-
|
|
31052
|
-
|
|
31053
|
-
|
|
31054
|
-
if (item.type === 'content') {
|
|
31055
|
-
if (last && last.type === 'content') {
|
|
31056
|
-
last.text += item.text;
|
|
31057
|
-
} else {
|
|
31058
|
-
last = {
|
|
31059
|
-
...item
|
|
31060
|
-
};
|
|
31061
|
-
result.push(last);
|
|
31062
|
-
}
|
|
31063
|
-
} else {
|
|
31064
|
-
last = null;
|
|
31065
|
-
result.push(item);
|
|
31066
|
-
}
|
|
31067
|
-
}
|
|
31068
|
-
return result;
|
|
31043
|
+
}
|
|
31044
|
+
},
|
|
31045
|
+
watch: {
|
|
31046
|
+
thinkStatus(newVal, oldVal) {
|
|
31047
|
+
console.log('thinkStatus 变化:', newVal, oldVal);
|
|
31069
31048
|
}
|
|
31070
31049
|
},
|
|
31071
31050
|
methods: {
|
|
31072
|
-
renderMarkdown(text) {
|
|
31073
|
-
return d.parse(text || '');
|
|
31074
|
-
},
|
|
31075
31051
|
handleLinkClick(event) {
|
|
31076
31052
|
const link = event.target.closest('a');
|
|
31077
31053
|
if (!link) return;
|
|
@@ -31101,10 +31077,10 @@ d.setOptions({
|
|
|
31101
31077
|
});
|
|
31102
31078
|
;// ./components/AiMessage.vue?vue&type=script&lang=js
|
|
31103
31079
|
/* harmony default export */ var components_AiMessagevue_type_script_lang_js = (AiMessagevue_type_script_lang_js);
|
|
31104
|
-
;// ./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=
|
|
31080
|
+
;// ./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=7f2cec94&prod&scoped=true&lang=css
|
|
31105
31081
|
// extracted by mini-css-extract-plugin
|
|
31106
31082
|
|
|
31107
|
-
;// ./components/AiMessage.vue?vue&type=style&index=0&id=
|
|
31083
|
+
;// ./components/AiMessage.vue?vue&type=style&index=0&id=7f2cec94&prod&scoped=true&lang=css
|
|
31108
31084
|
|
|
31109
31085
|
;// ./components/AiMessage.vue
|
|
31110
31086
|
|
|
@@ -31117,11 +31093,11 @@ d.setOptions({
|
|
|
31117
31093
|
|
|
31118
31094
|
var AiMessage_component = normalizeComponent(
|
|
31119
31095
|
components_AiMessagevue_type_script_lang_js,
|
|
31120
|
-
|
|
31121
|
-
|
|
31096
|
+
AiMessagevue_type_template_id_7f2cec94_scoped_true_render,
|
|
31097
|
+
AiMessagevue_type_template_id_7f2cec94_scoped_true_staticRenderFns,
|
|
31122
31098
|
false,
|
|
31123
31099
|
null,
|
|
31124
|
-
"
|
|
31100
|
+
"7f2cec94",
|
|
31125
31101
|
null
|
|
31126
31102
|
|
|
31127
31103
|
)
|
|
@@ -31551,7 +31527,9 @@ const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json'; // 语音u
|
|
|
31551
31527
|
try {
|
|
31552
31528
|
// this.ws = new WebSocket('ws://10.2.233.41:9999');
|
|
31553
31529
|
// 测试
|
|
31530
|
+
// console.log('WS_URL:', WS_URL)
|
|
31554
31531
|
this.ws = new WebSocket(WS_URL);
|
|
31532
|
+
// this.ws = new WebSocket('ws://192.168.8.87/audio/ws/');
|
|
31555
31533
|
this.ws.binaryType = 'arraybuffer';
|
|
31556
31534
|
this.ws.onopen = async () => {
|
|
31557
31535
|
console.log('WebSocket 连接成功');
|
|
@@ -31642,138 +31620,99 @@ const TIME_JUMP_POINTS_URL = '/minio/lingxiaoai/timeJumpPoints.json'; // 语音u
|
|
|
31642
31620
|
});
|
|
31643
31621
|
;// ./components/utils/StreamParser.js
|
|
31644
31622
|
|
|
31645
|
-
// utils/StreamParser.js
|
|
31646
31623
|
class StreamParser {
|
|
31647
31624
|
constructor(options = {}) {
|
|
31648
31625
|
this.options = {
|
|
31649
31626
|
updateInterval: 16,
|
|
31627
|
+
// 每16ms刷新一次(约60fps)
|
|
31650
31628
|
debug: false,
|
|
31651
31629
|
...options
|
|
31652
31630
|
};
|
|
31653
31631
|
this.reset();
|
|
31654
31632
|
}
|
|
31633
|
+
|
|
31634
|
+
// 重置解析器状态
|
|
31655
31635
|
reset() {
|
|
31636
|
+
this.buffer = '';
|
|
31656
31637
|
this.contentBuffer = [];
|
|
31657
31638
|
this.thinkingBuffer = [];
|
|
31658
|
-
this.completedThinkingSegments = [];
|
|
31659
|
-
this.completedToolCalls = [];
|
|
31660
|
-
this.currentToolCall = null;
|
|
31661
|
-
this.protocolErrorBuffer = []; // ✅ 新增
|
|
31662
|
-
|
|
31663
31639
|
this.inTag = false;
|
|
31664
31640
|
this.tagBuffer = '';
|
|
31665
31641
|
this.updateTimer = null;
|
|
31666
|
-
this.status = 'output'; // thinking | output
|
|
31642
|
+
this.status = 'output'; // thinking | output
|
|
31667
31643
|
}
|
|
31644
|
+
|
|
31645
|
+
// 处理接收到的流数据块
|
|
31668
31646
|
processChunk(chunk, callback) {
|
|
31669
31647
|
if (!chunk) return;
|
|
31670
31648
|
this.parseContent(chunk, callback);
|
|
31671
31649
|
}
|
|
31650
|
+
|
|
31651
|
+
// 核心内容解析,支持 <think> 标签
|
|
31672
31652
|
parseContent(content, callback) {
|
|
31673
31653
|
let i = 0;
|
|
31674
31654
|
while (i < content.length) {
|
|
31675
31655
|
if (this.inTag) {
|
|
31676
|
-
const
|
|
31677
|
-
if (
|
|
31678
|
-
this.tagBuffer += content.
|
|
31656
|
+
const endIndex = content.indexOf('>', i);
|
|
31657
|
+
if (endIndex !== -1) {
|
|
31658
|
+
this.tagBuffer += content.substring(i, endIndex + 1);
|
|
31679
31659
|
this.handleTag(this.tagBuffer);
|
|
31680
31660
|
this.tagBuffer = '';
|
|
31681
31661
|
this.inTag = false;
|
|
31682
|
-
i =
|
|
31662
|
+
i = endIndex + 1;
|
|
31683
31663
|
} else {
|
|
31684
|
-
|
|
31664
|
+
// 标签未闭合,超过50字符强制输出,防止阻塞
|
|
31665
|
+
this.tagBuffer += content.substring(i);
|
|
31666
|
+
if (this.tagBuffer.length > 50) {
|
|
31667
|
+
this.appendText(this.tagBuffer);
|
|
31668
|
+
this.tagBuffer = '';
|
|
31669
|
+
this.inTag = false;
|
|
31670
|
+
}
|
|
31685
31671
|
break;
|
|
31686
31672
|
}
|
|
31687
31673
|
} else {
|
|
31688
|
-
const
|
|
31689
|
-
if (
|
|
31690
|
-
this.appendText(content.
|
|
31691
|
-
|
|
31692
|
-
|
|
31693
|
-
|
|
31694
|
-
|
|
31695
|
-
|
|
31696
|
-
|
|
31697
|
-
|
|
31698
|
-
|
|
31699
|
-
|
|
31674
|
+
const startIndex = content.indexOf('<', i);
|
|
31675
|
+
if (startIndex !== -1) {
|
|
31676
|
+
if (startIndex > i) this.appendText(content.substring(i, startIndex));
|
|
31677
|
+
const endIndex = content.indexOf('>', startIndex);
|
|
31678
|
+
if (endIndex !== -1) {
|
|
31679
|
+
const tag = content.substring(startIndex, endIndex + 1);
|
|
31680
|
+
this.handleTag(tag);
|
|
31681
|
+
i = endIndex + 1;
|
|
31682
|
+
} else {
|
|
31683
|
+
const nextChar = content[startIndex + 1];
|
|
31684
|
+
if (!/[a-zA-Z/]/.test(nextChar)) {
|
|
31685
|
+
// 很可能不是标签,直接当文本输出
|
|
31686
|
+
this.appendText('<');
|
|
31687
|
+
i = startIndex + 1;
|
|
31688
|
+
} else {
|
|
31689
|
+
this.inTag = true;
|
|
31690
|
+
this.tagBuffer = content.substring(startIndex);
|
|
31691
|
+
break;
|
|
31692
|
+
}
|
|
31693
|
+
}
|
|
31694
|
+
} else {
|
|
31695
|
+
this.appendText(content.substring(i));
|
|
31700
31696
|
break;
|
|
31701
31697
|
}
|
|
31702
|
-
const tag = content.slice(start, end + 1);
|
|
31703
|
-
this.handleTag(tag);
|
|
31704
|
-
i = end + 1;
|
|
31705
31698
|
}
|
|
31706
31699
|
}
|
|
31707
31700
|
this.scheduleUpdate(callback);
|
|
31708
31701
|
}
|
|
31702
|
+
|
|
31703
|
+
// 处理标签
|
|
31709
31704
|
handleTag(tag) {
|
|
31710
31705
|
const t = tag.toLowerCase();
|
|
31711
|
-
|
|
31712
|
-
// ---------- think ----------
|
|
31713
|
-
if (t === '<think>') {
|
|
31714
|
-
this.status = 'thinking';
|
|
31715
|
-
return;
|
|
31716
|
-
}
|
|
31717
|
-
if (t === '</think>') {
|
|
31718
|
-
if (this.thinkingBuffer.length) {
|
|
31719
|
-
this.completedThinkingSegments.push(this.thinkingBuffer.join(''));
|
|
31720
|
-
this.thinkingBuffer = [];
|
|
31721
|
-
}
|
|
31722
|
-
this.status = 'output';
|
|
31723
|
-
return;
|
|
31724
|
-
}
|
|
31725
|
-
|
|
31726
|
-
// ---------- tool_call ----------
|
|
31727
|
-
if (t.startsWith('<tool_call')) {
|
|
31728
|
-
const nameMatch = tag.match(/name\s*=\s*["'](.+?)["']/);
|
|
31729
|
-
this.currentToolCall = {
|
|
31730
|
-
id: `${Date.now()}-${Math.random()}`,
|
|
31731
|
-
name: nameMatch ? nameMatch[1] : 'unknown',
|
|
31732
|
-
args: '',
|
|
31733
|
-
result: '',
|
|
31734
|
-
status: 'calling'
|
|
31735
|
-
};
|
|
31736
|
-
this.status = 'tool_call';
|
|
31737
|
-
return;
|
|
31738
|
-
}
|
|
31739
|
-
if (t === '</tool_call>') {
|
|
31740
|
-
this.status = 'output';
|
|
31741
|
-
return;
|
|
31742
|
-
}
|
|
31743
|
-
|
|
31744
|
-
// ---------- tool_result ----------
|
|
31745
|
-
if (t === '<tool_result>') {
|
|
31746
|
-
this.status = 'tool_result';
|
|
31747
|
-
return;
|
|
31748
|
-
}
|
|
31749
|
-
if (t === '</tool_result>') {
|
|
31750
|
-
if (this.currentToolCall) {
|
|
31751
|
-
this.currentToolCall.status = 'done';
|
|
31752
|
-
this.completedToolCalls.push(this.currentToolCall);
|
|
31753
|
-
this.currentToolCall = null;
|
|
31754
|
-
}
|
|
31755
|
-
this.status = 'output';
|
|
31756
|
-
return;
|
|
31757
|
-
}
|
|
31758
|
-
|
|
31759
|
-
// ---------- ❌ 协议错误 ----------
|
|
31760
|
-
if (t.startsWith('<') && t.endsWith('>')) {
|
|
31761
|
-
this.protocolErrorBuffer.push(tag);
|
|
31762
|
-
this.status = 'output';
|
|
31763
|
-
}
|
|
31706
|
+
if (t === '<think>') this.status = 'thinking';else if (t === '</think>') this.status = 'output';
|
|
31764
31707
|
}
|
|
31708
|
+
|
|
31709
|
+
// 添加文本到缓冲区
|
|
31765
31710
|
appendText(text) {
|
|
31766
31711
|
if (!text) return;
|
|
31767
|
-
if (this.status === 'thinking')
|
|
31768
|
-
this.thinkingBuffer.push(text);
|
|
31769
|
-
} else if (this.status === 'tool_call') {
|
|
31770
|
-
this.currentToolCall && (this.currentToolCall.args += text);
|
|
31771
|
-
} else if (this.status === 'tool_result') {
|
|
31772
|
-
this.currentToolCall && (this.currentToolCall.result += text);
|
|
31773
|
-
} else {
|
|
31774
|
-
this.contentBuffer.push(text);
|
|
31775
|
-
}
|
|
31712
|
+
if (this.status === 'thinking') this.thinkingBuffer.push(text);else this.contentBuffer.push(text);
|
|
31776
31713
|
}
|
|
31714
|
+
|
|
31715
|
+
// 防抖刷新
|
|
31777
31716
|
scheduleUpdate(callback) {
|
|
31778
31717
|
if (this.updateTimer) return;
|
|
31779
31718
|
this.updateTimer = setTimeout(() => {
|
|
@@ -31781,39 +31720,32 @@ class StreamParser {
|
|
|
31781
31720
|
this.updateTimer = null;
|
|
31782
31721
|
}, this.options.updateInterval);
|
|
31783
31722
|
}
|
|
31723
|
+
|
|
31724
|
+
// 刷新缓冲区
|
|
31784
31725
|
flush(callback) {
|
|
31785
31726
|
if (!callback) return;
|
|
31786
31727
|
const result = {
|
|
31787
|
-
|
|
31788
|
-
|
|
31789
|
-
content: null,
|
|
31790
|
-
protocolError: null,
|
|
31728
|
+
thinking: this.thinkingBuffer.length ? this.thinkingBuffer.join('') : null,
|
|
31729
|
+
content: this.contentBuffer.length ? this.contentBuffer.join('') : null,
|
|
31791
31730
|
status: this.status
|
|
31792
31731
|
};
|
|
31793
|
-
|
|
31794
|
-
|
|
31795
|
-
this.protocolErrorBuffer = [];
|
|
31796
|
-
}
|
|
31797
|
-
if (this.completedThinkingSegments.length) {
|
|
31798
|
-
result.thinkingSegment = this.completedThinkingSegments.shift();
|
|
31799
|
-
}
|
|
31800
|
-
if (this.completedToolCalls.length) {
|
|
31801
|
-
result.toolCall = this.completedToolCalls.shift();
|
|
31802
|
-
}
|
|
31803
|
-
if (this.contentBuffer.length) {
|
|
31804
|
-
result.content = this.contentBuffer.join('');
|
|
31805
|
-
this.contentBuffer = [];
|
|
31806
|
-
}
|
|
31732
|
+
this.thinkingBuffer = [];
|
|
31733
|
+
this.contentBuffer = [];
|
|
31807
31734
|
callback(result);
|
|
31808
31735
|
}
|
|
31736
|
+
|
|
31737
|
+
// 完成解析
|
|
31809
31738
|
finish(callback) {
|
|
31810
|
-
if (this.
|
|
31811
|
-
this.
|
|
31812
|
-
this.
|
|
31739
|
+
if (this.inTag && this.tagBuffer) {
|
|
31740
|
+
this.appendText(this.tagBuffer);
|
|
31741
|
+
this.tagBuffer = '';
|
|
31742
|
+
this.inTag = false;
|
|
31813
31743
|
}
|
|
31814
31744
|
this.flush(callback);
|
|
31815
31745
|
if (this.updateTimer) clearTimeout(this.updateTimer);
|
|
31816
31746
|
}
|
|
31747
|
+
|
|
31748
|
+
// 销毁解析器
|
|
31817
31749
|
destroy() {
|
|
31818
31750
|
if (this.updateTimer) clearTimeout(this.updateTimer);
|
|
31819
31751
|
this.reset();
|
|
@@ -31863,7 +31795,9 @@ const getCookie = cname => {
|
|
|
31863
31795
|
type: 'ai',
|
|
31864
31796
|
sender: 'AI',
|
|
31865
31797
|
time: '',
|
|
31866
|
-
|
|
31798
|
+
thinking: '',
|
|
31799
|
+
charts: [],
|
|
31800
|
+
content: '',
|
|
31867
31801
|
loading: true,
|
|
31868
31802
|
thinkingExpanded: true
|
|
31869
31803
|
};
|
|
@@ -31896,7 +31830,7 @@ const getCookie = cname => {
|
|
|
31896
31830
|
const controller = new AbortController();
|
|
31897
31831
|
try {
|
|
31898
31832
|
const startTime = Date.now();
|
|
31899
|
-
const token = getCookie('bonyear-access_token') || `
|
|
31833
|
+
const token = getCookie('bonyear-access_token') || `44e7f112-63f3-429d-908d-2c97ec380de2`;
|
|
31900
31834
|
const response = await fetch(API_URL, {
|
|
31901
31835
|
method: 'POST',
|
|
31902
31836
|
signal: controller.signal,
|
|
@@ -31976,38 +31910,27 @@ const getCookie = cname => {
|
|
|
31976
31910
|
*/
|
|
31977
31911
|
handleStreamUpdate(result) {
|
|
31978
31912
|
if (!this.currentMessage) return;
|
|
31979
|
-
|
|
31980
|
-
if (
|
|
31981
|
-
this.currentMessage.
|
|
31982
|
-
type: 'protocol_error',
|
|
31983
|
-
id: Date.now() + Math.random(),
|
|
31984
|
-
raw: result.protocolError
|
|
31985
|
-
});
|
|
31913
|
+
console.log('收到更新:', result);
|
|
31914
|
+
if (this.currentMessage.loading) {
|
|
31915
|
+
this.currentMessage.loading = false;
|
|
31986
31916
|
}
|
|
31987
|
-
|
|
31988
|
-
|
|
31989
|
-
|
|
31990
|
-
id: Date.now() + Math.random(),
|
|
31991
|
-
text: result.thinkingSegment
|
|
31992
|
-
});
|
|
31993
|
-
}
|
|
31994
|
-
if (result.toolCall) {
|
|
31995
|
-
this.currentMessage.timeline.push({
|
|
31996
|
-
type: 'tool',
|
|
31997
|
-
id: result.toolCall.id,
|
|
31998
|
-
tool: result.toolCall
|
|
31999
|
-
});
|
|
31917
|
+
// 更新思考内容
|
|
31918
|
+
if (result.thinking) {
|
|
31919
|
+
this.currentMessage.thinking += result.thinking;
|
|
32000
31920
|
}
|
|
31921
|
+
|
|
31922
|
+
// 更新回复内容
|
|
31923
|
+
console.log('更新回复内容:', result.content);
|
|
32001
31924
|
if (result.content) {
|
|
32002
|
-
this.currentMessage.
|
|
32003
|
-
type: 'content',
|
|
32004
|
-
id: Date.now() + Math.random(),
|
|
32005
|
-
text: result.content
|
|
32006
|
-
});
|
|
31925
|
+
this.currentMessage.content += result.content;
|
|
32007
31926
|
}
|
|
32008
31927
|
|
|
32009
31928
|
// 更新状态
|
|
32010
|
-
|
|
31929
|
+
if (result.status === 'thinking') {
|
|
31930
|
+
this.avaterStatus = 'thinking';
|
|
31931
|
+
} else {
|
|
31932
|
+
this.avaterStatus = 'output';
|
|
31933
|
+
}
|
|
32011
31934
|
|
|
32012
31935
|
// 触发视图更新
|
|
32013
31936
|
this.$forceUpdate();
|
|
@@ -32089,7 +32012,8 @@ const startTime = null;
|
|
|
32089
32012
|
currentY: 20,
|
|
32090
32013
|
initialX: 10,
|
|
32091
32014
|
initialY: 20,
|
|
32092
|
-
hasMoved: false
|
|
32015
|
+
hasMoved: false,
|
|
32016
|
+
timeJumpPoints: []
|
|
32093
32017
|
};
|
|
32094
32018
|
},
|
|
32095
32019
|
computed: {
|
|
@@ -32112,6 +32036,7 @@ const startTime = null;
|
|
|
32112
32036
|
if (this.appendToBody) {
|
|
32113
32037
|
this.appendToBodyHandler();
|
|
32114
32038
|
}
|
|
32039
|
+
this.fetchTimeJumpPoints();
|
|
32115
32040
|
this.$nextTick(() => {
|
|
32116
32041
|
const chatEl = this.$el;
|
|
32117
32042
|
const style = window.getComputedStyle(chatEl);
|
|
@@ -32208,41 +32133,42 @@ const startTime = null;
|
|
|
32208
32133
|
}
|
|
32209
32134
|
});
|
|
32210
32135
|
},
|
|
32136
|
+
async fetchTimeJumpPoints() {
|
|
32137
|
+
try {
|
|
32138
|
+
const res = await fetch(TIME_JUMP_POINTS_URL);
|
|
32139
|
+
const data = await res.json();
|
|
32140
|
+
this.timeJumpPoints = Array.isArray(data) ? data : [];
|
|
32141
|
+
console.log('时间跳转点加载完成:', this.timeJumpPoints);
|
|
32142
|
+
} catch (err) {
|
|
32143
|
+
console.error('获取时间跳转点失败:', err);
|
|
32144
|
+
this.timeJumpPoints = [];
|
|
32145
|
+
}
|
|
32146
|
+
},
|
|
32211
32147
|
// 音频时间更新处理
|
|
32212
32148
|
onTimeUpdate() {
|
|
32213
32149
|
const audio = this.$refs.audioPlayer;
|
|
32214
32150
|
const currentTime = audio.currentTime;
|
|
32215
|
-
if (!this.
|
|
32216
|
-
|
|
32217
|
-
|
|
32218
|
-
|
|
32219
|
-
|
|
32220
|
-
|
|
32221
|
-
|
|
32222
|
-
|
|
32223
|
-
|
|
32224
|
-
|
|
32225
|
-
|
|
32226
|
-
|
|
32227
|
-
|
|
32228
|
-
|
|
32229
|
-
|
|
32230
|
-
|
|
32231
|
-
|
|
32232
|
-
|
|
32233
|
-
|
|
32234
|
-
|
|
32235
|
-
|
|
32236
|
-
},
|
|
32237
|
-
query: {},
|
|
32238
|
-
params: {}
|
|
32239
|
-
});
|
|
32240
|
-
this.$appOptions.router.push({
|
|
32241
|
-
path: point.url
|
|
32242
|
-
});
|
|
32243
|
-
}
|
|
32244
|
-
});
|
|
32245
|
-
}).catch(error => console.error('获取时间跳转点失败:', error));
|
|
32151
|
+
if (!this.timeJumpPoints.length) return;
|
|
32152
|
+
this.timeJumpPoints.forEach(point => {
|
|
32153
|
+
if (currentTime >= point.time && currentTime < point.time + 1 && !this.jumpedTimePoints.has(point.time)) {
|
|
32154
|
+
console.log('触发跳转:', point.url);
|
|
32155
|
+
this.jumpedTimePoints.add(point.time);
|
|
32156
|
+
this.$appOptions.store.dispatch('tags/addTagview', {
|
|
32157
|
+
path: point.url,
|
|
32158
|
+
fullPath: point.url,
|
|
32159
|
+
label: point.title,
|
|
32160
|
+
name: point.title,
|
|
32161
|
+
meta: {
|
|
32162
|
+
title: point.title
|
|
32163
|
+
},
|
|
32164
|
+
query: {},
|
|
32165
|
+
params: {}
|
|
32166
|
+
});
|
|
32167
|
+
this.$appOptions.router.push({
|
|
32168
|
+
path: point.url
|
|
32169
|
+
});
|
|
32170
|
+
}
|
|
32171
|
+
});
|
|
32246
32172
|
},
|
|
32247
32173
|
onAudioEnded() {
|
|
32248
32174
|
this.robotStatus = 'leaving';
|
|
@@ -32253,10 +32179,10 @@ const startTime = null;
|
|
|
32253
32179
|
});
|
|
32254
32180
|
;// ./components/ChatWindow.vue?vue&type=script&lang=js
|
|
32255
32181
|
/* harmony default export */ var components_ChatWindowvue_type_script_lang_js = (ChatWindowvue_type_script_lang_js);
|
|
32256
|
-
;// ./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=
|
|
32182
|
+
;// ./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=67cef8d6&prod&scoped=true&lang=css
|
|
32257
32183
|
// extracted by mini-css-extract-plugin
|
|
32258
32184
|
|
|
32259
|
-
;// ./components/ChatWindow.vue?vue&type=style&index=0&id=
|
|
32185
|
+
;// ./components/ChatWindow.vue?vue&type=style&index=0&id=67cef8d6&prod&scoped=true&lang=css
|
|
32260
32186
|
|
|
32261
32187
|
;// ./components/ChatWindow.vue
|
|
32262
32188
|
|
|
@@ -32273,7 +32199,7 @@ var ChatWindow_component = normalizeComponent(
|
|
|
32273
32199
|
staticRenderFns,
|
|
32274
32200
|
false,
|
|
32275
32201
|
null,
|
|
32276
|
-
"
|
|
32202
|
+
"67cef8d6",
|
|
32277
32203
|
null
|
|
32278
32204
|
|
|
32279
32205
|
)
|