Update examples/typescript-simplechat/client.ts

Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
This commit is contained in:
Matt Williams 2023-12-07 13:39:59 -08:00 committed by GitHub
parent b84d34e632
commit 6cc823c9b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,7 +30,7 @@ async function chat(messages: Message[]): Promise<Message> {
if (!reader) {
throw new Error("Failed to read response body")
}
const content: string[] = []
let content = ""
while (true) {
const { done, value } = await reader.read()
if (done) {
@ -41,7 +41,7 @@ async function chat(messages: Message[]): Promise<Message> {
if (json.done === false) {
process.stdout.write(json.message.content);
content.push(json.message.content)
content += json.message.content
}
}