initial download-folder-selector interface (#890)

* initial download-folder-selector interface

* use primevue select

* add a folder select visibility checkbox

* slightly reduce indirection

* fix up select box updating

* revert bad upstream changes

* cleanup

* allow localhost sourced models in ui side

(for testing purposes only basically, but does no harm in deployed envs)

* add screenshot expectations to test

* Update test expectations [skip ci]

* add testing of folder select

* fix test

* don't exclude folder selector when there's only 1

since the checkbox covers that better anyway

* oo - fix checkbox

* Update test expectations [skip ci]

* testing - don't expect screenshots :(

* experimental new test code

* toHaveClass is silly

* add // comments documenting intent of allowedSources

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Alex "mcmonkey" Goodwin
2024-09-24 16:51:30 +09:00
committed by Chenlei Hu
parent 30469a6d88
commit 35a7c81fd8
7 changed files with 139 additions and 63 deletions

View File

@@ -396,7 +396,8 @@ class ComfyApi extends EventTarget {
url: string,
model_directory: string,
model_filename: string,
progress_interval: number
progress_interval: number,
folder_path: string
): Promise<DownloadModelStatus> {
const res = await this.fetchApi('/internal/models/download', {
method: 'POST',
@@ -407,7 +408,8 @@ class ComfyApi extends EventTarget {
url,
model_directory,
model_filename,
progress_interval
progress_interval,
folder_path
})
})
return await res.json()
@@ -716,6 +718,10 @@ class ComfyApi extends EventTarget {
async getLogs(): Promise<string> {
return (await axios.get(this.internalURL('/logs'))).data
}
async getFolderPaths(): Promise<Record<string, string[]>> {
return (await axios.get(this.internalURL('/folder_paths'))).data
}
}
export const api = new ComfyApi()

View File

@@ -2189,10 +2189,11 @@ export class ComfyApp {
})
}
showMissingModelsError(missingModels) {
showMissingModelsError(missingModels, paths) {
if (useSettingStore().get('Comfy.Workflow.ShowMissingModelsWarning')) {
showMissingModelsWarning({
missingModels,
paths,
maximizable: true
})
}
@@ -2414,7 +2415,8 @@ export class ComfyApp {
this.showMissingNodesError(missingNodeTypes)
}
if (missingModels.length && showMissingModelsDialog) {
this.showMissingModelsError(missingModels)
const paths = await api.getFolderPaths()
this.showMissingModelsError(missingModels, paths)
}
await this.#invokeExtensionsAsync('afterConfigureGraph', missingNodeTypes)
requestAnimationFrame(() => {