mrhan1993 / Fooocus-API

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

history can store in db #156

Closed mrhan1993 closed 9 months ago

mrhan1993 commented 9 months ago

support sqlite3 mysql8 and redis a new interface to query those data

mrhan1993 commented 9 months ago

@konieshadow 测一下

bsormagec commented 9 months ago

i think this is unnecessary dependency, if you wanna use that just add sqlite and pass it. We already have a webhook feature you can keep the history on a remote location using webhook too.

mrhan1993 commented 9 months ago

@bsormagec I've been thinking about this feature for a long time. It originated from https://github.com/konieshadow/Fooocus-API/issues/92 , and when I tried to solve the problem of out-of-sync among pod tasks in K8s, I found that persistent storage was indeed an effective method. But as you said, I've always had doubts about its usefulness. I don't think most of the scenarios are useful, and I still think so. Therefore, whether to merge or not is worth discussing.

bsormagec commented 9 months ago

@bsormagec I've been thinking about this feature for a long time. It originated from #92 , and when I tried to solve the problem of out-of-sync among pod tasks in K8s, I found that persistent storage was indeed an effective method. But as you said, I've always had doubts about its usefulness. I don't think most of the scenarios are useful, and I still think so. Therefore, whether to merge or not is worth discussing.

"You are absolutely right. I just mentioned my idea here, but I am not a decision-maker. If dependencies are added to the project, it can become more troublesome very quickly. I am sharing my past experience. A database would be good for this purpose, but in Kubernetes, you can handle it with a simple internal microservice with a Redis cluster. However, if you make them a requirement for that app, you will have to implement more and more adapters in a short amount of time."

aiwillcoming commented 9 months ago

那做成一个插件吧

mrhan1993 commented 9 months ago

@aiwillcoming 你说的就更复杂了,目前这个项目都没有插件系统这种东西。顶多有个选项加个开关

konieshadow commented 9 months ago

There is no perfect solution to this problem in the current architecture. My personal preference is to only provide optional sqlite as a local persistence alternative. Add an optional db path to the command line parameter. If passed, install sqlite's pip dependency.

Additionally, I've been wanting to create another project to achieve true production availability of the Fooocus API. Including multi-instance task scheduling, object storage, container and instance management and other functions.

konieshadow commented 9 months ago

If you are interested in the new project I described, we can have a more in-depth discussion, such as forming a group or something.

mrhan1993 commented 9 months ago

There is no perfect solution to this problem in the current architecture. My personal preference is to only provide optional sqlite as a local persistence alternative. Add an optional db path to the command line parameter. If passed, install sqlite's pip dependency.

Additionally, I've been wanting to create another project to achieve true production availability of the Fooocus API. Including multi-instance task scheduling, object storage, container and instance management and other functions.

A good compromise. I will close this pr and do some change

aiwillcoming commented 9 months ago

sqlite 是python内置的

konieshadow commented 9 months ago

sqlite 是python内置的

神奇的语言。