Skip to content

Commit 728002c

Browse files
committed
Wrap WAN debug JSON dump in #if DEBUG
1 parent 387321d commit 728002c

1 file changed

Lines changed: 20 additions & 21 deletions

File tree

StabilityMatrix.Core/Inference/ComfyClient.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -333,32 +333,31 @@ public async Task<ComfyTask> QueuePromptAsync(
333333
{
334334
var request = new ComfyPromptRequest { ClientId = ClientId, Prompt = nodes };
335335

336-
// DEBUG: dump final workflow JSON
337-
try
338-
{
339-
var json = JsonSerializer.Serialize(request, jsonSerializerOptions);
336+
#if DEBUG
337+
try
338+
{
339+
var json = JsonSerializer.Serialize(request, jsonSerializerOptions);
340340

341-
var debugDir = Path.Combine(
342-
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
343-
"StabilityMatrix",
344-
"Debug"
345-
);
341+
var debugDir = Path.Combine(
342+
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
343+
"StabilityMatrix",
344+
"Debug"
345+
);
346346

347-
Directory.CreateDirectory(debugDir);
347+
Directory.CreateDirectory(debugDir);
348348

349-
var path = Path.Combine(
350-
debugDir,
351-
$"wan_workflow_debug_request.json"
352-
);
349+
var path = Path.Combine(debugDir, "wan_workflow_debug_request.json");
353350

354-
File.WriteAllText(path, json);
351+
File.WriteAllText(path, json);
352+
353+
Logger.Debug("WAN DEBUG: Dumped final request JSON to {0}", path);
354+
}
355+
catch (Exception ex)
356+
{
357+
Logger.Error(ex, "WAN DEBUG: Failed to dump final request JSON");
358+
}
359+
#endif
355360

356-
Logger.Warn("WAN DEBUG: Dumped final request JSON to {0}", path);
357-
}
358-
catch (Exception ex)
359-
{
360-
Logger.Error(ex, "WAN DEBUG: Failed to dump final request JSON");
361-
}
362361

363362
var result = await comfyApi.PostPrompt(request, cancellationToken).ConfigureAwait(false);
364363

0 commit comments

Comments
 (0)