2025-12-22 16:20:26 +08:00

49 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XPrintServer.Business.Workflows.Configure;
namespace XPrintServer.Business.Workflows
{
public class Workflow
{
protected string workflowFolder = string.Empty;
protected string workflowPath = string.Empty;
public static string SaveTempPath = string.Empty;
public static string InputTempPath = string.Empty;
protected HttpClient? httpClient;
public static string apiUrl = string.Empty;
public static string apiBaseUrl = "http://127.0.0.1:8188";
protected string workflowJson { get; set; } = string.Empty;
protected static readonly string client_id = Guid.NewGuid().ToString("N");
public Workflow(ComfyUIInfos infos)
{
this.workflowFolder = infos.Workflow.WorkflowFolder;
Workflow.InputTempPath = infos.InputPath;
Workflow.SaveTempPath = infos.SaveTempPath;
Workflow.apiBaseUrl = infos.ApiBaseUrl;
httpClient = new HttpClient();
apiUrl = $"{apiBaseUrl}/prompt";
}
protected void CheckWorkFlow()
{
//if (newPath != _createImageworkflowPath || string.IsNullOrWhiteSpace(workflowJson))
//{
// _createImageworkflowPath = newPath;
// // 1. 加载工作流JSON文件
// workflowJson = File.ReadAllText(_createImageworkflowPath);
//}
if (string.IsNullOrWhiteSpace(workflowJson) && !string.IsNullOrWhiteSpace(workflowPath))
{
workflowJson = File.ReadAllText(workflowPath);
}
}
}
}