Skip to content

Commit 08a08b7

Browse files
committed
edge-case patch
1 parent 62cf8f5 commit 08a08b7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/BuiltinExtensions/ComfyUIBackend/ComfyUIAPIAbstractBackend.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ async Task doInterruptNow()
359359
if (output is not null)
360360
{
361361
user_input.ReceiveRawBackendData?.Invoke("comfy_websocket", output);
362-
if (Encoding.ASCII.GetString(output, 0, 8) == "{\"type\":")
362+
string firstChunk = Encoding.ASCII.GetString(output, 0, 8);
363+
if (firstChunk == "{\"type\":" || firstChunk == "{ \"type\"")
363364
{
364365
JObject json = Utilities.ParseToJson(Encoding.UTF8.GetString(output));
365366
if (Logs.MinimumLevel <= Logs.LogLevel.Verbose)

src/BuiltinExtensions/ComfyUIBackend/ComfyUser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ public void RunClientReceiveTask()
153153
return;
154154
}
155155
// TODO: This is hacky message type detection. Maybe backend should actually pay attention to this properly?
156-
if (Encoding.ASCII.GetString(data, 0, 8) == "{\"type\":")
156+
string firstChunk = Encoding.ASCII.GetString(data, 0, 8);
157+
if (firstChunk == "{\"type\":" || firstChunk == "{ \"type\"")
157158
{
158159
JObject jmessage = StringConversionHelper.UTF8Encoding.GetString(data).ParseToJson();
159160
string jtype = $"{jmessage["type"]}";

0 commit comments

Comments
 (0)