Explorar o código

Update examples/typescript-simplechat/client.ts

Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
Matt Williams hai 1 ano
pai
achega
6cc823c9b5
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      examples/typescript-simplechat/client.ts

+ 2 - 2
examples/typescript-simplechat/client.ts

@@ -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
     }
 
   }