File tree 2 files changed +14
-1
lines changed
AiServer.ServiceInterface
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,20 @@ public MediaProvider AssertComfyProvider(string name) => ComfyProviders.FirstOrD
47
47
. Where ( x => x . MediaType . Provider == AiServiceProvider . Comfy )
48
48
. ToArray ( ) ;
49
49
50
- string ? ReadTextFile ( string path )
50
+ public string ? ReadTextFile ( string path )
51
51
{
52
52
var fullPath = Path . Combine ( env . ContentRootPath , path ) ;
53
53
return File . Exists ( fullPath )
54
54
? File . ReadAllText ( fullPath )
55
55
: null ;
56
56
}
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
+ }
57
64
58
65
T [ ] LoadModels < T > ( string name ) where T : IHasId < string >
59
66
{
Original file line number Diff line number Diff line change @@ -198,6 +198,12 @@ public async Task<ComfyWorkflowResponse> PromptGenerationAsync(ComfyWorkflowRequ
198
198
}
199
199
200
200
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
+
201
207
// Convert to ComfyUI API JSON format
202
208
var apiJson = await ConvertWorkflowToApiAsync ( workflowJson , token ) ;
203
209
You can’t perform that action at this time.
0 commit comments