MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / post

Method post

ui/media/js/engine.js:1058–1079  ·  view source on GitHub ↗

Send current task to server. * @param {*} [timeout=-1] Optional timeout value in ms * @returns the response from the render request. * @memberof Task

(timeout = -1)

Source from the content-addressed store, hash-verified

1056 * @memberof Task
1057 */
1058 async post(timeout = -1) {
1059 let jsonResponse = await super.post("/filter", timeout)
1060 if (typeof jsonResponse?.task !== "number") {
1061 console.warn("Endpoint error response: ", jsonResponse)
1062 const event = Object.assign({ task: this }, jsonResponse)
1063 await eventSource.fireEvent(EVENT_UNEXPECTED_RESPONSE, event)
1064 if ("continueWith" in event) {
1065 jsonResponse = await Promise.resolve(event.continueWith)
1066 }
1067 if (typeof jsonResponse?.task !== "number") {
1068 const err = new Error(jsonResponse?.detail || "Endpoint response does not contains a task ID.")
1069 this.abort(err)
1070 throw err
1071 }
1072 }
1073 this._setId(jsonResponse.task)
1074 if (jsonResponse.stream) {
1075 this.streamUrl = jsonResponse.stream
1076 }
1077 this._setStatus(TaskStatus.waiting)
1078 return jsonResponse
1079 }
1080 checkReqBody() { }
1081 enqueue(progressCallback) {
1082 return Task.enqueueNew(this, FilterTask, progressCallback)

Callers 1

startMethod · 0.95

Calls 5

fireEventMethod · 0.80
abortMethod · 0.80
_setIdMethod · 0.80
_setStatusMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected