Rework userFileStore (#815)

* Rework userFileStore

* nit

* Add back unittests
This commit is contained in:
Chenlei Hu
2024-09-13 17:40:08 +09:00
committed by GitHub
parent 65a8dbb7e0
commit 17db1e6074
4 changed files with 259 additions and 288 deletions

View File

@@ -11,7 +11,8 @@ import {
PromptResponse,
SystemStats,
User,
Settings
Settings,
UserDataFullInfo
} from '@/types/apiTypes'
import axios from 'axios'
@@ -671,6 +672,19 @@ class ComfyApi extends EventTarget {
return resp.json()
}
async listUserDataFullInfo(dir: string): Promise<UserDataFullInfo[]> {
const resp = await this.fetchApi(
`/userdata?dir=${encodeURIComponent(dir)}&recurse=true&split=false&full_info=true`
)
if (resp.status === 404) return []
if (resp.status !== 200) {
throw new Error(
`Error getting user data list '${dir}': ${resp.status} ${resp.statusText}`
)
}
return resp.json()
}
async getLogs(): Promise<string> {
return (await axios.get(this.internalURL('/logs'))).data
}