Skip to content

Commit 3828d0b

Browse files
committed
fix: Range error
1 parent 035c00b commit 3828d0b

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

ui/src/api/type/application.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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'
33
import bus from '@/bus'
44

55
interface ApplicationFormType {
@@ -168,7 +168,7 @@ export class ChatRecordManage {
168168
}
169169
}
170170
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 })
172172
}
173173

174174
get_current_up_node(run_node: any) {
@@ -259,7 +259,7 @@ export class ChatRecordManage {
259259
if (this.loading) {
260260
this.loading.value = false
261261
}
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 })
263263
if (this.id) {
264264
clearInterval(this.id)
265265
}
@@ -293,21 +293,21 @@ export class ChatRecordManage {
293293
}
294294
return
295295
}
296-
const {current_node, answer_text_list_index} = node_info
296+
const { current_node, answer_text_list_index } = node_info
297297

298298
if (current_node.buffer.length > 20) {
299299
const context = current_node.is_end
300300
? current_node.buffer.splice(0)
301301
: 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+
)
305305
const reasoning_content = current_node.is_end
306306
? current_node.reasoning_content_buffer.splice(0)
307307
: 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+
)
311311
this.append_answer(
312312
context.join(''),
313313
reasoning_content.join(''),
@@ -392,10 +392,16 @@ export class ChatRecordManage {
392392
appendChunk(chunk: Chunk) {
393393
let n = this.node_list.find((item) => item.real_node_id == chunk.real_node_id)
394394
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)
396399
n.content += chunk.content
397400
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)
399405
n.reasoning_content += chunk.reasoning_content
400406
}
401407
} else {
@@ -542,4 +548,4 @@ export class ChatManagement {
542548
}
543549
}
544550

545-
export type {ApplicationFormType, chatType}
551+
export type { ApplicationFormType, chatType }

0 commit comments

Comments
 (0)