Skip to content

Allow the prompt request to specify the prompt ID. #8189

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FeepingCreature
Copy link
Contributor

@FeepingCreature FeepingCreature commented May 18, 2025

This makes it easier to write asynchronous clients that submit requests, because they can store the task by id immediately rather than waiting for the prompt api to return.

Specifically I want it so that Krita AI Diffusion can stop fetching the prompt id async, because I suspect it's causing a timing issue.

@FeepingCreature
Copy link
Contributor Author

Should I change the API demo to generate a uuid on the client side?

@christian-byrne
Copy link
Collaborator

Good change. Maybe there can be an example/comment/line added here https://github.com/comfyanonymous/ComfyUI/blob/master/script_examples/basic_api_example.py since there is no api spec for the webserver yet.

This makes it easier to write asynchronous clients that submit requests, because they can store the task immediately.
@FeepingCreature
Copy link
Contributor Author

Added an example to the websocket api test, because the simple api test doesn't do anything with the response.

@comfyanonymous
Copy link
Owner

This is fine but you need to add a check to see if the prompt id is already used if it is specified and return an appropriate error.

@FeepingCreature
Copy link
Contributor Author

Okay so I can do that but it's gonna be ugly. Because of the PromptQueue mutex, the only place to check that is in PromptQueue.put, otherwise there's always a chance of timing errors. But right now put doesn't even know what a prompt_id is. If there's a trivial way to do it I don't see it. I'd just trust the client to rng correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants