mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 06:19:58 +00:00
Optimize model library (#1739)
* Adapt experiment models api * Add model preview
This commit is contained in:
@@ -481,8 +481,8 @@ export class ComfyApi extends EventTarget {
|
||||
* Gets a list of model folder keys (eg ['checkpoints', 'loras', ...])
|
||||
* @returns The list of model folder keys
|
||||
*/
|
||||
async getModelFolders(): Promise<string[]> {
|
||||
const res = await this.fetchApi(`/models`)
|
||||
async getModelFolders(): Promise<{ name: string; folders: string[] }[]> {
|
||||
const res = await this.fetchApi(`/experiment/models`)
|
||||
if (res.status === 404) {
|
||||
return []
|
||||
}
|
||||
@@ -497,8 +497,10 @@ export class ComfyApi extends EventTarget {
|
||||
* @param {string} folder The folder to list models from, such as 'checkpoints'
|
||||
* @returns The list of model filenames within the specified folder
|
||||
*/
|
||||
async getModels(folder: string): Promise<string[]> {
|
||||
const res = await this.fetchApi(`/models/${folder}`)
|
||||
async getModels(
|
||||
folder: string
|
||||
): Promise<{ name: string; pathIndex: number }[]> {
|
||||
const res = await this.fetchApi(`/experiment/models/${folder}`)
|
||||
if (res.status === 404) {
|
||||
return []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user