* Client to Send requests to Comflowy Console
| 5 | * Client to Send requests to Comflowy Console |
| 6 | */ |
| 7 | class ComflowyConsoleClient { |
| 8 | async comfyuiExecuteError(workflowInfo: { |
| 9 | id: string, |
| 10 | }, runErrors: ComfyUIExecuteError) { |
| 11 | try { |
| 12 | await fetch(getBackendUrl('/api/console/comfyui-execute'), { |
| 13 | method: 'POST', |
| 14 | headers: { |
| 15 | 'Content-Type': 'application/json' |
| 16 | }, |
| 17 | body: JSON.stringify({ |
| 18 | workflowInfo, |
| 19 | runErrors |
| 20 | }) |
| 21 | }) |
| 22 | } catch(err) { |
| 23 | console.log(err); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | async log(message: string, data: any) { |
| 28 | try { |
| 29 | fetch(getBackendUrl('/api/console/log'), { |
| 30 | method: 'POST', |
| 31 | headers: { |
| 32 | 'Content-Type': 'application/json' |
| 33 | }, |
| 34 | body: JSON.stringify({ |
| 35 | message, |
| 36 | data |
| 37 | }) |
| 38 | }) |
| 39 | } catch(err) { |
| 40 | console.log(err); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | async markLogAsRead(logId: string) { |
| 45 | try { |
| 46 | fetch(getBackendUrl('/api/console/log/read'), { |
| 47 | method: 'POST', |
| 48 | headers: { |
| 49 | 'Content-Type': 'application/json' |
| 50 | }, |
| 51 | body: JSON.stringify({ |
| 52 | logId, |
| 53 | }) |
| 54 | }) |
| 55 | } catch (err) { |
| 56 | console.log(err); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | export const comflowyConsoleClient = new ComflowyConsoleClient(); |
| 62 |
nothing calls this directly
no outgoing calls
no test coverage detected