You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by @rkuiper1 June 16, 2024
Today I was lucky enough to have a decent internet connection and I took a look at your streaming implementation.
I focused on ThreadsEndpoint.cs and in particular the StreamRunAsync method.
There I found that all the delta's are neatly received and processed, but not passed to the streamEventHandler, which explains the empty content we see in our logfiles.
This tiny tweak made the difference:
case "thread.message.incomplete":varpartialMessage=sseResponse.Deserialize<MessageResponse>(ssEvent,client);if(message==null){message=partialMessage;}else{message.AppendFrom(partialMessage);}481 streamEventHandler?.Invoke(partialMessage);return;
Line 481 originally contains: streamEventHandler?.Invoke(message); where message does not contain the actual delta.
Changing it to streamEventHandler?.Invoke(partialMessage); will pass the message event that does contain the delta.
Next, I can print the delta's in my test project like this:
Running the test project will show the familiar chat-gpt delta streaming I was trying to accomplish.
I know this is a quick hack and I can't oversee all consequences of this change, but the way it works would be good enough for me.
The text was updated successfully, but these errors were encountered:
Discussed in #327
Originally posted by @rkuiper1 June 16, 2024
Today I was lucky enough to have a decent internet connection and I took a look at your streaming implementation.
I focused on ThreadsEndpoint.cs and in particular the StreamRunAsync method.
There I found that all the delta's are neatly received and processed, but not passed to the streamEventHandler, which explains the empty content we see in our logfiles.
This tiny tweak made the difference:
Line 481 originally contains:
streamEventHandler?.Invoke(message);
wheremessage
does not contain the actual delta.Changing it to
streamEventHandler?.Invoke(partialMessage);
will pass the message event that does contain the delta.Next, I can print the delta's in my test project like this:
Running the test project will show the familiar chat-gpt delta streaming I was trying to accomplish.
I know this is a quick hack and I can't oversee all consequences of this change, but the way it works would be good enough for me.
The text was updated successfully, but these errors were encountered: