[Refactor] Rework userFileStore to match existing API on ComfyWorkflow (#1394)

* nit

* Move load

* nit

* nit

* Update store API

* nit

* nit

* Move api

* nit

* Update tests

* Add docs

* Add temp user file

* Implement save as

* Test saveAs
This commit is contained in:
Chenlei Hu
2024-10-31 21:58:00 -04:00
committed by GitHub
parent 2974b9257a
commit dfb695be72
3 changed files with 275 additions and 131 deletions

View File

@@ -602,10 +602,16 @@ class ComfyApi extends EventTarget {
overwrite?: boolean
stringify?: boolean
throwOnError?: boolean
} = { overwrite: true, stringify: true, throwOnError: true }
full_info?: boolean
} = {
overwrite: true,
stringify: true,
throwOnError: true,
full_info: false
}
): Promise<Response> {
const resp = await this.fetchApi(
`/userdata/${encodeURIComponent(file)}?overwrite=${options.overwrite}`,
`/userdata/${encodeURIComponent(file)}?overwrite=${options.overwrite}&full_info=${options.full_info}`,
{
method: 'POST',
body: options?.stringify ? JSON.stringify(data) : data,