File tree Expand file tree Collapse file tree
AiServer.ServiceInterface Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,13 +47,20 @@ public MediaProvider AssertComfyProvider(string name) => ComfyProviders.FirstOrD
4747 . Where ( x => x . MediaType . Provider == AiServiceProvider . Comfy )
4848 . ToArray ( ) ;
4949
50- string ? ReadTextFile ( string path )
50+ public string ? ReadTextFile ( string path )
5151 {
5252 var fullPath = Path . Combine ( env . ContentRootPath , path ) ;
5353 return File . Exists ( fullPath )
5454 ? File . ReadAllText ( fullPath )
5555 : null ;
5656 }
57+
58+ public void WriteTextFile ( string path , string contents )
59+ {
60+ var fullPath = Path . Combine ( env . ContentRootPath , path ) ;
61+ Path . GetDirectoryName ( fullPath ) . AssertDir ( ) ;
62+ File . WriteAllText ( fullPath , contents ) ;
63+ }
5764
5865 T [ ] LoadModels < T > ( string name ) where T : IHasId < string >
5966 {
Original file line number Diff line number Diff line change @@ -198,6 +198,12 @@ public async Task<ComfyWorkflowResponse> PromptGenerationAsync(ComfyWorkflowRequ
198198 }
199199
200200 var workflowJson = await PopulateWorkflowAsync ( workflowArgs , templatePath , token ) ;
201+
202+ if ( mediaModel != null )
203+ {
204+ AppData . Instance . WriteTextFile ( $ "App_Data/workflows/{ mediaModel . Id } .json", workflowJson ) ;
205+ }
206+
201207 // Convert to ComfyUI API JSON format
202208 var apiJson = await ConvertWorkflowToApiAsync ( workflowJson , token ) ;
203209
You can’t perform that action at this time.
0 commit comments