mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
508 stars 135 forks source link

Running with --persistent flag throws error when saving to SQLite #232

Closed choilive closed 2 months ago

choilive commented 4 months ago

Per logs - it appears that an error is thrown after the image is generated and the record is being created.

ERROR:root:'ImageGenerationParams' object is not subscriptable Traceback (most recent call last): File "/home/user/Fooocus/Fooocus-API/fooocusapi/worker.py", line 880, in process_generate yield_result(None, results, tasks) File "/home/user/Fooocus/Fooocus-API/fooocusapi/worker.py", line 113, in yield_result worker_queue.finish_task(async_task.job_id) File "/home/user/Fooocus/Fooocus-API/fooocusapi/task_queue.py", line 155, in finish_task add_history(task.req_param, task.type, task.job_id, File "/home/user/Fooocus/Fooocus-API/fooocusapi/sql_client.py", line 194, in add_history params = req_to_dict(params["params"]) TypeError: 'ImageGenerationParams' object is not subscriptable

mrhan1993 commented 4 months ago

Can you trigger this question steadily? Please tell me how to do it if you can, it will help me to fix the problem. thank

zeason commented 3 months ago

Can you trigger this question steadily? Please tell me how to do it if you can, it will help me to fix the problem. thank

@mrhan1993 I looked into the related lines. The reason is ImageGenerationParams is not a dict, but the add_history() requires the first parameter to be dict type and has key "params", which doesn't exist in ImageGenerationParams either.

zeason commented 3 months ago

maybe this is one way to fix it https://github.com/mrhan1993/Fooocus-API/pull/271