[fix] assets service review nits (#5444)

* [fix] assets service review nits

* [fix] lint
This commit is contained in:
Arjan Singh
2025-09-09 17:00:23 -07:00
committed by GitHub
parent 9997053290
commit 7d4437c724
8 changed files with 92 additions and 95 deletions

View File

@@ -30,6 +30,7 @@ import type {
User,
UserDataFullInfo
} from '@/schemas/apiSchema'
import type { ModelFile, ModelFolderInfo } from '@/schemas/assetSchema'
import type {
ComfyApiWorkflow,
ComfyWorkflowJSON,
@@ -675,15 +676,14 @@ 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<{ name: string; folders: string[] }[]> {
async getModelFolders(): Promise<ModelFolderInfo[]> {
const res = await this.fetchApi(`/experiment/models`)
if (res.status === 404) {
return []
}
const folderBlacklist = ['configs', 'custom_nodes']
return (await res.json()).filter(
(folder: { name: string; folders: string[] }) =>
!folderBlacklist.includes(folder.name)
(folder: ModelFolderInfo) => !folderBlacklist.includes(folder.name)
)
}
@@ -692,9 +692,7 @@ 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<{ name: string; pathIndex: number }[]> {
async getModels(folder: string): Promise<ModelFile[]> {
const res = await this.fetchApi(`/experiment/models/${folder}`)
if (res.status === 404) {
return []