Skip to content

Commit

Permalink
Updated: ‘Reload Custom Script’ button now uses latest object_Info fr…
Browse files Browse the repository at this point in the history
…om Comfy API
  • Loading branch information
AbdullahAlfaraj committed Nov 29, 2023
1 parent ddde1b3 commit 2ebd9e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions typescripts/comfyui/comfyapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ComfyAPI {
}
async init() {
try {
this.object_info = await this.getObjectInfo(this.comfy_url)
this.object_info = await this.initializeObjectInfo(this.comfy_url)
this.status = true
return this.object_info
} catch (e) {
Expand All @@ -41,7 +41,7 @@ class ComfyAPI {
this.comfy_url = comfy_url
}
async refresh() {
this.object_info = await this.getObjectInfo(this.comfy_url)
this.object_info = await this.initializeObjectInfo(this.comfy_url)
}
async queue() {
const res = await requestGet(`${this.comfy_url}/queue`)
Expand Down Expand Up @@ -82,7 +82,7 @@ class ComfyAPI {
return Buffer.from(ab).toString('base64')
}

async getObjectInfo(comfy_url: string) {
async initializeObjectInfo(comfy_url: string) {
try {
const full_url = `${comfy_url}/object_info`
const object_info = await requestGet(full_url)
Expand All @@ -94,6 +94,14 @@ class ComfyAPI {
throw e
}
}
getObjectInfo() {
try {
return this.object_info
} catch (e) {
console.error(e)
throw e
}
}
getReadableError(result: ComfyResult): string {
const parseError = (error: any) =>
`Error: ${error.message}\n${
Expand Down
2 changes: 2 additions & 0 deletions typescripts/comfyui/comfyui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,8 @@ class ComfyWorkflowComponent extends React.Component<{}, { value?: number }> {
className="btnSquare refreshButton btnResetSettings"
title="reload the current workflow"
onClick={async () => {
store.data.object_info =
comfyapi.comfy_api.getObjectInfo()
loadWorkflow2(
store.data.workflows2[
store.data.selected_workflow_name
Expand Down

0 comments on commit 2ebd9e4

Please sign in to comment.