fix: Prevent multiple error prompts when ComfyUI is unavailable
parent
cf70efaf44
commit
7e7479f554
|
|
@ -26,15 +26,17 @@ class ComfyAPI {
|
|||
constructor(comfy_url: string) {
|
||||
this.comfy_url = comfy_url
|
||||
}
|
||||
async init() {
|
||||
async init(display_error = false) {
|
||||
try {
|
||||
this.object_info = await this.initializeObjectInfo(this.comfy_url)
|
||||
this.status = true
|
||||
return this.object_info
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
app.showAlert(`${e}`)
|
||||
this.status = false
|
||||
if (display_error) {
|
||||
app.showAlert(`${e}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
setUrl(comfy_url: string) {
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class SDTab extends React.Component<{}> {
|
|||
id="btnRefreshModels"
|
||||
// style={styles.button}
|
||||
onClick={async (e) => {
|
||||
await refreshUI()
|
||||
await refreshUI(true)
|
||||
|
||||
tempDisableElement(e.target, 3000)
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ export function loadNativePreset() {
|
|||
console.log(json_container)
|
||||
return json_container
|
||||
}
|
||||
export async function refreshUI() {
|
||||
export async function refreshUI(display_error = false) {
|
||||
try {
|
||||
const b_proxy_server_status = await updateVersionUI()
|
||||
if (b_proxy_server_status) {
|
||||
|
|
@ -410,7 +410,7 @@ export async function refreshUI() {
|
|||
}
|
||||
|
||||
if (settings_tab_ts.store.data.selected_backend === 'ComfyUI') {
|
||||
await comfyapi.comfy_api.init()
|
||||
await comfyapi.comfy_api.init(display_error)
|
||||
|
||||
helper_store.data.models = comfyapi.comfy_api.getModels()
|
||||
store.data.selected_model = helper_store.data.models?.[0]
|
||||
|
|
|
|||
Loading…
Reference in New Issue