Skip to content

Commit

Permalink
[Fix] 🐛 BingAPI Chat Response Format on CFWK & Vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry-zklcdc committed Mar 8, 2024
1 parent 844c6bf commit 997fa24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cloudflare/bingapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ export async function bingapiChat(request, options) {
await writer.write(encoder.encode('data: ' + JSON.stringify(respData) + '\n\n'));
text = tmp;
}
if (data.arguments[0].messages[0].messageType == 'InternalSearchQuery' || data.arguments[0].messages[0].messageType == 'InternalLoaderMessage') {
respData.choices[0] = Object.assign(choicesStruct, { delta: { content: '\n\n' } })
await writer.write(encoder.encode('data: ' + JSON.stringify(respData) + '\n\n'));
}
}
}
} else if (data.type == 2) {
Expand Down

0 comments on commit 997fa24

Please sign in to comment.