Skip to content

Commit c5e839f

Browse files
committed
Fix baichuan response parsing
1 parent c360a3c commit c5e839f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/app/bots/baichuan/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,16 @@ export class BaichuanWebBot extends AbstractBot {
8080

8181
for await (const uint8Array of streamAsyncIterable(resp.body!)) {
8282
const str = decoder.decode(uint8Array)
83-
console.debug('baichuan', str)
83+
console.debug('baichuan stream', str)
8484
const lines = str.split('\n')
8585
for (const line of lines) {
8686
if (!line) {
8787
continue
8888
}
8989
const data = JSON.parse(line)
90+
if (!data.answer) {
91+
continue
92+
}
9093
answerMessageId = data.answer.id
9194
const text = data.answer.data
9295
if (text) {

0 commit comments

Comments
 (0)