Files

21 lines
1.4 KiB
Python

from pathlib import Path
p=Path('/swarm/src/BuiltinExtensions/ComfyUIBackend/WorkflowGeneratorModelSupport.cs');s=p.read_text()
old=''' string loaderType = "CLIPLoader";
if (model.EndsWith(".gguf"))'''
new=''' if (type == "ltxv")
{
string deckLoader = g.CreateNode("DeckLTXTextEncoderLoader", new JObject() { ["clip_name"] = model });
g.LoadingClip = [deckLoader, 0];
return;
}
string loaderType = "CLIPLoader";
if (model.EndsWith(".gguf"))'''
assert old in s;s=s.replace(old,new).replace('"gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot-v2.safetensors"','"gemma4-12b-with-proj-ltx-2.5-bf16.safetensors"');p.write_text(s)
p=Path('/swarm/src/BuiltinExtensions/ComfyUIBackend/ComfyUIAPIAbstractBackend.cs');s=p.read_text()
old='return await NetworkBackendUtils.Parse<JType>(await HttpClient.GetAsync($"{APIAddress}/{url}", token));'
new='return await NetworkBackendUtils.Parse<JType>((await HttpClient.GetAsync($"{APIAddress}/{url}", token)).EnsureSuccessStatusCode());'
assert old in s;s=s.replace(old,new)
old='SendGet<JObject>("features", cancel.Token).Wait();'
new='SendGet<JObject>("features", cancel.Token).GetAwaiter().GetResult(); if (RawObjectInfo is null) { LoadValueSet().GetAwaiter().GetResult(); }'
assert old in s;s=s.replace(old,new);p.write_text(s)