@@ -42,6 +42,32 @@ IPrerequisiteHelper prerequisiteHelper
4242 [ SharedFolderMethod . Symlink , SharedFolderMethod . Configuration , SharedFolderMethod . None ] ;
4343 public override SharedFolderMethod RecommendedSharedFolderMethod => SharedFolderMethod . Configuration ;
4444 public override bool OfferInOneClickInstaller => false ;
45+ public override bool UsesVenv => false ;
46+
47+ public override List < ExtraPackageCommand > GetExtraCommands ( ) =>
48+ [
49+ new ( )
50+ {
51+ CommandName = "Rebuild .NET Project" ,
52+ Command = async installedPackage =>
53+ {
54+ if ( installedPackage == null || string . IsNullOrEmpty ( installedPackage . FullPath ) )
55+ {
56+ throw new InvalidOperationException ( "Package not found or not installed correctly" ) ;
57+ }
58+
59+ var srcFolder = Path . Combine ( installedPackage . FullPath , "src" ) ;
60+ var csprojName = "StableSwarmUI.csproj" ;
61+ if ( File . Exists ( Path . Combine ( srcFolder , "SwarmUI.csproj" ) ) )
62+ {
63+ csprojName = "SwarmUI.csproj" ;
64+ }
65+
66+ await RebuildDotnetProject ( installedPackage . FullPath , csprojName , null )
67+ . ConfigureAwait ( false ) ;
68+ }
69+ }
70+ ] ;
4571
4672 public override List < LaunchOptionDefinition > LaunchOptions =>
4773 [
@@ -135,7 +161,7 @@ public override async Task InstallPackage(
135161 progress ? . Report ( new ProgressReport ( - 1f , "Installing SwarmUI..." , isIndeterminate : true ) ) ;
136162
137163 var comfy = settingsManager . Settings . InstalledPackages . FirstOrDefault (
138- x => x . PackageName == nameof ( ComfyUI )
164+ x => x . PackageName is nameof ( ComfyUI ) or "ComfyUI-Zluda"
139165 ) ;
140166
141167 if ( comfy == null )
@@ -233,16 +259,45 @@ await prerequisiteHelper
233259 . Where ( arg => ! string . IsNullOrWhiteSpace ( arg ) )
234260 ) ;
235261
236- dataSection . Set (
237- "settings" ,
238- new ComfyUiSelfStartSettings
239- {
240- StartScript = $ "../{ comfy . DisplayName } /main.py",
241- DisableInternalArgs = false ,
242- AutoUpdate = false ,
243- ExtraArgs = comfyArgs
244- } . Save ( true )
245- ) ;
262+ if ( comfy . PackageName == "ComfyUI-Zluda" )
263+ {
264+ var fullComfyZludaPath = Path . Combine ( SettingsManager . LibraryDir , comfy . LibraryPath ) ;
265+ var zludaPath = Path . Combine ( fullComfyZludaPath , "zluda" , "zluda.exe" ) ;
266+ var comfyVenvPath = Path . Combine (
267+ fullComfyZludaPath ,
268+ "venv" ,
269+ Compat . Switch (
270+ ( PlatformKind . Windows , Path . Combine ( "Scripts" , "python.exe" ) ) ,
271+ ( PlatformKind . Unix , Path . Combine ( "bin" , "python3" ) )
272+ )
273+ ) ;
274+
275+ ProcessArgs args = [ "--" , comfyVenvPath , "main.py" , comfyArgs ] ;
276+
277+ dataSection . Set (
278+ "settings" ,
279+ new ComfyUiSelfStartSettings
280+ {
281+ StartScript = zludaPath ,
282+ DisableInternalArgs = false ,
283+ AutoUpdate = false ,
284+ ExtraArgs = args
285+ } . Save ( true )
286+ ) ;
287+ }
288+ else
289+ {
290+ dataSection . Set (
291+ "settings" ,
292+ new ComfyUiSelfStartSettings
293+ {
294+ StartScript = $ "../{ comfy . DisplayName } /main.py",
295+ DisableInternalArgs = false ,
296+ AutoUpdate = false ,
297+ ExtraArgs = comfyArgs
298+ } . Save ( true )
299+ ) ;
300+ }
246301
247302 backendsFile . Set ( "0" , dataSection ) ;
248303 backendsFile . SaveToFile ( GetBackendsPath ( installLocation ) ) ;
@@ -385,6 +440,29 @@ await dotnetProcess
385440 GC . SuppressFinalize ( this ) ;
386441 }
387442
443+ public async Task RebuildDotnetProject (
444+ string installLocation ,
445+ string csprojName ,
446+ Action < ProcessOutput > ? onConsoleOutput
447+ )
448+ {
449+ await prerequisiteHelper
450+ . RunDotnet (
451+ [
452+ "build" ,
453+ $ "src/{ csprojName } ",
454+ "--no-incremental" ,
455+ "--configuration" ,
456+ "Release" ,
457+ "-o" ,
458+ "src/bin/live_release"
459+ ] ,
460+ workingDirectory : installLocation ,
461+ onProcessOutput : onConsoleOutput
462+ )
463+ . ConfigureAwait ( false ) ;
464+ }
465+
388466 private Task SetupModelFoldersConfig ( DirectoryPath installDirectory )
389467 {
390468 var settingsPath = GetSettingsPath ( installDirectory ) ;
0 commit comments