You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CONTRIBUTING_CN.md 9.3KB

2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. 所以你想为 Dify 做贡献 - 这太棒了,我们迫不及待地想看到你的贡献。作为一家人员和资金有限的初创公司,我们有着雄心勃勃的目标,希望设计出最直观的工作流程来构建和管理 LLM 应用程序。社区的任何帮助都是宝贵的。
  2. 考虑到我们的现状,我们需要灵活快速地交付,但我们也希望确保像你这样的贡献者在贡献过程中获得尽可能顺畅的体验。我们为此编写了这份贡献指南,旨在让你熟悉代码库和我们与贡献者的合作方式,以便你能快速进入有趣的部分。
  3. 这份指南,就像 Dify 本身一样,是一个不断改进的工作。如果有时它落后于实际项目,我们非常感谢你的理解,并欢迎任何反馈以供我们改进。
  4. 在许可方面,请花一分钟阅读我们简短的[许可证和贡献者协议](./license)。社区还遵守[行为准则](https://github.com/langgenius/.github/blob/main/CODE_OF_CONDUCT.md)。
  5. ## 在开始之前
  6. [查找](https://github.com/langgenius/dify/issues?q=is:issue+is:closed)现有问题,或[创建](https://github.com/langgenius/dify/issues/new/choose)一个新问题。我们将问题分为两类:
  7. ### 功能请求:
  8. * 如果您要提出新的功能请求,请解释所提议的功能的目标,并尽可能提供详细的上下文。[@perzeusss](https://github.com/perzeuss)制作了一个很好的[功能请求助手](https://udify.app/chat/MK2kVSnw1gakVwMX),可以帮助您起草需求。随时尝试一下。
  9. * 如果您想从现有问题中选择一个,请在其下方留下评论表示您的意愿。
  10. 相关方向的团队成员将参与其中。如果一切顺利,他们将批准您开始编码。在此之前,请不要开始工作,以免我们提出更改导致您的工作付诸东流。
  11. 根据所提议的功能所属的领域不同,您可能需要与不同的团队成员交流。以下是我们团队成员目前正在从事的各个领域的概述:
  12. | Member | Scope |
  13. | ------------------------------------------------------------ | ---------------------------------------------------- |
  14. | [@yeuoly](https://github.com/Yeuoly) | Architecting Agents |
  15. | [@jyong](https://github.com/JohnJyong) | RAG pipeline design |
  16. | [@GarfieldDai](https://github.com/GarfieldDai) | Building workflow orchestrations |
  17. | [@iamjoel](https://github.com/iamjoel) & [@zxhlyh](https://github.com/zxhlyh) | Making our frontend a breeze to use |
  18. | [@guchenhe](https://github.com/guchenhe) & [@crazywoola](https://github.com/crazywoola) | Developer experience, points of contact for anything |
  19. | [@takatost](https://github.com/takatost) | Overall product direction and architecture |
  20. How we prioritize:
  21. | Feature Type | Priority |
  22. | ------------------------------------------------------------ | --------------- |
  23. | High-Priority Features as being labeled by a team member | High Priority |
  24. | Popular feature requests from our [community feedback board](https://feedback.dify.ai/) | Medium Priority |
  25. | Non-core features and minor enhancements | Low Priority |
  26. | Valuable but not immediate | Future-Feature |
  27. ### 其他任何事情(例如bug报告、性能优化、拼写错误更正):
  28. * 立即开始编码。
  29. How we prioritize:
  30. | Issue Type | Priority |
  31. | ------------------------------------------------------------ | --------------- |
  32. | Bugs in core functions (cannot login, applications not working, security loopholes) | Critical |
  33. | Non-critical bugs, performance boosts | Medium Priority |
  34. | Minor fixes (typos, confusing but working UI) | Low Priority |
  35. ## 安装
  36. 以下是设置Dify进行开发的步骤:
  37. ### 1. Fork该仓库
  38. ### 2. 克隆仓库
  39. 从终端克隆fork的仓库:
  40. ```
  41. git clone git@github.com:<github_username>/dify.git
  42. ```
  43. ### 3. 验证依赖项
  44. Dify 依赖以下工具和库:
  45. - [Docker](https://www.docker.com/)
  46. - [Docker Compose](https://docs.docker.com/compose/install/)
  47. - [Node.js v18.x (LTS)](http://nodejs.org)
  48. - [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
  49. - [Python](https://www.python.org/) version 3.10.x
  50. ### 4. 安装
  51. Dify由后端和前端组成。通过`cd api/`导航到后端目录,然后按照[后端README](api/README.md)进行安装。在另一个终端中,通过`cd web/`导航到前端目录,然后按照[前端README](web/README.md)进行安装。
  52. 查看[安装常见问题解答](https://docs.dify.ai/getting-started/faq/install-faq)以获取常见问题列表和故障排除步骤。
  53. ### 5. 在浏览器中访问Dify
  54. 为了验证您的设置,打开浏览器并访问[http://localhost:3000](http://localhost:3000)(默认或您自定义的URL和端口)。现在您应该看到Dify正在运行。
  55. ## 开发
  56. 如果您要添加模型提供程序,请参考[此指南](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/README.md)。
  57. 如果您要向Agent或Workflow添加工具提供程序,请参考[此指南](./api/core/tools/README.md)。
  58. 为了帮助您快速了解您的贡献在哪个部分,以下是Dify后端和前端的简要注释大纲:
  59. ### 后端
  60. Dify的后端使用Python编写,使用[Flask](https://flask.palletsprojects.com/en/3.0.x/)框架。它使用[SQLAlchemy](https://www.sqlalchemy.org/)作为ORM,使用[Celery](https://docs.celeryq.dev/en/stable/getting-started/introduction.html)作为任务队列。授权逻辑通过Flask-login进行处理。
  61. ```
  62. [api/]
  63. ├── constants // Constant settings used throughout code base.
  64. ├── controllers // API route definitions and request handling logic.
  65. ├── core // Core application orchestration, model integrations, and tools.
  66. ├── docker // Docker & containerization related configurations.
  67. ├── events // Event handling and processing
  68. ├── extensions // Extensions with 3rd party frameworks/platforms.
  69. ├── fields // field definitions for serialization/marshalling.
  70. ├── libs // Reusable libraries and helpers.
  71. ├── migrations // Scripts for database migration.
  72. ├── models // Database models & schema definitions.
  73. ├── services // Specifies business logic.
  74. ├── storage // Private key storage.
  75. ├── tasks // Handling of async tasks and background jobs.
  76. └── tests
  77. ```
  78. ### 前端
  79. 该网站使用基于Typescript的[Next.js](https://nextjs.org/)模板进行引导,并使用[Tailwind CSS](https://tailwindcss.com/)进行样式设计。[React-i18next](https://react.i18next.com/)用于国际化。
  80. ```
  81. [web/]
  82. ├── app // layouts, pages, and components
  83. │ ├── (commonLayout) // common layout used throughout the app
  84. │ ├── (shareLayout) // layouts specifically shared across token-specific sessions
  85. │ ├── activate // activate page
  86. │ ├── components // shared by pages and layouts
  87. │ ├── install // install page
  88. │ ├── signin // signin page
  89. │ └── styles // globally shared styles
  90. ├── assets // Static assets
  91. ├── bin // scripts ran at build step
  92. ├── config // adjustable settings and options
  93. ├── context // shared contexts used by different portions of the app
  94. ├── dictionaries // Language-specific translate files
  95. ├── docker // container configurations
  96. ├── hooks // Reusable hooks
  97. ├── i18n // Internationalization configuration
  98. ├── models // describes data models & shapes of API responses
  99. ├── public // meta assets like favicon
  100. ├── service // specifies shapes of API actions
  101. ├── test
  102. ├── types // descriptions of function params and return values
  103. └── utils // Shared utility functions
  104. ```
  105. ## 提交你的 PR
  106. 最后,是时候向我们的仓库提交一个拉取请求(PR)了。对于重要的功能,我们首先将它们合并到 `deploy/dev` 分支进行测试,然后再合并到 `main` 分支。如果你遇到合并冲突或者不知道如何提交拉取请求的问题,请查看 [GitHub 的拉取请求教程](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests)。
  107. 就是这样!一旦你的 PR 被合并,你将成为我们 [README](https://github.com/langgenius/dify/blob/main/README.md) 中的贡献者。
  108. ## 获取帮助
  109. 如果你在贡献过程中遇到困难或者有任何问题,可以通过相关的 GitHub 问题提出你的疑问,或者加入我们的 [Discord](https://discord.gg/AhzKf7dNgk) 进行快速交流。