@@ -89,14 +89,15 @@ export class ChatStreamer {
8989 if ( args . token ) {
9090 this . token = args . token ;
9191 }
92-
92+
9393 if ( args ?. chunks ) {
9494 return await this . flushBuffer ( args ) ;
9595 }
96-
96+
9797 if ( args ?. markdown_text ) {
9898 this . buffer += args . markdown_text ;
9999 }
100+
100101 if ( this . buffer . length >= this . options . buffer_size ) {
101102 return await this . flushBuffer ( args ) ;
102103 }
@@ -151,9 +152,7 @@ export class ChatStreamer {
151152 this . streamTs = response . ts ;
152153 this . state = 'in_progress' ;
153154 }
154- const finalArgs = this . buffer . length > 0 && ! args ?. chunks
155- ? { ...args , markdown_text : this . buffer }
156- : args ;
155+ const finalArgs = this . buffer . length > 0 && ! args ?. chunks ? { ...args , markdown_text : this . buffer } : args ;
157156 const response = await this . client . chat . stopStream ( {
158157 token : this . token ,
159158 channel : this . streamArgs . channel ,
@@ -167,10 +166,7 @@ export class ChatStreamer {
167166 private async flushBuffer (
168167 args : Omit < ChatStartStreamArguments | ChatAppendStreamArguments , 'channel' | 'ts' > ,
169168 ) : Promise < ChatStartStreamResponse | ChatAppendStreamResponse > {
170-
171- const finalArgs = this . buffer . length > 0 && ! args . chunks
172- ? { ...args , markdown_text : this . buffer }
173- : args ;
169+ const finalArgs = this . buffer . length > 0 && ! args . chunks ? { ...args , markdown_text : this . buffer } : args ;
174170
175171 if ( ! this . streamTs ) {
176172 const response = await this . client . chat . startStream ( {
0 commit comments