File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ parse_chat_response = types.partial {
8383
8484
8585parse_completion_chunk = types. partial {
86- object : " chat.completion.chunk"
86+ -- object: "chat.completion.chunk"
8787 -- not sure of the whole range of chunks, so for now we strictly parse an append
8888 choices : types. shape {
8989 types. partial {
@@ -190,7 +190,8 @@ class ChatSession
190190
191191 parts = {}
192192 f = @client \ create_stream_filter ( c) ->
193- table.insert parts, c. content
193+ if c = parse_completion_chunk c
194+ table.insert parts, c. content
194195
195196 f response
196197 message = {
@@ -250,7 +251,7 @@ class OpenAI
250251 break
251252
252253 accumulation_buffer = rest
253- if chunk = parse_completion_chunk cjson. decode json_blob
254+ if chunk = cjson. decode json_blob
254255 chunk_callback chunk
255256
256257 ...
You can’t perform that action at this time.
0 commit comments