CatPtain commited on
Commit
61b71af
·
verified ·
1 Parent(s): 5ec6b0e

Upload 9 files

Browse files
Files changed (9) hide show
  1. .gitattributes +7 -38
  2. .gitignore +195 -0
  3. AUTHORS +6 -0
  4. CONTRIBUTING.md +157 -0
  5. CONTRIBUTING_CN.md +154 -0
  6. CONTRIBUTING_JA.md +160 -0
  7. CONTRIBUTING_VI.md +156 -0
  8. LICENSE +39 -0
  9. Makefile +43 -0
.gitattributes CHANGED
@@ -1,38 +1,7 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
36
- images/demo.png filter=lfs diff=lfs merge=lfs -text
37
- images/GitHub_README_cover.png filter=lfs diff=lfs merge=lfs -text
38
- images/wechat.png filter=lfs diff=lfs merge=lfs -text
 
1
+ # Ensure that .sh scripts use LF as line separator, even if they are checked out
2
+ # to Windows(NTFS) file-system, by a user of Docker for Window.
3
+ # These .sh scripts will be run from the Container after `docker compose up -d`.
4
+ # If they appear to be CRLF style, Dash from the Container will fail to execute
5
+ # them.
6
+
7
+ *.sh text eol=lf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+ .conda/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+ .idea/'
132
+
133
+ .DS_Store
134
+ web/.vscode/settings.json
135
+
136
+ # Intellij IDEA Files
137
+ .idea/*
138
+ !.idea/vcs.xml
139
+ !.idea/icon.png
140
+ .ideaDataSources/
141
+ *.iml
142
+ api/.idea
143
+
144
+ api/.env
145
+ api/storage/*
146
+
147
+ docker-legacy/volumes/app/storage/*
148
+ docker-legacy/volumes/db/data/*
149
+ docker-legacy/volumes/redis/data/*
150
+ docker-legacy/volumes/weaviate/*
151
+ docker-legacy/volumes/qdrant/*
152
+ docker-legacy/volumes/etcd/*
153
+ docker-legacy/volumes/minio/*
154
+ docker-legacy/volumes/milvus/*
155
+ docker-legacy/volumes/chroma/*
156
+ docker-legacy/volumes/opensearch/data/*
157
+ docker-legacy/volumes/pgvectors/data/*
158
+ docker-legacy/volumes/pgvector/data/*
159
+
160
+ docker/volumes/app/storage/*
161
+ docker/volumes/certbot/*
162
+ docker/volumes/db/data/*
163
+ docker/volumes/redis/data/*
164
+ docker/volumes/weaviate/*
165
+ docker/volumes/qdrant/*
166
+ docker/volumes/etcd/*
167
+ docker/volumes/minio/*
168
+ docker/volumes/milvus/*
169
+ docker/volumes/chroma/*
170
+ docker/volumes/opensearch/data/*
171
+ docker/volumes/myscale/data/*
172
+ docker/volumes/myscale/log/*
173
+ docker/volumes/unstructured/*
174
+ docker/volumes/pgvector/data/*
175
+ docker/volumes/pgvecto_rs/data/*
176
+ docker/volumes/couchbase/*
177
+ docker/volumes/oceanbase/*
178
+ !docker/volumes/oceanbase/init.d
179
+
180
+ docker/nginx/conf.d/default.conf
181
+ docker/nginx/ssl/*
182
+ !docker/nginx/ssl/.gitkeep
183
+ docker/middleware.env
184
+
185
+ sdks/python-client/build
186
+ sdks/python-client/dist
187
+ sdks/python-client/dify_client.egg-info
188
+
189
+ .vscode/*
190
+ !.vscode/launch.json
191
+ pyrightconfig.json
192
+ api/.vscode
193
+
194
+ .idea/
195
+ .vscode
AUTHORS ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ nite-knite
2
+ goocarlos
3
+ crazywoola
4
+ iamjoel
5
+ idsong
6
+ takatost
CONTRIBUTING.md ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONTRIBUTING
2
+
3
+ So you're looking to contribute to Dify - that's awesome, we can't wait to see what you do. As a startup with limited headcount and funding, we have grand ambitions to design the most intuitive workflow for building and managing LLM applications. Any help from the community counts, truly.
4
+
5
+ We need to be nimble and ship fast given where we are, but we also want to make sure that contributors like you get as smooth an experience at contributing as possible. We've assembled this contribution guide for that purpose, aiming at getting you familiarized with the codebase & how we work with contributors, so you could quickly jump to the fun part.
6
+
7
+ This guide, like Dify itself, is a constant work in progress. We highly appreciate your understanding if at times it lags behind the actual project, and welcome any feedback for us to improve.
8
+
9
+ In terms of licensing, please take a minute to read our short [License and Contributor Agreement](./LICENSE). The community also adheres to the [code of conduct](https://github.com/langgenius/.github/blob/main/CODE_OF_CONDUCT.md).
10
+
11
+ ## Before you jump in
12
+
13
+ [Find](https://github.com/langgenius/dify/issues?q=is:issue+is:open) an existing issue, or [open](https://github.com/langgenius/dify/issues/new/choose) a new one. We categorize issues into 2 types:
14
+
15
+ ### Feature requests
16
+
17
+ * If you're opening a new feature request, we'd like you to explain what the proposed feature achieves, and include as much context as possible. [@perzeusss](https://github.com/perzeuss) has made a solid [Feature Request Copilot](https://udify.app/chat/MK2kVSnw1gakVwMX) that helps you draft out your needs. Feel free to give it a try.
18
+
19
+ * If you want to pick one up from the existing issues, simply drop a comment below it saying so.
20
+
21
+ A team member working in the related direction will be looped in. If all looks good, they will give the go-ahead for you to start coding. We ask that you hold off working on the feature until then, so none of your work goes to waste should we propose changes.
22
+
23
+ Depending on whichever area the proposed feature falls under, you might talk to different team members. Here's rundown of the areas each our team members are working on at the moment:
24
+
25
+ | Member | Scope |
26
+ | ------------------------------------------------------------ | ---------------------------------------------------- |
27
+ | [@yeuoly](https://github.com/Yeuoly) | Architecting Agents |
28
+ | [@jyong](https://github.com/JohnJyong) | RAG pipeline design |
29
+ | [@GarfieldDai](https://github.com/GarfieldDai) | Building workflow orchestrations |
30
+ | [@iamjoel](https://github.com/iamjoel) & [@zxhlyh](https://github.com/zxhlyh) | Making our frontend a breeze to use |
31
+ | [@guchenhe](https://github.com/guchenhe) & [@crazywoola](https://github.com/crazywoola) | Developer experience, points of contact for anything |
32
+ | [@takatost](https://github.com/takatost) | Overall product direction and architecture |
33
+
34
+ How we prioritize:
35
+
36
+ | Feature Type | Priority |
37
+ | ------------------------------------------------------------ | --------------- |
38
+ | High-Priority Features as being labeled by a team member | High Priority |
39
+ | Popular feature requests from our [community feedback board](https://github.com/langgenius/dify/discussions/categories/feedbacks) | Medium Priority |
40
+ | Non-core features and minor enhancements | Low Priority |
41
+ | Valuable but not immediate | Future-Feature |
42
+
43
+ ### Anything else (e.g. bug report, performance optimization, typo correction)
44
+
45
+ * Start coding right away.
46
+
47
+ How we prioritize:
48
+
49
+ | Issue Type | Priority |
50
+ | ------------------------------------------------------------ | --------------- |
51
+ | Bugs in core functions (cannot login, applications not working, security loopholes) | Critical |
52
+ | Non-critical bugs, performance boosts | Medium Priority |
53
+ | Minor fixes (typos, confusing but working UI) | Low Priority |
54
+
55
+ ## Installing
56
+
57
+ Here are the steps to set up Dify for development:
58
+
59
+ ### 1. Fork this repository
60
+
61
+ ### 2. Clone the repo
62
+
63
+ Clone the forked repository from your terminal:
64
+
65
+ ```shell
66
+ git clone [email protected]:<github_username>/dify.git
67
+ ```
68
+
69
+ ### 3. Verify dependencies
70
+
71
+ Dify requires the following dependencies to build, make sure they're installed on your system:
72
+
73
+ * [Docker](https://www.docker.com/)
74
+ * [Docker Compose](https://docs.docker.com/compose/install/)
75
+ * [Node.js v18.x (LTS)](http://nodejs.org)
76
+ * [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
77
+ * [Python](https://www.python.org/) version 3.11.x or 3.12.x
78
+
79
+ ### 4. Installations
80
+
81
+ Dify is composed of a backend and a frontend. Navigate to the backend directory by `cd api/`, then follow the [Backend README](api/README.md) to install it. In a separate terminal, navigate to the frontend directory by `cd web/`, then follow the [Frontend README](web/README.md) to install.
82
+
83
+ Check the [installation FAQ](https://docs.dify.ai/learn-more/faq/install-faq) for a list of common issues and steps to troubleshoot.
84
+
85
+ ### 5. Visit dify in your browser
86
+
87
+ To validate your set up, head over to [http://localhost:3000](http://localhost:3000) (the default, or your self-configured URL and port) in your browser. You should now see Dify up and running.
88
+
89
+ ## Developing
90
+
91
+ If you are adding a model provider, [this guide](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/README.md) is for you.
92
+
93
+ If you are adding a tool provider to Agent or Workflow, [this guide](./api/core/tools/README.md) is for you.
94
+
95
+ To help you quickly navigate where your contribution fits, a brief, annotated outline of Dify's backend & frontend is as follows:
96
+
97
+ ### Backend
98
+
99
+ Dify’s backend is written in Python using [Flask](https://flask.palletsprojects.com/en/3.0.x/). It uses [SQLAlchemy](https://www.sqlalchemy.org/) for ORM and [Celery](https://docs.celeryq.dev/en/stable/getting-started/introduction.html) for task queueing. Authorization logic goes via Flask-login.
100
+
101
+ ```text
102
+ [api/]
103
+ ├── constants // Constant settings used throughout code base.
104
+ ├── controllers // API route definitions and request handling logic.
105
+ ├── core // Core application orchestration, model integrations, and tools.
106
+ ├── docker // Docker & containerization related configurations.
107
+ ├── events // Event handling and processing
108
+ ├── extensions // Extensions with 3rd party frameworks/platforms.
109
+ ├── fields // field definitions for serialization/marshalling.
110
+ ├── libs // Reusable libraries and helpers.
111
+ ├── migrations // Scripts for database migration.
112
+ ├── models // Database models & schema definitions.
113
+ ├── services // Specifies business logic.
114
+ ├── storage // Private key storage.
115
+ ├── tasks // Handling of async tasks and background jobs.
116
+ └── tests
117
+ ```
118
+
119
+ ### Frontend
120
+
121
+ The website is bootstrapped on [Next.js](https://nextjs.org/) boilerplate in Typescript and uses [Tailwind CSS](https://tailwindcss.com/) for styling. [React-i18next](https://react.i18next.com/) is used for internationalization.
122
+
123
+ ```text
124
+ [web/]
125
+ ├── app // layouts, pages, and components
126
+ │ ├── (commonLayout) // common layout used throughout the app
127
+ │ ├── (shareLayout) // layouts specifically shared across token-specific sessions
128
+ │ ├── activate // activate page
129
+ │ ├── components // shared by pages and layouts
130
+ │ ├── install // install page
131
+ │ ├── signin // signin page
132
+ │ └── styles // globally shared styles
133
+ ├── assets // Static assets
134
+ ├── bin // scripts ran at build step
135
+ ├── config // adjustable settings and options
136
+ ├── context // shared contexts used by different portions of the app
137
+ ├── dictionaries // Language-specific translate files
138
+ ├── docker // container configurations
139
+ ├── hooks // Reusable hooks
140
+ ├── i18n // Internationalization configuration
141
+ ├── models // describes data models & shapes of API responses
142
+ ├── public // meta assets like favicon
143
+ ├── service // specifies shapes of API actions
144
+ ├── test
145
+ ├── types // descriptions of function params and return values
146
+ └── utils // Shared utility functions
147
+ ```
148
+
149
+ ## Submitting your PR
150
+
151
+ At last, time to open a pull request (PR) to our repo. For major features, we first merge them into the `deploy/dev` branch for testing, before they go into the `main` branch. If you run into issues like merge conflicts or don't know how to open a pull request, check out [GitHub's pull request tutorial](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests).
152
+
153
+ And that's it! Once your PR is merged, you will be featured as a contributor in our [README](https://github.com/langgenius/dify/blob/main/README.md).
154
+
155
+ ## Getting Help
156
+
157
+ If you ever get stuck or got a burning question while contributing, simply shoot your queries our way via the related GitHub issue, or hop onto our [Discord](https://discord.gg/8Tpq4AcN9c) for a quick chat.
CONTRIBUTING_CN.md ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 所以你想为 Dify 做贡献 - 这太棒了,我们迫不及待地想看到你的贡献。作为一家人员和资金有限的初创公司,我们有着雄心勃勃的目标,希望设计出最直观的工作流程来构建和管理 LLM 应用程序。社区的任何帮助都是宝贵的。
2
+
3
+ 考虑到我们的现状,我们需要灵活快速地交付,但我们也希望确保像你这样的贡献者在贡献过程中获得尽可能顺畅的体验。我们为此编写了这份贡献指南,旨在让你熟悉代码库和我们与贡献者的合作方式,以便你能快速进入有趣的部分。
4
+
5
+ 这份指南,就像 Dify 本身一样,是一个不断改进的工作。如果有时它落后于实际项目,我们非常感谢你的理解,并欢迎提供任何反馈以供我们改进。
6
+
7
+ 在许可方面,请花一分钟阅读我们简短的 [许可证和贡献者协议](./LICENSE)。社区还遵守 [行为准则](https://github.com/langgenius/.github/blob/main/CODE_OF_CONDUCT.md)。
8
+
9
+ ## 在开始之前
10
+
11
+ [查找](https://github.com/langgenius/dify/issues?q=is:issue+is:open)现有问题,或 [创建](https://github.com/langgenius/dify/issues/new/choose) 一个新问题。我们将问题分为两类:
12
+
13
+ ### 功能请求:
14
+
15
+ * 如果您要提出新的功能请求,请解释所提议的功能的目标,并尽可能提供详细的上下文。[@perzeusss](https://github.com/perzeuss) 制作了一个很好的 [功能请求助手](https://udify.app/chat/MK2kVSnw1gakVwMX),可以帮助您起草需求。随时尝试一下。
16
+
17
+ * 如果您想从现有问题中选择一个,请在其下方留下评论表示您的意愿。
18
+
19
+ 相关方向的团队成员将参与其中。如果一切顺利,他们将批准您开始编码。在此之前,请不要开始工作,以免我们提出更改导致您的工作付诸东流。
20
+
21
+ 根据所提议的功能所属的领域不同,您可能需要与不同的团队成员交流。以下是我们团队成员目前正在从事的各个领域的概述:
22
+
23
+ | 团队成员 | 工作范围 |
24
+ | ------------------------------------------------------------ | ---------------------------------------------------- |
25
+ | [@yeuoly](https://github.com/Yeuoly) | 架构 Agents |
26
+ | [@jyong](https://github.com/JohnJyong) | RAG 流水线设计 |
27
+ | [@GarfieldDai](https://github.com/GarfieldDai) | 构建 workflow 编排 |
28
+ | [@iamjoel](https://github.com/iamjoel) & [@zxhlyh](https://github.com/zxhlyh) | 让我们的前端更易用 |
29
+ | [@guchenhe](https://github.com/guchenhe) & [@crazywoola](https://github.com/crazywoola) | 开发人员体验, 综合事项联系人 |
30
+ | [@takatost](https://github.com/takatost) | 产品整体方向和架构 |
31
+
32
+ 事项优先级:
33
+
34
+ | 功能类型 | 优先级 |
35
+ | ------------------------------------------------------------ | --------------- |
36
+ | 被团队成员标记为高优先级的功能 | 高优先级 |
37
+ | 在 [community feedback board](https://github.com/langgenius/dify/discussions/categories/feedbacks) 内反馈的常见功能请求 | 中等优先级 |
38
+ | 非核心功能和小幅改进 | 低优先级 |
39
+ | 有价值但不紧急 | 未来功能 |
40
+
41
+ ### 其他任何事情(例如 bug 报告、性能优化、拼写错误更正):
42
+ * 立即开始编码。
43
+
44
+ 事项优先级:
45
+
46
+ | Issue 类型 | 优先级 |
47
+ | ------------------------------------------------------------ | --------------- |
48
+ | 核心功能的 Bugs(例如无法登录、应用无法工作、安全漏洞) | 紧急 |
49
+ | 非紧急 bugs, 性能提升 | 中等优先级 |
50
+ | 小幅修复(错别字, 能正常工作但存在误导的 UI) | 低优先级 |
51
+
52
+ ## 安装
53
+
54
+ 以下是设置 Dify 进行开发的步骤:
55
+
56
+ ### 1. Fork 该仓库
57
+
58
+ ### 2. 克隆仓库
59
+
60
+ 从终端克隆代码仓库:
61
+
62
+ ```
63
+ git clone [email protected]:<github_username>/dify.git
64
+ ```
65
+
66
+ ### 3. 验证依赖项
67
+
68
+ Dify 依赖以下工具和库:
69
+
70
+ - [Docker](https://www.docker.com/)
71
+ - [Docker Compose](https://docs.docker.com/compose/install/)
72
+ - [Node.js v18.x (LTS)](http://nodejs.org)
73
+ - [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
74
+ - [Python](https://www.python.org/) version 3.11.x or 3.12.x
75
+
76
+ ### 4. 安装
77
+
78
+ Dify 由后端和前端组成。通过 `cd api/` 导航到后端目录,然后按照 [后端 README](api/README.md) 进行安装。在另一个终端中,通过 `cd web/` 导航到前端目录,然后按照 [前端 README](web/README.md) 进行安装。
79
+
80
+ 查看 [安装常见问题解答](https://docs.dify.ai/v/zh-hans/learn-more/faq/install-faq) 以获取常见问题列表和故障排除步骤。
81
+
82
+ ### 5. 在浏览器中访问 Dify
83
+
84
+ 为了验证您的设置,打开浏览器并访问 [http://localhost:3000](http://localhost:3000)(默认或您自定义的 URL 和端口)。现在您应该看到 Dify 正在运行。
85
+
86
+ ## 开发
87
+
88
+ 如果您要添加模型提供程序,请参考 [此指南](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/README.md)。
89
+
90
+ 如果您要向 Agent 或 Workflow 添加工具提供程序,请参考 [此指南](./api/core/tools/README.md)。
91
+
92
+ 为了帮助您快速了解您的贡献在哪个部分,以下是 Dify 后端和前端的简要注释大纲:
93
+
94
+ ### 后端
95
+
96
+ 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 进行处理。
97
+
98
+ ```
99
+ [api/]
100
+ ├── constants // 用于整个代码库的常量设置。
101
+ ├── controllers // API 路由定义和请求处理逻辑。
102
+ ├── core // 核心应用编排、模型集成和工具。
103
+ ├── docker // Docker 和容器化相关配置。
104
+ ├── events // 事件处理和处理。
105
+ ├── extensions // 与第三方框架/平台的扩展。
106
+ ├── fields // 用于序列化/封装的字段定义。
107
+ ├── libs // 可重用的库和助手。
108
+ ├── migrations // 数据库迁移脚本。
109
+ ├── models // 数据库模型和架构定义。
110
+ ├── services // 指定业务逻辑。
111
+ ├── storage // 私钥存储。
112
+ ├── tasks // 异步任务和后台作业的处理。
113
+ └── tests
114
+ ```
115
+
116
+ ### 前端
117
+
118
+ 该网站使用基于 Typescript 的 [Next.js](https://nextjs.org/) 模板进行引导,并使用 [Tailwind CSS](https://tailwindcss.com/) 进行样式设计。[React-i18next](https://react.i18next.com/) 用于国际化。
119
+
120
+ ```
121
+ [web/]
122
+ ├── app // 布局、页面和组件
123
+ │ ├── (commonLayout) // 整个应用通用的布局
124
+ │ ├── (shareLayout) // 在特定会话中共享的布局
125
+ │ ├── activate // 激活页面
126
+ │ ├── components // 页面和布局共享的组件
127
+ │ ├── install // 安装页面
128
+ │ ├── signin // 登录页面
129
+ │ └── styles // 全局共享的样式
130
+ ├── assets // 静态资源
131
+ ├── bin // 构建步骤运行的脚本
132
+ ├── config // 可调整的设置和选项
133
+ ├── context // 应用中不同部分使用的共享上下文
134
+ ├── dictionaries // 语言特定的翻译文件
135
+ ├── docker // 容器配置
136
+ ├── hooks // 可重用的钩子
137
+ ├── i18n // 国际化配置
138
+ ├── models // 描述数据模型和 API 响应的形状
139
+ ├── public // 如 favicon 等元资源
140
+ ├── service // 定义 API 操作的形状
141
+ ├── test
142
+ ├── types // 函数参数和返回值的描述
143
+ └── utils // 共享的实用函数
144
+ ```
145
+
146
+ ## 提交你的 PR
147
+
148
+ 最后,是时候向我们的仓库提交一个拉取请求(PR)了。对于重要的功能,我们首先将它们合并到 `deploy/dev` 分支进行测试,然后再合并到 `main` 分支。如果你遇到合并冲突或者不知道如何提交拉取请求的问题,请查看 [GitHub 的拉取请求教程](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests)。
149
+
150
+ 就是这样!一旦你的 PR 被合并,你将成为我们 [README](https://github.com/langgenius/dify/blob/main/README.md) 中的贡献者。
151
+
152
+ ## 获取帮助
153
+
154
+ 如果你在贡献过程中遇到困难或者有任何问题,可以通过相关的 GitHub 问题提出你的疑问,或者加入我们的 [Discord](https://discord.gg/8Tpq4AcN9c) 进行快速交流。
CONTRIBUTING_JA.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Dify にコントリビュートしたいとお考えなのですね。それは素晴らしいことです。
2
+ 私たちは、LLM アプリケーションの構築と管理のための最も直感的なワークフローを設計するという壮大な野望を持っています。人数も資金も限られている新興企業として、コミュニティからの支援は本当に重要です。
3
+
4
+ 私たちは現状を鑑み、機敏かつ迅速に開発をする必要がありますが、同時にあなた様のようなコントリビューターの方々に、可能な限りスムーズな貢献体験をしていただきたいと思っています。そのためにこのコントリビュートガイドを作成しました。
5
+ コードベースやコントリビュータの方々と私たちがどのように仕事をしているのかに慣れていただき、楽しいパートにすぐに飛び込めるようにすることが目的です。
6
+
7
+ このガイドは Dify そのものと同様に、継続的に改善されています。実際のプロジェクトに遅れをとることがあるかもしれませんが、ご理解のほどよろしくお願いいたします。
8
+
9
+ ライセンスに関しては、私たちの短い[ライセンスおよびコントリビューター規約](./LICENSE)をお読みください。また、コミュニティは[行動規範](https://github.com/langgenius/.github/blob/main/CODE_OF_CONDUCT.md)を遵守しています。
10
+
11
+ ## 飛び込む前に
12
+
13
+ [既存の Issue](https://github.com/langgenius/dify/issues?q=is:issue+is:open) を探すか、[新しい Issue](https://github.com/langgenius/dify/issues/new/choose) を作成してください。私たちは Issue を 2 つのタイプに分類しています。
14
+
15
+ ### 機能リクエスト
16
+
17
+ * 新しい機能要望を出す場合は、提案する機能が何を実現するものなのかを説明し、可能な限り多くのコンテキストを含めてください。[@perzeusss](https://github.com/perzeuss)は、あなた様の要望を書き出すのに役立つ [Feature Request Copilot](https://udify.app/chat/MK2kVSnw1gakVwMX) を作ってくれました。気軽に試してみてください。
18
+
19
+ * 既存の課題から 1 つ選びたい場合は、その下にコメントを書いてください。
20
+
21
+ 関連する方向で作業しているチームメンバーが参加します。すべてが良好であれば、コーディングを開始する許可が与えられます。私たちが変更を提案した場合にあなた様の作業が無駄になることがないよう、それまでこの機能の作業を控えていただくようお願いいたします。
22
+
23
+ 提案された機能がどの分野に属するかによって、あなた様は異なるチーム・メンバーと話をするかもしれません。以下は、各チームメンバーが現在取り組んでいる分野の概要です。
24
+
25
+ | Member | Scope |
26
+ | --------------------------------------------------------------------------------------- | ------------------------------------ |
27
+ | [@yeuoly](https://github.com/Yeuoly) | エージェントアーキテクチャ |
28
+ | [@jyong](https://github.com/JohnJyong) | RAG パイプライン設計 |
29
+ | [@GarfieldDai](https://github.com/GarfieldDai) | workflow orchestrations の構築 |
30
+ | [@iamjoel](https://github.com/iamjoel) & [@zxhlyh](https://github.com/zxhlyh) | フロントエンドを使いやすくする |
31
+ | [@guchenhe](https://github.com/guchenhe) & [@crazywoola](https://github.com/crazywoola) | 開発者体験、何でも相談できる窓口 |
32
+ | [@takatost](https://github.com/takatost) | 全体的な製品の方向性とアーキテクチャ |
33
+
34
+ 優先順位の付け方:
35
+
36
+ | Feature Type | Priority |
37
+ | --------------------------------------------------------------------------------------------------------------------- | --------------- |
38
+ | チームメンバーによってラベル付けされた優先度の高い機能 | High Priority |
39
+ | [community feedback board](https://github.com/langgenius/dify/discussions/categories/feedbacks)の人気の機能リクエスト | Medium Priority |
40
+ | 非コア機能とマイナーな機能強化 | Low Priority |
41
+ | 価値はあるが即効性はない | Future-Feature |
42
+
43
+ ### その他 (バグレポート、パフォ���マンスの最適化、誤字の修正など)
44
+
45
+ * すぐにコーディングを始めてください
46
+
47
+ 優先順位の付け方:
48
+
49
+ | Issue Type | Priority |
50
+ | -------------------------------------------------------------------------------------- | --------------- |
51
+ | コア機能のバグ(ログインできない、アプリケーションが動作しない、セキュリティの抜け穴) | Critical |
52
+ | 致命的でないバグ、パフォーマンス向上 | Medium Priority |
53
+ | 細かな修正(誤字脱字、機能はするが分かりにくい UI) | Low Priority |
54
+
55
+ ## インストール
56
+
57
+ 以下の手順で 、Difyのセットアップをしてください。
58
+
59
+ ### 1. このリポジトリをフォークする
60
+
61
+ ### 2. リポジトリをクローンする
62
+
63
+ フォークしたリポジトリをターミナルからクローンします。
64
+
65
+ ```
66
+ git clone [email protected]:<github_username>/dify.git
67
+ ```
68
+
69
+ ### 3. 依存関係の確認
70
+
71
+ Dify を構築するには次の依存関係が必要です。それらがシステムにインストールされていることを確認してください。
72
+
73
+ - [Docker](https://www.docker.com/)
74
+ - [Docker Compose](https://docs.docker.com/compose/install/)
75
+ - [Node.js v18.x (LTS)](http://nodejs.org)
76
+ - [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
77
+ - [Python](https://www.python.org/) version 3.11.x or 3.12.x
78
+
79
+ ### 4. インストール
80
+
81
+ Dify はバックエンドとフロントエンドから構成されています。
82
+ まず`cd api/`でバックエンドのディレクトリに移動し、[Backend README](api/README.md)に従ってインストールします。
83
+ 次に別のターミナルで、`cd web/`でフロントエンドのディレクトリに移動し、[Frontend README](web/README.md)に従ってインストールしてください。
84
+
85
+ よくある問題とトラブルシューティングの手順については、[installation FAQ](https://docs.dify.ai/v/japanese/learn-more/faq/install-faq) を確認してください。
86
+
87
+ ### 5. ブラウザで dify にアクセスする
88
+
89
+ 設定を確認するために、ブラウザで[http://localhost:3000](http://localhost:3000)(デフォルト、または自分で設定した URL とポート)にアクセスしてください。Dify が起動して実行中であることが確認できるはずです。
90
+
91
+ ## 開発中
92
+
93
+ モデルプロバイダーを追加する場合は、[このガイド](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/README.md)が役立ちます。
94
+
95
+ Agent や Workflow にツールプロバイダーを追加する場合は、[このガイド](./api/core/tools/README.md)が役立ちます。
96
+
97
+ Dify のバックエンドとフロントエンドの概要を簡単に説明します。
98
+
99
+ ### バックエンド
100
+
101
+ Dify のバックエンドは[Flask](https://flask.palletsprojects.com/en/3.0.x/)を使って Python で書かれています。ORM には[SQLAlchemy](https://www.sqlalchemy.org/)を、タスクキューには[Celery](https://docs.celeryq.dev/en/stable/getting-started/introduction.html)を使っています。認証ロジックは Flask-login 経由で行われます。
102
+
103
+ ```
104
+ [api/]
105
+ ├── constants // コードベース全体で使用される定数設定
106
+ ├── controllers // APIルート定義とリクエスト処理ロジック
107
+ ├── core // アプリケーションの中核的な管理、モデル統合、およびツール
108
+ ├── docker // Dockerおよびコンテナ関連の設定
109
+ ├── events // イベントのハンドリングと処理
110
+ ├── extensions // 第三者のフレームワーク/プラットフォームとの拡張
111
+ ├── fields // シリアライゼーション/マーシャリング用のフィールド定義
112
+ ├── libs // 再利用可能なライブラリとヘルパー
113
+ ├── migrations // データベースマイグレーションスクリプト
114
+ ├── models // データベースモデルとスキーマ定義
115
+ ├── services // ビジネスロジックの定義
116
+ ├── storage // 秘密鍵の保存
117
+ ├── tasks // 非同期タスクとバックグラウンドジョブの処理
118
+ └── tests // テスト関連のファイル
119
+ ```
120
+
121
+ ### フロントエンド
122
+
123
+ このウェブサイトは、Typescriptベースの[Next.js](https://nextjs.org/)テンプレートを使ってブートストラップされ、[Tailwind CSS](https://tailwindcss.com/)を使ってスタイリングされています。国際化には[React-i18next](https://react.i18next.com/)を使用しています。
124
+
125
+ ```
126
+ [web/]
127
+ ├── app // レイアウト、ページ、コンポーネント
128
+ │ ├── (commonLayout) // アプリ全体で共通のレイアウト
129
+ │ ├── (shareLayout) // トークン特有のセッションで共有されるレイアウト
130
+ │ ├── activate // アクティベートページ
131
+ │ ├── components // ページやレイアウトで共有されるコンポーネント
132
+ │ ├── install // インストールページ
133
+ │ ├── signin // サインインページ
134
+ │ └── styles // グローバルに共有されるスタイル
135
+ ├── assets // 静的アセット
136
+ ├── bin // ビルドステップで実行されるスクリプト
137
+ ├── config // 調整可能な設定とオプション
138
+ ├── context // アプリの異なる部分で使用される共有コンテキスト
139
+ ├── dictionaries // 言語別の翻訳ファイル
140
+ ├── docker // コンテナ設定
141
+ ├── hooks // 再利用可能なフック
142
+ ├── i18n // 国際化設定
143
+ ├── models // データモデルとAPIレスポンスの形状を記述
144
+ ├── public // ファビコンなどのメタアセット
145
+ ├── service // APIアクションの形状を指定
146
+ ├── test
147
+ ├── types // 関数のパラメータと戻り値の記述
148
+ └── utils // 共有ユーティリティ関数
149
+ ```
150
+
151
+ ## PR を投稿する
152
+
153
+ いよいよ、私たちのリポジトリにプルリクエスト (PR) を提出する時が来ました。主要な機能については、まず `deploy/dev` ブランチにマージしてテストしてから `main` ブランチにマージします。
154
+ マージ競合などの問題が発生した場合、またはプル リクエストを開く方法がわからない場合は、[GitHub's pull request tutorial](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests) をチェックしてみてください。
155
+
156
+ これで完了です!あなた様の PR がマージされると、[README](https://github.com/langgenius/dify/blob/main/README.md) にコントリビューターとして紹介されます。
157
+
158
+ ## ヘルプを得る
159
+
160
+ コントリビュート中に行き詰まったり、疑問が生じたりした場合は、GitHub の関連する issue から質問していただくか、[Discord](https://discord.gg/8Tpq4AcN9c)でチャットしてください。
CONTRIBUTING_VI.md ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Thật tuyệt vời khi bạn muốn đóng góp cho Dify! Chúng tôi rất mong chờ được thấy những gì bạn sẽ làm. Là một startup với nguồn nhân lực và tài chính hạn chế, chúng tôi có tham vọng lớn là thiết kế quy trình trực quan nhất để xây dựng và quản lý các ứng dụng LLM. Mọi sự giúp đỡ từ cộng đồng đều rất quý giá đối với chúng tôi.
2
+
3
+ Chúng tôi cần linh hoạt và làm việc nhanh chóng, nhưng đồng thời cũng muốn đảm bảo các cộng tác viên như bạn có trải nghiệm đóng góp thuận lợi nhất có thể. Chúng tôi đã tạo ra hướng dẫn đóng góp này nhằm giúp bạn làm quen với codebase và cách chúng tôi làm việc với các cộng tác viên, để bạn có thể nhanh chóng bắt tay vào phần thú vị.
4
+
5
+ Hướng dẫn này, cũng như bản thân Dify, đang trong quá trình cải tiến liên tục. Chúng tôi rất cảm kích sự thông cảm của bạn nếu đôi khi nó không theo kịp dự án thực tế, và chúng tôi luôn hoan nghênh mọi phản hồi để cải thiện.
6
+
7
+ Về vấn đề cấp phép, xin vui lòng dành chút thời gian đọc qua [Thỏa thuận Cấp phép và Đóng góp](./LICENSE) ngắn gọn của chúng tôi. Cộng đồng cũng tuân thủ [quy tắc ứng xử](https://github.com/langgenius/.github/blob/main/CODE_OF_CONDUCT.md).
8
+
9
+ ## Trước khi bắt đầu
10
+
11
+ [Tìm kiếm](https://github.com/langgenius/dify/issues?q=is:issue+is:open) một vấn đề hiện có, hoặc [tạo mới](https://github.com/langgenius/dify/issues/new/choose) một vấn đề. Chúng tôi phân loại các vấn đề thành 2 loại:
12
+
13
+ ### Yêu cầu tính năng:
14
+
15
+ * Nếu bạn đang tạo một yêu cầu tính năng mới, chúng tôi muốn bạn giải thích tính năng đề xuất sẽ đạt được điều gì và cung cấp càng nhiều thông tin chi tiết càng tốt. [@perzeusss](https://github.com/perzeuss) đã tạo một [Trợ lý Yêu cầu Tính năng](https://udify.app/chat/MK2kVSnw1gakVwMX) rất hữu ích để giúp bạn soạn thảo nhu cầu của mình. Hãy thử dùng nó nhé.
16
+
17
+ * Nếu bạn muốn chọn một vấn đề từ danh sách hiện có, chỉ cần để lại bình luận dưới vấn đề đó nói rằng bạn sẽ làm.
18
+
19
+ Một thành viên trong nhóm làm việc trong lĩnh vực liên quan sẽ được thông báo. Nếu mọi thứ ổn, họ sẽ cho phép bạn bắt đầu code. Chúng tôi yêu cầu bạn chờ đợi cho đến lúc đó trước khi bắt tay vào làm tính năng, để không lãng phí công sức của bạn nếu chúng tôi đề xuất thay đổi.
20
+
21
+ Tùy thuộc vào lĩnh vực mà tính năng đề xuất thuộc về, bạn có thể nói chuyện với các thành viên khác nhau trong nhóm. Dưới đây là danh sách các lĩnh vực mà các thành viên trong nhóm chúng tôi đang làm việc hiện tại:
22
+
23
+ | Thành viên | Phạm vi |
24
+ | ------------------------------------------------------------ | ---------------------------------------------------- |
25
+ | [@yeuoly](https://github.com/Yeuoly) | Thiết kế kiến trúc Agents |
26
+ | [@jyong](https://github.com/JohnJyong) | Thiết kế quy trình RAG |
27
+ | [@GarfieldDai](https://github.com/GarfieldDai) | Xây dựng quy trình làm việc |
28
+ | [@iamjoel](https://github.com/iamjoel) & [@zxhlyh](https://github.com/zxhlyh) | Làm cho giao diện người dùng dễ sử dụng |
29
+ | [@guchenhe](https://github.com/guchenhe) & [@crazywoola](https://github.com/crazywoola) | Trải nghiệm nhà phát triển, đầu mối liên hệ cho mọi vấn đề |
30
+ | [@takatost](https://github.com/takatost) | Định hướng và kiến trúc tổng thể sản phẩm |
31
+
32
+ Cách chúng tôi ưu tiên:
33
+
34
+ | Loại tính năng | Mức độ ưu tiên |
35
+ | ------------------------------------------------------------ | -------------- |
36
+ | Tính năng ưu tiên cao được gắn nhãn bởi thành viên trong nhóm | Ưu tiên cao |
37
+ | Yêu cầu tính năng phổ biến từ [bảng phản hồi cộng đồng](https://github.com/langgenius/dify/discussions/categories/feedbacks) của chúng tôi | Ưu tiên trung bình |
38
+ | Tính năng không quan trọng và cải tiến nhỏ | Ưu tiên thấp |
39
+ | Có giá trị nhưng không cấp bách | Tính năng tương lai |
40
+
41
+ ### Những vấn đề khác (ví dụ: báo cáo lỗi, tối ưu hiệu suất, sửa lỗi chính tả):
42
+
43
+ * Bắt đầu code ngay lập tức.
44
+
45
+ Cách chúng tôi ưu tiên:
46
+
47
+ | Loại vấn đề | Mức độ ưu tiên |
48
+ | ------------------------------------------------------------ | -------------- |
49
+ | Lỗi trong các chức năng chính (không thể đăng nhập, ứng dụng không hoạt động, lỗ hổng bảo mật) | Nghiêm trọng |
50
+ | Lỗi không quan trọng, cải thiện hiệu suất | Ưu tiên trung bình |
51
+ | Sửa lỗi nhỏ (lỗi chính tả, giao diện người dùng gây nhầm lẫn nhưng vẫn hoạt động) | Ưu tiên thấp |
52
+
53
+
54
+ ## Cài đặt
55
+
56
+ Dưới đây là các bước để thiết lập Dify cho việc phát triển:
57
+
58
+ ### 1. Fork repository này
59
+
60
+ ### 2. Clone repository
61
+
62
+ Clone repository đã fork từ terminal của bạn:
63
+
64
+ ```
65
+ git clone [email protected]:<tên_người_dùng_github>/dify.git
66
+ ```
67
+
68
+ ### 3. Kiểm tra các phụ thuộc
69
+
70
+ Dify yêu cầu các phụ thuộc sau để build, hãy đảm bảo chúng đã được cài đặt trên hệ thống của bạn:
71
+
72
+ - [Docker](https://www.docker.com/)
73
+ - [Docker Compose](https://docs.docker.com/compose/install/)
74
+ - [Node.js v18.x (LTS)](http://nodejs.org)
75
+ - [npm](https://www.npmjs.com/) phiên bản 8.x.x hoặc [Yarn](https://yarnpkg.com/)
76
+ - [Python](https://www.python.org/) phiên bản 3.11.x hoặc 3.12.x
77
+
78
+ ### 4. Cài đặt
79
+
80
+ Dify bao gồm một backend và một frontend. Đi đến thư mục backend bằng lệnh `cd api/`, sau đó làm theo hướng dẫn trong [README của Backend](api/README.md) để cài đặt. Trong một terminal khác, đi đến thư mục frontend bằng lệnh `cd web/`, sau đó làm theo hướng dẫn trong [README của Frontend](web/README.md) để cài đặt.
81
+
82
+ Kiểm tra [FAQ về cài đặt](https://docs.dify.ai/learn-more/faq/install-faq) để xem danh sách các vấn đề thường gặp và các bước khắc phục.
83
+
84
+ ### 5. Truy cập Dify trong trình duyệt của bạn
85
+
86
+ Để xác nhận cài đặt của bạn, hãy truy cập [http://localhost:3000](http://localhost:3000) (địa chỉ mặc định, hoặc URL và cổng bạn đã cấu hình) trong trình duyệt. Bạn sẽ thấy Dify đang chạy.
87
+
88
+ ## Phát triển
89
+
90
+ Nếu bạn đang thêm một nhà cung cấp mô hình, [hướng dẫn này](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/README.md) dành cho bạn.
91
+
92
+ Nếu bạn đang thêm một nhà cung cấp công cụ cho Agent hoặc Workflow, [hướng dẫn này](./api/core/tools/README.md) dành cho bạn.
93
+
94
+ Để giúp bạn nhanh chóng định hướng phần đóng góp của mình, dưới đây là một bản phác thảo ngắn gọn về cấu trúc backend & frontend của Dify:
95
+
96
+ ### Backend
97
+
98
+ Backend của Dify được viết bằng Python sử dụng [Flask](https://flask.palletsprojects.com/en/3.0.x/). Nó sử dụng [SQLAlchemy](https://www.sqlalchemy.org/) cho ORM và [Celery](https://docs.celeryq.dev/en/stable/getting-started/introduction.html) cho hàng đợi tác vụ. Logic xác thực được thực hiện thông qua Flask-login.
99
+
100
+ ```
101
+ [api/]
102
+ ├── constants // Các cài đặt hằng số được sử dụng trong toàn bộ codebase.
103
+ ├── controllers // Định nghĩa các route API và logic xử lý yêu cầu.
104
+ ├── core // Điều phối ứng dụng cốt lõi, tích hợp mô hình và công cụ.
105
+ ├── docker // Cấu hình liên quan đến Docker & containerization.
106
+ ├── events // Xử lý và xử lý sự kiện
107
+ ├── extensions // Mở rộng với các framework/nền tảng bên thứ 3.
108
+ ├── fields // Định nghĩa trường cho serialization/marshalling.
109
+ ├── libs // Thư viện và tiện ích có thể tái sử dụng.
110
+ ├── migrations // Script cho việc di chuyển cơ sở dữ liệu.
111
+ ├── models // Mô hình cơ sở dữ liệu & định nghĩa schema.
112
+ ├── services // Xác định logic nghiệp vụ.
113
+ ├── storage // Lưu trữ khóa riêng tư.
114
+ ├── tasks // Xử lý các tác vụ bất đồng bộ và công việc nền.
115
+ └── tests
116
+ ```
117
+
118
+ ### Frontend
119
+
120
+ Website được khởi tạo trên boilerplate [Next.js](https://nextjs.org/) bằng Typescript và sử dụng [Tailwind CSS](https://tailwindcss.com/) cho styling. [React-i18next](https://react.i18next.com/) được sử dụng cho việc quốc tế hóa.
121
+
122
+ ```
123
+ [web/]
124
+ ├── app // layouts, pages và components
125
+ │ ├── (commonLayout) // layout chung được sử dụng trong toàn bộ ứng dụng
126
+ │ ├── (shareLayout) // layouts được chia sẻ cụ thể cho các phiên dựa trên token
127
+ │ ├── activate // trang kích hoạt
128
+ │ ├── components // được chia sẻ bởi các trang và layouts
129
+ │ ├── install // trang cài đặt
130
+ │ ├── signin // trang đăng nhập
131
+ │ └── styles // styles được chia sẻ toàn cục
132
+ ├── assets // Tài nguyên tĩnh
133
+ ├── bin // scripts chạy ở bước build
134
+ ├── config // cài đặt và tùy chọn có thể điều chỉnh
135
+ ├── context // contexts được chia sẻ bởi các phần khác nhau của ứng dụng
136
+ ├── dictionaries // File dịch cho từng ngôn ngữ
137
+ ├── docker // cấu hình container
138
+ ├── hooks // Hooks có thể tái sử dụng
139
+ ├── i18n // Cấu hình quốc tế hóa
140
+ ├── models // mô tả các mô hình dữ liệu & hình dạng của phản hồi API
141
+ ├── public // tài nguyên meta như favicon
142
+ ├── service // xác định hình dạng của các hành động API
143
+ ├── test
144
+ ├── types // mô tả các tham số hàm và giá trị trả về
145
+ └── utils // Các hàm tiện ích được chia sẻ
146
+ ```
147
+
148
+ ## Gửi PR của bạn
149
+
150
+ Cuối cùng, đã đến lúc mở một pull request (PR) đến repository của chúng tôi. Đối với các tính năng lớn, chúng tôi sẽ merge chúng vào nhánh `deploy/dev` để kiểm tra trước khi đưa vào nhánh `main`. Nếu bạn gặp vấn đề như xung đột merge hoặc không biết cách mở pull request, hãy xem [hướng dẫn về pull request của GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests).
151
+
152
+ Và thế là xong! Khi PR của bạn được merge, bạn sẽ được giới thiệu là một người đóng góp trong [README](https://github.com/langgenius/dify/blob/main/README.md) của chúng tôi.
153
+
154
+ ## Nhận trợ giúp
155
+
156
+ Nếu bạn gặp khó khăn hoặc có câu hỏi cấp bách trong quá trình đóng góp, hãy đặt câu hỏi của bạn trong vấn đề GitHub liên quan, hoặc tham gia [Discord](https://discord.gg/8Tpq4AcN9c) của chúng tôi để trò chuyện nhanh chóng.
LICENSE ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Open Source License
2
+
3
+ Dify is licensed under the Apache License 2.0, with the following additional conditions:
4
+
5
+ 1. Dify may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer:
6
+
7
+ a. Multi-tenant service: Unless explicitly authorized by Dify in writing, you may not use the Dify source code to operate a multi-tenant environment.
8
+ - Tenant Definition: Within the context of Dify, one tenant corresponds to one workspace. The workspace provides a separated area for each tenant's data and configurations.
9
+
10
+ b. LOGO and copyright information: In the process of using Dify's frontend, you may not remove or modify the LOGO or copyright information in the Dify console or applications. This restriction is inapplicable to uses of Dify that do not involve its frontend.
11
+ - Frontend Definition: For the purposes of this license, the "frontend" of Dify includes all components located in the `web/` directory when running Dify from the raw source code, or the "web" image when running Dify with Docker.
12
+
13
+ Please contact [email protected] by email to inquire about licensing matters.
14
+
15
+ 2. As a contributor, you should agree that:
16
+
17
+ a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
18
+ b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
19
+
20
+ Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
21
+
22
+ The interactive design of this product is protected by appearance patent.
23
+
24
+ © 2024 LangGenius, Inc.
25
+
26
+
27
+ ----------
28
+
29
+ Licensed under the Apache License, Version 2.0 (the "License");
30
+ you may not use this file except in compliance with the License.
31
+ You may obtain a copy of the License at
32
+
33
+ http://www.apache.org/licenses/LICENSE-2.0
34
+
35
+ Unless required by applicable law or agreed to in writing, software
36
+ distributed under the License is distributed on an "AS IS" BASIS,
37
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
+ See the License for the specific language governing permissions and
39
+ limitations under the License.
Makefile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Variables
2
+ DOCKER_REGISTRY=langgenius
3
+ WEB_IMAGE=$(DOCKER_REGISTRY)/dify-web
4
+ API_IMAGE=$(DOCKER_REGISTRY)/dify-api
5
+ VERSION=latest
6
+
7
+ # Build Docker images
8
+ build-web:
9
+ @echo "Building web Docker image: $(WEB_IMAGE):$(VERSION)..."
10
+ docker build -t $(WEB_IMAGE):$(VERSION) ./web
11
+ @echo "Web Docker image built successfully: $(WEB_IMAGE):$(VERSION)"
12
+
13
+ build-api:
14
+ @echo "Building API Docker image: $(API_IMAGE):$(VERSION)..."
15
+ docker build -t $(API_IMAGE):$(VERSION) ./api
16
+ @echo "API Docker image built successfully: $(API_IMAGE):$(VERSION)"
17
+
18
+ # Push Docker images
19
+ push-web:
20
+ @echo "Pushing web Docker image: $(WEB_IMAGE):$(VERSION)..."
21
+ docker push $(WEB_IMAGE):$(VERSION)
22
+ @echo "Web Docker image pushed successfully: $(WEB_IMAGE):$(VERSION)"
23
+
24
+ push-api:
25
+ @echo "Pushing API Docker image: $(API_IMAGE):$(VERSION)..."
26
+ docker push $(API_IMAGE):$(VERSION)
27
+ @echo "API Docker image pushed successfully: $(API_IMAGE):$(VERSION)"
28
+
29
+ # Build all images
30
+ build-all: build-web build-api
31
+
32
+ # Push all images
33
+ push-all: push-web push-api
34
+
35
+ build-push-api: build-api push-api
36
+ build-push-web: build-web push-web
37
+
38
+ # Build and push all images
39
+ build-push-all: build-all push-all
40
+ @echo "All Docker images have been built and pushed."
41
+
42
+ # Phony targets
43
+ .PHONY: build-web build-api push-web push-api build-all push-all build-push-all