|
1 | | -import {type Dict} from '@/api/type/common' |
2 | | -import {type Ref} from 'vue' |
| 1 | +import { type Dict } from '@/api/type/common' |
| 2 | +import { type Ref } from 'vue' |
3 | 3 | import bus from '@/bus' |
4 | 4 |
|
5 | 5 | interface ApplicationFormType { |
@@ -168,7 +168,7 @@ export class ChatRecordManage { |
168 | 168 | } |
169 | 169 | } |
170 | 170 | this.chat.answer_text = this.chat.answer_text + chunk_answer |
171 | | - bus.emit('change:answer', {record_id: this.chat.record_id, is_end: false}) |
| 171 | + bus.emit('change:answer', { record_id: this.chat.record_id, is_end: false }) |
172 | 172 | } |
173 | 173 |
|
174 | 174 | get_current_up_node(run_node: any) { |
@@ -259,7 +259,7 @@ export class ChatRecordManage { |
259 | 259 | if (this.loading) { |
260 | 260 | this.loading.value = false |
261 | 261 | } |
262 | | - bus.emit('change:answer', {record_id: this.chat.record_id, is_end: true}) |
| 262 | + bus.emit('change:answer', { record_id: this.chat.record_id, is_end: true }) |
263 | 263 | if (this.id) { |
264 | 264 | clearInterval(this.id) |
265 | 265 | } |
@@ -293,21 +293,21 @@ export class ChatRecordManage { |
293 | 293 | } |
294 | 294 | return |
295 | 295 | } |
296 | | - const {current_node, answer_text_list_index} = node_info |
| 296 | + const { current_node, answer_text_list_index } = node_info |
297 | 297 |
|
298 | 298 | if (current_node.buffer.length > 20) { |
299 | 299 | const context = current_node.is_end |
300 | 300 | ? current_node.buffer.splice(0) |
301 | 301 | : current_node.buffer.splice( |
302 | | - 0, |
303 | | - current_node.is_end ? undefined : current_node.buffer.length - 20, |
304 | | - ) |
| 302 | + 0, |
| 303 | + current_node.is_end ? undefined : current_node.buffer.length - 20, |
| 304 | + ) |
305 | 305 | const reasoning_content = current_node.is_end |
306 | 306 | ? current_node.reasoning_content_buffer.splice(0) |
307 | 307 | : current_node.reasoning_content_buffer.splice( |
308 | | - 0, |
309 | | - current_node.is_end ? undefined : current_node.reasoning_content_buffer.length - 20, |
310 | | - ) |
| 308 | + 0, |
| 309 | + current_node.is_end ? undefined : current_node.reasoning_content_buffer.length - 20, |
| 310 | + ) |
311 | 311 | this.append_answer( |
312 | 312 | context.join(''), |
313 | 313 | reasoning_content.join(''), |
@@ -392,10 +392,16 @@ export class ChatRecordManage { |
392 | 392 | appendChunk(chunk: Chunk) { |
393 | 393 | let n = this.node_list.find((item) => item.real_node_id == chunk.real_node_id) |
394 | 394 | if (n) { |
395 | | - n.buffer.push(...chunk.content) |
| 395 | + for (const ch of chunk.content) { |
| 396 | + n.buffer.push(ch) |
| 397 | + } |
| 398 | + // n.buffer.push(...chunk.content) |
396 | 399 | n.content += chunk.content |
397 | 400 | if (chunk.reasoning_content) { |
398 | | - n.reasoning_content_buffer.push(...chunk.reasoning_content) |
| 401 | + for (const ch of chunk.reasoning_content) { |
| 402 | + n.reasoning_content_buffer.push(ch) |
| 403 | + } |
| 404 | + // n.reasoning_content_buffer.push(...chunk.reasoning_content) |
399 | 405 | n.reasoning_content += chunk.reasoning_content |
400 | 406 | } |
401 | 407 | } else { |
@@ -542,4 +548,4 @@ export class ChatManagement { |
542 | 548 | } |
543 | 549 | } |
544 | 550 |
|
545 | | -export type {ApplicationFormType, chatType} |
| 551 | +export type { ApplicationFormType, chatType } |
0 commit comments