langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
36.58k stars 4.95k forks source link

Improve Configuration Usage Experience #5937

Open laipz8200 opened 4 days ago

laipz8200 commented 4 days ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Currently, we have implemented a configuration based on Pydantic. However, we read the configuration through Flask.config or environment variables, which prevents us from utilizing Pydantic’s type system.

I have the following refactoring plan:

  1. Create a singleton DifyConfig
  2. Use this singleton to replace all logic that currently retrieves values from current_app.config and environment variables
  3. Modify any existing mock cases that might be affected

2. Additional context or comments

No response

3. Can you help us with this feature?

laipz8200 commented 4 days ago

Since this refactoring involves a lot of code, we hope to complete it in multiple stages. If you're interested in helping us with this task, please leave a message here.🙏

Refactoring isn't too difficult, and even those who are not yet familiar with Dify can join in. If you're unsure about how to proceed, you can refer to #5938.

Don't be shy, come and get involved!

Current progress

Poorandy commented 2 days ago

I'm in. Just let me know if there's anything I can do.

laipz8200 commented 5 hours ago

Hi @Poorandy! Thank you for your response. Could you please check the directories api/models, api/core/tools, and api/core/workflow? Please modify the parts where current_app.config is used.

You need to read our Contribution Guide first. Once you are done, please open a pull request and refer to this issue.