-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for ComfyUI #254
Conversation
src/index.ts
Outdated
@@ -453,6 +526,31 @@ export function apply(ctx: Context, config: Config) { | |||
const b64 = Buffer.from(imgRes.data).toString('base64') | |||
return forceDataPrefix(b64, imgRes.headers.get('content-type')) | |||
} | |||
if (config.type === 'comfyui') { | |||
//get filenames from history |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//get filenames from history | |
// get filenames from history |
下面也改一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类似的地方已修改
src/index.ts
Outdated
await sleep(config.pollInterval) | ||
} | ||
//get images by filename | ||
const imagesOutput: Buffer[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const imagesOutput: Buffer[] = []; | |
const imagesOutput: Buffer[] = [] |
附近还有几个分号,你处理一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类似的地方已修改
src/index.ts
Outdated
const workflowImage2Image = config.workflowImage2Image ? resolve(ctx.baseDir, config.workflowImage2Image) : '../data/default-comfyui-i2i-wf.json' | ||
const workflow = image ? workflowImage2Image : workflowText2Image | ||
logger.debug('workflow:', workflow) | ||
const prompt= require(workflow) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你都改 async 了这里不要 require 比较好。
const prompt= require(workflow) | |
const prompt = JSON.parse(await readFile(workflow, 'utf8')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit 66bdd52
为readFile修改了一下路径的获取
Co-authored-by: Shigma <[email protected]>
Co-authored-by: Shigma <[email protected]>
已使用当前的branch重新对comfyui测试,可以正常使用 |
src/index.ts
Outdated
} | ||
} | ||
// return first image | ||
return forceDataPrefix(Buffer.from(imagesOutput[0]).toString('base64')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MIME 类型是否固定为 image/png
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实返回的图片类型是不固定的,修改了一下
Co-authored-by: idranme <[email protected]>
功能
杂谈
ComfyUI: 2052[55f37b](2024-03-07)