@@ -66,8 +66,8 @@ public override List<ExtraPackageCommand> GetExtraCommands() =>
6666
6767 await RebuildDotnetProject ( installedPackage . FullPath , csprojName , null )
6868 . ConfigureAwait ( false ) ;
69- }
70- }
69+ } ,
70+ } ,
7171 ] ;
7272
7373 public override List < LaunchOptionDefinition > LaunchOptions =>
@@ -77,46 +77,46 @@ await RebuildDotnetProject(installedPackage.FullPath, csprojName, null)
7777 Name = "Host" ,
7878 Type = LaunchOptionType . String ,
7979 DefaultValue = "127.0.0.1" ,
80- Options = [ "--host" ]
80+ Options = [ "--host" ] ,
8181 } ,
8282 new LaunchOptionDefinition
8383 {
8484 Name = "Port" ,
8585 Type = LaunchOptionType . String ,
8686 DefaultValue = "7801" ,
87- Options = [ "--port" ]
87+ Options = [ "--port" ] ,
8888 } ,
8989 new LaunchOptionDefinition
9090 {
9191 Name = "Ngrok Path" ,
9292 Type = LaunchOptionType . String ,
93- Options = [ "--ngrok-path" ]
93+ Options = [ "--ngrok-path" ] ,
9494 } ,
9595 new LaunchOptionDefinition
9696 {
9797 Name = "Ngrok Basic Auth" ,
9898 Type = LaunchOptionType . String ,
99- Options = [ "--ngrok-basic-auth" ]
99+ Options = [ "--ngrok-basic-auth" ] ,
100100 } ,
101101 new LaunchOptionDefinition
102102 {
103103 Name = "Cloudflared Path" ,
104104 Type = LaunchOptionType . String ,
105- Options = [ "--cloudflared-path" ]
105+ Options = [ "--cloudflared-path" ] ,
106106 } ,
107107 new LaunchOptionDefinition
108108 {
109109 Name = "Proxy Region" ,
110110 Type = LaunchOptionType . String ,
111- Options = [ "--proxy-region" ]
111+ Options = [ "--proxy-region" ] ,
112112 } ,
113113 new LaunchOptionDefinition
114114 {
115115 Name = "Launch Mode" ,
116116 Type = LaunchOptionType . Bool ,
117- Options = [ "--launch-mode web" , "--launch-mode webinstall" ]
117+ Options = [ "--launch-mode web" , "--launch-mode webinstall" ] ,
118118 } ,
119- LaunchOptionDefinition . Extras
119+ LaunchOptionDefinition . Extras ,
120120 ] ;
121121
122122 public override SharedFolderLayout SharedFolderLayout =>
@@ -126,44 +126,50 @@ await RebuildDotnetProject(installedPackage.FullPath, csprojName, null)
126126 ConfigFileType = ConfigFileType . Fds ,
127127 Rules =
128128 [
129- new SharedFolderLayoutRule { IsRoot = true , ConfigDocumentPaths = [ "ModelRoot" ] , } ,
129+ new SharedFolderLayoutRule { IsRoot = true , ConfigDocumentPaths = [ "ModelRoot" ] } ,
130130 new SharedFolderLayoutRule
131131 {
132132 SourceTypes = [ SharedFolderType . StableDiffusion ] ,
133133 TargetRelativePaths = [ "Models/Stable-Diffusion" ] ,
134- ConfigDocumentPaths = [ "SDModelFolder" ]
134+ ConfigDocumentPaths = [ "SDModelFolder" ] ,
135135 } ,
136136 new SharedFolderLayoutRule
137137 {
138138 SourceTypes = [ SharedFolderType . Lora , SharedFolderType . LyCORIS ] ,
139139 TargetRelativePaths = [ "Models/Lora" ] ,
140- ConfigDocumentPaths = [ "SDLoraFolder" ]
140+ ConfigDocumentPaths = [ "SDLoraFolder" ] ,
141141 } ,
142142 new SharedFolderLayoutRule
143143 {
144144 SourceTypes = [ SharedFolderType . VAE ] ,
145145 TargetRelativePaths = [ "Models/VAE" ] ,
146- ConfigDocumentPaths = [ "SDVAEFolder" ]
146+ ConfigDocumentPaths = [ "SDVAEFolder" ] ,
147147 } ,
148148 new SharedFolderLayoutRule
149149 {
150150 SourceTypes = [ SharedFolderType . Embeddings ] ,
151151 TargetRelativePaths = [ "Models/Embeddings" ] ,
152- ConfigDocumentPaths = [ "SDEmbeddingFolder" ]
152+ ConfigDocumentPaths = [ "SDEmbeddingFolder" ] ,
153153 } ,
154154 new SharedFolderLayoutRule
155155 {
156156 SourceTypes = [ SharedFolderType . ControlNet , SharedFolderType . T2IAdapter ] ,
157157 TargetRelativePaths = [ "Models/controlnet" ] ,
158- ConfigDocumentPaths = [ "SDControlNetsFolder" ]
158+ ConfigDocumentPaths = [ "SDControlNetsFolder" ] ,
159159 } , // Assuming Swarm maps T2I to ControlNet folder
160160 new SharedFolderLayoutRule
161161 {
162162 SourceTypes = [ SharedFolderType . ClipVision ] ,
163163 TargetRelativePaths = [ "Models/clip_vision" ] ,
164- ConfigDocumentPaths = [ "SDClipVisionFolder" ]
164+ ConfigDocumentPaths = [ "SDClipVisionFolder" ] ,
165+ } ,
166+ new SharedFolderLayoutRule
167+ {
168+ SourceTypes = [ SharedFolderType . TextEncoders ] ,
169+ TargetRelativePaths = [ "Models/clip" ] ,
170+ ConfigDocumentPaths = [ "SDClipFolder" ] ,
165171 } ,
166- ]
172+ ] ,
167173 } ;
168174
169175 public override Dictionary < SharedOutputType , IReadOnlyList < string > > SharedOutputFolders =>
@@ -178,7 +184,7 @@ await RebuildDotnetProject(installedPackage.FullPath, csprojName, null)
178184 PackagePrerequisite . Git ,
179185 PackagePrerequisite . Dotnet ,
180186 PackagePrerequisite . Python310 ,
181- PackagePrerequisite . VcRedist
187+ PackagePrerequisite . VcRedist ,
182188 ] ;
183189
184190 private FilePath GetSettingsPath ( string installLocation ) =>
@@ -198,8 +204,8 @@ public override async Task InstallPackage(
198204 {
199205 progress ? . Report ( new ProgressReport ( - 1f , "Installing SwarmUI..." , isIndeterminate : true ) ) ;
200206
201- var comfy = settingsManager . Settings . InstalledPackages . FirstOrDefault (
202- x => x . PackageName is nameof ( ComfyUI ) or "ComfyUI-Zluda"
207+ var comfy = settingsManager . Settings . InstalledPackages . FirstOrDefault ( x =>
208+ x . PackageName is nameof ( ComfyUI ) or "ComfyUI-Zluda"
203209 ) ;
204210
205211 if ( comfy == null )
@@ -217,7 +223,7 @@ await prerequisiteHelper
217223 "source" ,
218224 "https://api.nuget.org/v3/index.json" ,
219225 "--name" ,
220- "\" NuGet official package source\" "
226+ "\" NuGet official package source\" " ,
221227 ] ,
222228 workingDirectory : installLocation ,
223229 onProcessOutput : onConsoleOutput
@@ -277,7 +283,7 @@ await prerequisiteHelper
277283 SDClipVisionFolder = Path . Combine (
278284 settingsManager . ModelsDirectory ,
279285 SharedFolderType . ClipVision . ToString ( )
280- )
286+ ) ,
281287 } ;
282288 }
283289
@@ -315,9 +321,9 @@ await prerequisiteHelper
315321 // Create a wrapper batch file that runs zluda.exe
316322 var wrapperScriptPath = Path . Combine ( installLocation , "Data" , "zluda_wrapper.bat" ) ;
317323 var scriptContent = $ """
318- @echo off
319- "{ zludaPath } " { args }
320- """ ;
324+ @echo off
325+ "{ zludaPath } " { args }
326+ """ ;
321327
322328 // Ensure the Data directory exists
323329 Directory . CreateDirectory ( Path . Combine ( installLocation , "Data" ) ) ;
@@ -334,7 +340,7 @@ await File.WriteAllTextAsync(wrapperScriptPath, scriptContent, cancellationToken
334340 DisableInternalArgs = false ,
335341 AutoUpdate = false ,
336342 UpdateManagedNodes = "true" ,
337- ExtraArgs = string . Empty // Arguments are already in the batch file
343+ ExtraArgs = string . Empty , // Arguments are already in the batch file
338344 } . Save ( true )
339345 ) ;
340346 }
@@ -348,7 +354,7 @@ await File.WriteAllTextAsync(wrapperScriptPath, scriptContent, cancellationToken
348354 DisableInternalArgs = false ,
349355 AutoUpdate = false ,
350356 UpdateManagedNodes = "true" ,
351- ExtraArgs = comfyArgs
357+ ExtraArgs = comfyArgs ,
352358 } . Save ( true )
353359 ) ;
354360 }
@@ -371,7 +377,7 @@ public override async Task RunPackage(
371377 {
372378 [ "ASPNETCORE_ENVIRONMENT" ] = "Production" ,
373379 [ "ASPNETCORE_URLS" ] = "http://*:7801" ,
374- [ "GIT" ] = portableGitBin . JoinFile ( "git.exe" )
380+ [ "GIT" ] = portableGitBin . JoinFile ( "git.exe" ) ,
375381 } ;
376382 aspEnvVars . Update ( settingsManager . Settings . EnvironmentVariables ) ;
377383
@@ -400,6 +406,30 @@ void HandleConsoleOutput(ProcessOutput s)
400406 }
401407 }
402408
409+ var sharedDiffusionModelsPath = new DirectoryPath (
410+ settingsManager . ModelsDirectory ,
411+ nameof ( SharedFolderType . DiffusionModels )
412+ ) ;
413+ var swarmDiffusionModelsPath = new DirectoryPath ( settingsManager . ModelsDirectory , "diffusion_models" ) ;
414+
415+ try
416+ {
417+ swarmDiffusionModelsPath . Create ( ) ;
418+ await Helper
419+ . SharedFolders . CreateOrUpdateLink ( sharedDiffusionModelsPath , swarmDiffusionModelsPath )
420+ . ConfigureAwait ( false ) ;
421+ }
422+ catch ( Exception e )
423+ {
424+ onConsoleOutput ? . Invoke (
425+ new ProcessOutput
426+ {
427+ Text =
428+ $ "Failed to create symlink for { nameof ( SharedFolderType . DiffusionModels ) } : { e . Message } .",
429+ }
430+ ) ;
431+ }
432+
403433 var releaseFolder = Path . Combine ( installLocation , "src" , "bin" , "live_release" ) ;
404434 var dllName = "StableSwarmUI.dll" ;
405435 if ( File . Exists ( Path . Combine ( releaseFolder , "SwarmUI.dll" ) ) )
@@ -409,7 +439,7 @@ void HandleConsoleOutput(ProcessOutput s)
409439
410440 dotnetProcess = await prerequisiteHelper
411441 . RunDotnet (
412- args : [ Path . Combine ( releaseFolder , dllName ) , ..options . Arguments ] ,
442+ args : [ Path . Combine ( releaseFolder , dllName ) , .. options . Arguments ] ,
413443 workingDirectory : installLocation ,
414444 envVars : aspEnvVars ,
415445 onProcessOutput : HandleConsoleOutput ,
@@ -509,7 +539,7 @@ await prerequisiteHelper
509539 "--configuration" ,
510540 "Release" ,
511541 "-o" ,
512- "src/bin/live_release"
542+ "src/bin/live_release" ,
513543 ] ,
514544 workingDirectory : installLocation ,
515545 onProcessOutput : onConsoleOutput
@@ -576,7 +606,7 @@ private Task SetupModelFoldersConfig(DirectoryPath installDirectory)
576606 SDClipVisionFolder = Path . Combine (
577607 settingsManager . ModelsDirectory ,
578608 SharedFolderType . ClipVision . ToString ( )
579- )
609+ ) ,
580610 } ;
581611
582612 existingSettings . Save ( true ) . SaveToFile ( settingsPath ) ;
0 commit comments