Spaces:
Build error
Build error
Remove all README files
Browse files- README.md +0 -179
- api/README.md +0 -88
- api/core/app/apps/README.md +0 -48
- api/core/model_runtime/README.md +0 -70
- api/core/tools/README.md +0 -25
- docker/README.md +0 -99
- docker/certbot/README.md +0 -76
- sdks/README.md +0 -25
- sdks/nodejs-client/README.md +0 -63
- sdks/php-client/README.md +0 -84
- sdks/python-client/README.md +0 -185
- web/README.md +0 -118
- web/i18n/README.md +0 -175
README.md
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
![cover-v5-optimized](https://github.com/langgenius/dify/assets/13230914/f9e19af5-61ba-4119-b926-d10c4c06ebab)
|
2 |
-
|
3 |
-
<p align="center">
|
4 |
-
📌 <a href="https://dify.ai/blog/introducing-dify-workflow-file-upload-a-demo-on-ai-podcast">Introducing Dify Workflow File Upload: Recreate Google NotebookLM Podcast</a>
|
5 |
-
</p>
|
6 |
-
|
7 |
-
<p align="center">
|
8 |
-
<a href="https://cloud.dify.ai">Dify Cloud</a> ·
|
9 |
-
<a href="https://docs.dify.ai/getting-started/install-self-hosted">Self-hosting</a> ·
|
10 |
-
<a href="https://docs.dify.ai">Documentation</a> ·
|
11 |
-
<a href="https://udify.app/chat/22L1zSxg6yW1cWQg">Enterprise inquiry</a>
|
12 |
-
</p>
|
13 |
-
|
14 |
-
<p align="center">
|
15 |
-
<a href="https://dify.ai" target="_blank">
|
16 |
-
<img alt="Static Badge" src="https://img.shields.io/badge/Product-F04438"></a>
|
17 |
-
<a href="https://dify.ai/pricing" target="_blank">
|
18 |
-
<img alt="Static Badge" src="https://img.shields.io/badge/free-pricing?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
|
19 |
-
<a href="https://discord.gg/FngNHpbcY7" target="_blank">
|
20 |
-
<img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
|
21 |
-
alt="chat on Discord"></a>
|
22 |
-
<a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
|
23 |
-
<img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
|
24 |
-
alt="follow on X(Twitter)"></a>
|
25 |
-
<a href="https://hub.docker.com/u/langgenius" target="_blank">
|
26 |
-
<img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
|
27 |
-
<a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
|
28 |
-
<img alt="Commits last month" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
|
29 |
-
<a href="https://github.com/langgenius/dify/" target="_blank">
|
30 |
-
<img alt="Issues closed" src="https://img.shields.io/github/issues-search?query=repo%3Alanggenius%2Fdify%20is%3Aclosed&label=issues%20closed&labelColor=%20%237d89b0&color=%20%235d6b98"></a>
|
31 |
-
<a href="https://github.com/langgenius/dify/discussions/" target="_blank">
|
32 |
-
<img alt="Discussion posts" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
|
33 |
-
</p>
|
34 |
-
|
35 |
-
<p align="center">
|
36 |
-
<a href="./README.md"><img alt="README in English" src="https://img.shields.io/badge/English-d9d9d9"></a>
|
37 |
-
<a href="./README_CN.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
|
38 |
-
<a href="./README_JA.md"><img alt="日本語のREADME" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
|
39 |
-
<a href="./README_ES.md"><img alt="README en Español" src="https://img.shields.io/badge/Español-d9d9d9"></a>
|
40 |
-
<a href="./README_FR.md"><img alt="README en Français" src="https://img.shields.io/badge/Français-d9d9d9"></a>
|
41 |
-
<a href="./README_KL.md"><img alt="README tlhIngan Hol" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
|
42 |
-
<a href="./README_KR.md"><img alt="README in Korean" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
|
43 |
-
<a href="./README_AR.md"><img alt="README بالعربية" src="https://img.shields.io/badge/العربية-d9d9d9"></a>
|
44 |
-
<a href="./README_TR.md"><img alt="Türkçe README" src="https://img.shields.io/badge/Türkçe-d9d9d9"></a>
|
45 |
-
<a href="./README_VI.md"><img alt="README Tiếng Việt" src="https://img.shields.io/badge/Ti%E1%BA%BFng%20Vi%E1%BB%87t-d9d9d9"></a>
|
46 |
-
</p>
|
47 |
-
|
48 |
-
|
49 |
-
Dify is an open-source LLM app development platform. Its intuitive interface combines agentic AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
|
50 |
-
|
51 |
-
## Quick start
|
52 |
-
> Before installing Dify, make sure your machine meets the following minimum system requirements:
|
53 |
-
>
|
54 |
-
>- CPU >= 2 Core
|
55 |
-
>- RAM >= 4 GiB
|
56 |
-
|
57 |
-
</br>
|
58 |
-
|
59 |
-
The easiest way to start the Dify server is through [docker compose](docker/docker-compose.yaml). Before running Dify with the following commands, make sure that [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed on your machine:
|
60 |
-
|
61 |
-
```bash
|
62 |
-
cd dify
|
63 |
-
cd docker
|
64 |
-
cp .env.example .env
|
65 |
-
docker compose up -d
|
66 |
-
```
|
67 |
-
|
68 |
-
After running, you can access the Dify dashboard in your browser at [http://localhost/install](http://localhost/install) and start the initialization process.
|
69 |
-
|
70 |
-
#### Seeking help
|
71 |
-
Please refer to our [FAQ](https://docs.dify.ai/getting-started/install-self-hosted/faqs) if you encounter problems setting up Dify. Reach out to [the community and us](#community--contact) if you are still having issues.
|
72 |
-
|
73 |
-
> If you'd like to contribute to Dify or do additional development, refer to our [guide to deploying from source code](https://docs.dify.ai/getting-started/install-self-hosted/local-source-code)
|
74 |
-
|
75 |
-
## Key features
|
76 |
-
**1. Workflow**:
|
77 |
-
Build and test powerful AI workflows on a visual canvas, leveraging all the following features and beyond.
|
78 |
-
|
79 |
-
|
80 |
-
https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
**2. Comprehensive model support**:
|
85 |
-
Seamless integration with hundreds of proprietary / open-source LLMs from dozens of inference providers and self-hosted solutions, covering GPT, Mistral, Llama3, and any OpenAI API-compatible models. A full list of supported model providers can be found [here](https://docs.dify.ai/getting-started/readme/model-providers).
|
86 |
-
|
87 |
-
![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
|
88 |
-
|
89 |
-
|
90 |
-
**3. Prompt IDE**:
|
91 |
-
Intuitive interface for crafting prompts, comparing model performance, and adding additional features such as text-to-speech to a chat-based app.
|
92 |
-
|
93 |
-
**4. RAG Pipeline**:
|
94 |
-
Extensive RAG capabilities that cover everything from document ingestion to retrieval, with out-of-box support for text extraction from PDFs, PPTs, and other common document formats.
|
95 |
-
|
96 |
-
**5. Agent capabilities**:
|
97 |
-
You can define agents based on LLM Function Calling or ReAct, and add pre-built or custom tools for the agent. Dify provides 50+ built-in tools for AI agents, such as Google Search, DALL·E, Stable Diffusion and WolframAlpha.
|
98 |
-
|
99 |
-
**6. LLMOps**:
|
100 |
-
Monitor and analyze application logs and performance over time. You could continuously improve prompts, datasets, and models based on production data and annotations.
|
101 |
-
|
102 |
-
**7. Backend-as-a-Service**:
|
103 |
-
All of Dify's offerings come with corresponding APIs, so you could effortlessly integrate Dify into your own business logic.
|
104 |
-
|
105 |
-
|
106 |
-
## Using Dify
|
107 |
-
|
108 |
-
- **Cloud </br>**
|
109 |
-
We host a [Dify Cloud](https://dify.ai) service for anyone to try with zero setup. It provides all the capabilities of the self-deployed version, and includes 200 free GPT-4 calls in the sandbox plan.
|
110 |
-
|
111 |
-
- **Self-hosting Dify Community Edition</br>**
|
112 |
-
Quickly get Dify running in your environment with this [starter guide](#quick-start).
|
113 |
-
Use our [documentation](https://docs.dify.ai) for further references and more in-depth instructions.
|
114 |
-
|
115 |
-
- **Dify for enterprise / organizations</br>**
|
116 |
-
We provide additional enterprise-centric features. [Log your questions for us through this chatbot](https://udify.app/chat/22L1zSxg6yW1cWQg) or [send us an email](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry) to discuss enterprise needs. </br>
|
117 |
-
> For startups and small businesses using AWS, check out [Dify Premium on AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6) and deploy it to your own AWS VPC with one-click. It's an affordable AMI offering with the option to create apps with custom logo and branding.
|
118 |
-
|
119 |
-
|
120 |
-
## Staying ahead
|
121 |
-
|
122 |
-
Star Dify on GitHub and be instantly notified of new releases.
|
123 |
-
|
124 |
-
![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
|
125 |
-
|
126 |
-
|
127 |
-
## Advanced Setup
|
128 |
-
|
129 |
-
If you need to customize the configuration, please refer to the comments in our [.env.example](docker/.env.example) file and update the corresponding values in your `.env` file. Additionally, you might need to make adjustments to the `docker-compose.yaml` file itself, such as changing image versions, port mappings, or volume mounts, based on your specific deployment environment and requirements. After making any changes, please re-run `docker-compose up -d`. You can find the full list of available environment variables [here](https://docs.dify.ai/getting-started/install-self-hosted/environments).
|
130 |
-
|
131 |
-
If you'd like to configure a highly-available setup, there are community-contributed [Helm Charts](https://helm.sh/) and YAML files which allow Dify to be deployed on Kubernetes.
|
132 |
-
|
133 |
-
- [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
|
134 |
-
- [Helm Chart by @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
|
135 |
-
- [YAML file by @Winson-030](https://github.com/Winson-030/dify-kubernetes)
|
136 |
-
|
137 |
-
#### Using Terraform for Deployment
|
138 |
-
|
139 |
-
Deploy Dify to Cloud Platform with a single click using [terraform](https://www.terraform.io/)
|
140 |
-
|
141 |
-
##### Azure Global
|
142 |
-
- [Azure Terraform by @nikawang](https://github.com/nikawang/dify-azure-terraform)
|
143 |
-
|
144 |
-
##### Google Cloud
|
145 |
-
- [Google Cloud Terraform by @sotazum](https://github.com/DeNA/dify-google-cloud-terraform)
|
146 |
-
|
147 |
-
## Contributing
|
148 |
-
|
149 |
-
For those who'd like to contribute code, see our [Contribution Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
|
150 |
-
At the same time, please consider supporting Dify by sharing it on social media and at events and conferences.
|
151 |
-
|
152 |
-
|
153 |
-
> We are looking for contributors to help with translating Dify to languages other than Mandarin or English. If you are interested in helping, please see the [i18n README](https://github.com/langgenius/dify/blob/main/web/i18n/README.md) for more information, and leave us a comment in the `global-users` channel of our [Discord Community Server](https://discord.gg/8Tpq4AcN9c).
|
154 |
-
|
155 |
-
## Community & contact
|
156 |
-
|
157 |
-
* [Github Discussion](https://github.com/langgenius/dify/discussions). Best for: sharing feedback and asking questions.
|
158 |
-
* [GitHub Issues](https://github.com/langgenius/dify/issues). Best for: bugs you encounter using Dify.AI, and feature proposals. See our [Contribution Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
|
159 |
-
* [Discord](https://discord.gg/FngNHpbcY7). Best for: sharing your applications and hanging out with the community.
|
160 |
-
* [X(Twitter)](https://twitter.com/dify_ai). Best for: sharing your applications and hanging out with the community.
|
161 |
-
|
162 |
-
**Contributors**
|
163 |
-
|
164 |
-
<a href="https://github.com/langgenius/dify/graphs/contributors">
|
165 |
-
<img src="https://contrib.rocks/image?repo=langgenius/dify" />
|
166 |
-
</a>
|
167 |
-
|
168 |
-
## Star history
|
169 |
-
|
170 |
-
[![Star History Chart](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
|
171 |
-
|
172 |
-
|
173 |
-
## Security disclosure
|
174 |
-
|
175 |
-
To protect your privacy, please avoid posting security issues on GitHub. Instead, send your questions to security@dify.ai and we will provide you with a more detailed answer.
|
176 |
-
|
177 |
-
## License
|
178 |
-
|
179 |
-
This repository is available under the [Dify Open Source License](LICENSE), which is essentially Apache 2.0 with a few additional restrictions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api/README.md
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
# Dify Backend API
|
2 |
-
|
3 |
-
## Usage
|
4 |
-
|
5 |
-
> [!IMPORTANT]
|
6 |
-
> In the v0.6.12 release, we deprecated `pip` as the package management tool for Dify API Backend service and replaced it with `poetry`.
|
7 |
-
|
8 |
-
1. Start the docker-compose stack
|
9 |
-
|
10 |
-
The backend require some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using `docker-compose`.
|
11 |
-
|
12 |
-
```bash
|
13 |
-
cd ../docker
|
14 |
-
cp middleware.env.example middleware.env
|
15 |
-
# change the profile to other vector database if you are not using weaviate
|
16 |
-
docker compose -f docker-compose.middleware.yaml --profile weaviate -p dify up -d
|
17 |
-
cd ../api
|
18 |
-
```
|
19 |
-
|
20 |
-
2. Copy `.env.example` to `.env`
|
21 |
-
3. Generate a `SECRET_KEY` in the `.env` file.
|
22 |
-
|
23 |
-
```bash for Linux
|
24 |
-
sed -i "/^SECRET_KEY=/c\SECRET_KEY=$(openssl rand -base64 42)" .env
|
25 |
-
```
|
26 |
-
|
27 |
-
```bash for Mac
|
28 |
-
secret_key=$(openssl rand -base64 42)
|
29 |
-
sed -i '' "/^SECRET_KEY=/c\\
|
30 |
-
SECRET_KEY=${secret_key}" .env
|
31 |
-
```
|
32 |
-
|
33 |
-
4. Create environment.
|
34 |
-
|
35 |
-
Dify API service uses [Poetry](https://python-poetry.org/docs/) to manage dependencies. You can execute `poetry shell` to activate the environment.
|
36 |
-
|
37 |
-
5. Install dependencies
|
38 |
-
|
39 |
-
```bash
|
40 |
-
poetry env use 3.10
|
41 |
-
poetry install
|
42 |
-
```
|
43 |
-
|
44 |
-
In case of contributors missing to update dependencies for `pyproject.toml`, you can perform the following shell instead.
|
45 |
-
|
46 |
-
```bash
|
47 |
-
poetry shell # activate current environment
|
48 |
-
poetry add $(cat requirements.txt) # install dependencies of production and update pyproject.toml
|
49 |
-
poetry add $(cat requirements-dev.txt) --group dev # install dependencies of development and update pyproject.toml
|
50 |
-
```
|
51 |
-
|
52 |
-
6. Run migrate
|
53 |
-
|
54 |
-
Before the first launch, migrate the database to the latest version.
|
55 |
-
|
56 |
-
```bash
|
57 |
-
poetry run python -m flask db upgrade
|
58 |
-
```
|
59 |
-
|
60 |
-
7. Start backend
|
61 |
-
|
62 |
-
```bash
|
63 |
-
poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug
|
64 |
-
```
|
65 |
-
|
66 |
-
8. Start Dify [web](../web) service.
|
67 |
-
9. Setup your application by visiting `http://localhost:3000`...
|
68 |
-
10. If you need to handle and debug the async tasks (e.g. dataset importing and documents indexing), please start the worker service.
|
69 |
-
|
70 |
-
```bash
|
71 |
-
poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion
|
72 |
-
```
|
73 |
-
|
74 |
-
## Testing
|
75 |
-
|
76 |
-
1. Install dependencies for both the backend and the test environment
|
77 |
-
|
78 |
-
```bash
|
79 |
-
poetry install -C api --with dev
|
80 |
-
```
|
81 |
-
|
82 |
-
2. Run the tests locally with mocked system environment variables in `tool.pytest_env` section in `pyproject.toml`
|
83 |
-
|
84 |
-
```bash
|
85 |
-
poetry run -C api bash dev/pytest/pytest_all_tests.sh
|
86 |
-
```
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api/core/app/apps/README.md
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
## Guidelines for Database Connection Management in App Runner and Task Pipeline
|
2 |
-
|
3 |
-
Due to the presence of tasks in App Runner that require long execution times, such as LLM generation and external requests, Flask-Sqlalchemy's strategy for database connection pooling is to allocate one connection (transaction) per request. This approach keeps a connection occupied even during non-DB tasks, leading to the inability to acquire new connections during high concurrency requests due to multiple long-running tasks.
|
4 |
-
|
5 |
-
Therefore, the database operations in App Runner and Task Pipeline must ensure connections are closed immediately after use, and it's better to pass IDs rather than Model objects to avoid deattach errors.
|
6 |
-
|
7 |
-
Examples:
|
8 |
-
|
9 |
-
1. Creating a new record:
|
10 |
-
|
11 |
-
```python
|
12 |
-
app = App(id=1)
|
13 |
-
db.session.add(app)
|
14 |
-
db.session.commit()
|
15 |
-
db.session.refresh(app) # Retrieve table default values, like created_at, cached in the app object, won't affect after close
|
16 |
-
|
17 |
-
# Handle non-long-running tasks or store the content of the App instance in memory (via variable assignment).
|
18 |
-
|
19 |
-
db.session.close()
|
20 |
-
|
21 |
-
return app.id
|
22 |
-
```
|
23 |
-
|
24 |
-
2. Fetching a record from the table:
|
25 |
-
|
26 |
-
```python
|
27 |
-
app = db.session.query(App).filter(App.id == app_id).first()
|
28 |
-
|
29 |
-
created_at = app.created_at
|
30 |
-
|
31 |
-
db.session.close()
|
32 |
-
|
33 |
-
# Handle tasks (include long-running).
|
34 |
-
|
35 |
-
```
|
36 |
-
|
37 |
-
3. Updating a table field:
|
38 |
-
|
39 |
-
```python
|
40 |
-
app = db.session.query(App).filter(App.id == app_id).first()
|
41 |
-
|
42 |
-
app.updated_at = time.utcnow()
|
43 |
-
db.session.commit()
|
44 |
-
db.session.close()
|
45 |
-
|
46 |
-
return app_id
|
47 |
-
```
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api/core/model_runtime/README.md
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
# Model Runtime
|
2 |
-
|
3 |
-
This module provides the interface for invoking and authenticating various models, and offers Dify a unified information and credentials form rule for model providers.
|
4 |
-
|
5 |
-
- On one hand, it decouples models from upstream and downstream processes, facilitating horizontal expansion for developers,
|
6 |
-
- On the other hand, it allows for direct display of providers and models in the frontend interface by simply defining them in the backend, eliminating the need to modify frontend logic.
|
7 |
-
|
8 |
-
## Features
|
9 |
-
|
10 |
-
- Supports capability invocation for 5 types of models
|
11 |
-
|
12 |
-
- `LLM` - LLM text completion, dialogue, pre-computed tokens capability
|
13 |
-
- `Text Embedding Model` - Text Embedding, pre-computed tokens capability
|
14 |
-
- `Rerank Model` - Segment Rerank capability
|
15 |
-
- `Speech-to-text Model` - Speech to text capability
|
16 |
-
- `Text-to-speech Model` - Text to speech capability
|
17 |
-
- `Moderation` - Moderation capability
|
18 |
-
|
19 |
-
- Model provider display
|
20 |
-
|
21 |
-
![image-20231210143654461](./docs/en_US/images/index/image-20231210143654461.png)
|
22 |
-
|
23 |
-
Displays a list of all supported providers, including provider names, icons, supported model types list, predefined model list, configuration method, and credentials form rules, etc. For detailed rule design, see: [Schema](./docs/en_US/schema.md).
|
24 |
-
|
25 |
-
- Selectable model list display
|
26 |
-
|
27 |
-
![image-20231210144229650](./docs/en_US/images/index/image-20231210144229650.png)
|
28 |
-
|
29 |
-
After configuring provider/model credentials, the dropdown (application orchestration interface/default model) allows viewing of the available LLM list. Greyed out items represent predefined model lists from providers without configured credentials, facilitating user review of supported models.
|
30 |
-
|
31 |
-
In addition, this list also returns configurable parameter information and rules for LLM, as shown below:
|
32 |
-
|
33 |
-
![image-20231210144814617](./docs/en_US/images/index/image-20231210144814617.png)
|
34 |
-
|
35 |
-
These parameters are all defined in the backend, allowing different settings for various parameters supported by different models, as detailed in: [Schema](./docs/en_US/schema.md#ParameterRule).
|
36 |
-
|
37 |
-
- Provider/model credential authentication
|
38 |
-
|
39 |
-
![image-20231210151548521](./docs/en_US/images/index/image-20231210151548521.png)
|
40 |
-
|
41 |
-
![image-20231210151628992](./docs/en_US/images/index/image-20231210151628992.png)
|
42 |
-
|
43 |
-
The provider list returns configuration information for the credentials form, which can be authenticated through Runtime's interface. The first image above is a provider credential DEMO, and the second is a model credential DEMO.
|
44 |
-
|
45 |
-
## Structure
|
46 |
-
|
47 |
-
![](./docs/en_US/images/index/image-20231210165243632.png)
|
48 |
-
|
49 |
-
Model Runtime is divided into three layers:
|
50 |
-
|
51 |
-
- The outermost layer is the factory method
|
52 |
-
|
53 |
-
It provides methods for obtaining all providers, all model lists, getting provider instances, and authenticating provider/model credentials.
|
54 |
-
|
55 |
-
- The second layer is the provider layer
|
56 |
-
|
57 |
-
It provides the current provider's model list, model instance obtaining, provider credential authentication, and provider configuration rule information, **allowing horizontal expansion** to support different providers.
|
58 |
-
|
59 |
-
- The bottom layer is the model layer
|
60 |
-
|
61 |
-
It offers direct invocation of various model types, predefined model configuration information, getting predefined/remote model lists, model credential authentication methods. Different models provide additional special methods, like LLM's pre-computed tokens method, cost information obtaining method, etc., **allowing horizontal expansion** for different models under the same provider (within supported model types).
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
## Next Steps
|
66 |
-
|
67 |
-
- Add new provider configuration: [Link](./docs/en_US/provider_scale_out.md)
|
68 |
-
- Add new models for existing providers: [Link](./docs/en_US/provider_scale_out.md#AddModel)
|
69 |
-
- View YAML configuration rules: [Link](./docs/en_US/schema.md)
|
70 |
-
- Implement interface methods: [Link](./docs/en_US/interfaces.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api/core/tools/README.md
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
# Tools
|
2 |
-
|
3 |
-
This module implements built-in tools used in Agent Assistants and Workflows within Dify. You could define and display your own tools in this module, without modifying the frontend logic. This decoupling allows for easier horizontal scaling of Dify's capabilities.
|
4 |
-
|
5 |
-
## Feature Introduction
|
6 |
-
|
7 |
-
The tools provided for Agents and Workflows are currently divided into two categories:
|
8 |
-
- `Built-in Tools` are internally implemented within our product and are hardcoded for use in Agents and Workflows.
|
9 |
-
- `Api-Based Tools` leverage third-party APIs for implementation. You don't need to code to integrate these -- simply provide interface definitions in formats like `OpenAPI` , `Swagger`, or the `OpenAI-plugin` on the front-end.
|
10 |
-
|
11 |
-
### Built-in Tool Providers
|
12 |
-
![Alt text](docs/images/index/image.png)
|
13 |
-
|
14 |
-
### API Tool Providers
|
15 |
-
![Alt text](docs/images/index/image-1.png)
|
16 |
-
|
17 |
-
## Tool Integration
|
18 |
-
|
19 |
-
To enable developers to build flexible and powerful tools, we provide two guides:
|
20 |
-
|
21 |
-
### [Quick Integration 👈🏻](./docs/en_US/tool_scale_out.md)
|
22 |
-
Quick integration aims at quickly getting you up to speed with tool integration by walking over an example Google Search tool.
|
23 |
-
|
24 |
-
### [Advanced Integration 👈🏻](./docs/en_US/advanced_scale_out.md)
|
25 |
-
Advanced integration will offer a deeper dive into the module interfaces, and explain how to implement more complex capabilities, such as generating images, combining multiple tools, and managing the flow of parameters, images, and files between different tools.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docker/README.md
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
## README for docker Deployment
|
2 |
-
|
3 |
-
Welcome to the new `docker` directory for deploying Dify using Docker Compose. This README outlines the updates, deployment instructions, and migration details for existing users.
|
4 |
-
|
5 |
-
### What's Updated
|
6 |
-
|
7 |
-
- **Certbot Container**: `docker-compose.yaml` now contains `certbot` for managing SSL certificates. This container automatically renews certificates and ensures secure HTTPS connections.
|
8 |
-
For more information, refer `docker/certbot/README.md`.
|
9 |
-
|
10 |
-
- **Persistent Environment Variables**: Environment variables are now managed through a `.env` file, ensuring that your configurations persist across deployments.
|
11 |
-
|
12 |
-
> What is `.env`? </br> </br>
|
13 |
-
> The `.env` file is a crucial component in Docker and Docker Compose environments, serving as a centralized configuration file where you can define environment variables that are accessible to the containers at runtime. This file simplifies the management of environment settings across different stages of development, testing, and production, providing consistency and ease of configuration to deployments.
|
14 |
-
|
15 |
-
- **Unified Vector Database Services**: All vector database services are now managed from a single Docker Compose file `docker-compose.yaml`. You can switch between different vector databases by setting the `VECTOR_STORE` environment variable in your `.env` file.
|
16 |
-
- **Mandatory .env File**: A `.env` file is now required to run `docker compose up`. This file is crucial for configuring your deployment and for any custom settings to persist through upgrades.
|
17 |
-
- **Legacy Support**: Previous deployment files are now located in the `docker-legacy` directory and will no longer be maintained.
|
18 |
-
|
19 |
-
### How to Deploy Dify with `docker-compose.yaml`
|
20 |
-
|
21 |
-
1. **Prerequisites**: Ensure Docker and Docker Compose are installed on your system.
|
22 |
-
2. **Environment Setup**:
|
23 |
-
- Navigate to the `docker` directory.
|
24 |
-
- Copy the `.env.example` file to a new file named `.env` by running `cp .env.example .env`.
|
25 |
-
- Customize the `.env` file as needed. Refer to the `.env.example` file for detailed configuration options.
|
26 |
-
3. **Running the Services**:
|
27 |
-
- Execute `docker compose up` from the `docker` directory to start the services.
|
28 |
-
- To specify a vector database, set the `VECTOR_STORE` variable in your `.env` file to your desired vector database service, such as `milvus`, `weaviate`, or `opensearch`.
|
29 |
-
4. **SSL Certificate Setup**:
|
30 |
-
- Rrefer `docker/certbot/README.md` to set up SSL certificates using Certbot.
|
31 |
-
|
32 |
-
### How to Deploy Middleware for Developing Dify
|
33 |
-
|
34 |
-
1. **Middleware Setup**:
|
35 |
-
- Use the `docker-compose.middleware.yaml` for setting up essential middleware services like databases and caches.
|
36 |
-
- Navigate to the `docker` directory.
|
37 |
-
- Ensure the `middleware.env` file is created by running `cp middleware.env.example middleware.env` (refer to the `middleware.env.example` file).
|
38 |
-
2. **Running Middleware Services**:
|
39 |
-
- Execute `docker-compose -f docker-compose.middleware.yaml up -d` to start the middleware services.
|
40 |
-
|
41 |
-
### Migration for Existing Users
|
42 |
-
|
43 |
-
For users migrating from the `docker-legacy` setup:
|
44 |
-
|
45 |
-
1. **Review Changes**: Familiarize yourself with the new `.env` configuration and Docker Compose setup.
|
46 |
-
2. **Transfer Customizations**:
|
47 |
-
- If you have customized configurations such as `docker-compose.yaml`, `ssrf_proxy/squid.conf`, or `nginx/conf.d/default.conf`, you will need to reflect these changes in the `.env` file you create.
|
48 |
-
3. **Data Migration**:
|
49 |
-
- Ensure that data from services like databases and caches is backed up and migrated appropriately to the new structure if necessary.
|
50 |
-
|
51 |
-
### Overview of `.env`
|
52 |
-
|
53 |
-
#### Key Modules and Customization
|
54 |
-
|
55 |
-
- **Vector Database Services**: Depending on the type of vector database used (`VECTOR_STORE`), users can set specific endpoints, ports, and authentication details.
|
56 |
-
- **Storage Services**: Depending on the storage type (`STORAGE_TYPE`), users can configure specific settings for S3, Azure Blob, Google Storage, etc.
|
57 |
-
- **API and Web Services**: Users can define URLs and other settings that affect how the API and web frontends operate.
|
58 |
-
|
59 |
-
#### Other notable variables
|
60 |
-
|
61 |
-
The `.env.example` file provided in the Docker setup is extensive and covers a wide range of configuration options. It is structured into several sections, each pertaining to different aspects of the application and its services. Here are some of the key sections and variables:
|
62 |
-
|
63 |
-
1. **Common Variables**:
|
64 |
-
- `CONSOLE_API_URL`, `SERVICE_API_URL`: URLs for different API services.
|
65 |
-
- `APP_WEB_URL`: Frontend application URL.
|
66 |
-
- `FILES_URL`: Base URL for file downloads and previews.
|
67 |
-
|
68 |
-
2. **Server Configuration**:
|
69 |
-
- `LOG_LEVEL`, `DEBUG`, `FLASK_DEBUG`: Logging and debug settings.
|
70 |
-
- `SECRET_KEY`: A key for encrypting session cookies and other sensitive data.
|
71 |
-
|
72 |
-
3. **Database Configuration**:
|
73 |
-
- `DB_USERNAME`, `DB_PASSWORD`, `DB_HOST`, `DB_PORT`, `DB_DATABASE`: PostgreSQL database credentials and connection details.
|
74 |
-
|
75 |
-
4. **Redis Configuration**:
|
76 |
-
- `REDIS_HOST`, `REDIS_PORT`, `REDIS_PASSWORD`: Redis server connection settings.
|
77 |
-
|
78 |
-
5. **Celery Configuration**:
|
79 |
-
- `CELERY_BROKER_URL`: Configuration for Celery message broker.
|
80 |
-
|
81 |
-
6. **Storage Configuration**:
|
82 |
-
- `STORAGE_TYPE`, `S3_BUCKET_NAME`, `AZURE_BLOB_ACCOUNT_NAME`: Settings for file storage options like local, S3, Azure Blob, etc.
|
83 |
-
|
84 |
-
7. **Vector Database Configuration**:
|
85 |
-
- `VECTOR_STORE`: Type of vector database (e.g., `weaviate`, `milvus`).
|
86 |
-
- Specific settings for each vector store like `WEAVIATE_ENDPOINT`, `MILVUS_URI`.
|
87 |
-
|
88 |
-
8. **CORS Configuration**:
|
89 |
-
- `WEB_API_CORS_ALLOW_ORIGINS`, `CONSOLE_CORS_ALLOW_ORIGINS`: Settings for cross-origin resource sharing.
|
90 |
-
|
91 |
-
9. **Other Service-Specific Environment Variables**:
|
92 |
-
- Each service like `nginx`, `redis`, `db`, and vector databases have specific environment variables that are directly referenced in the `docker-compose.yaml`.
|
93 |
-
|
94 |
-
### Additional Information
|
95 |
-
|
96 |
-
- **Continuous Improvement Phase**: We are actively seeking feedback from the community to refine and enhance the deployment process. As more users adopt this new method, we will continue to make improvements based on your experiences and suggestions.
|
97 |
-
- **Support**: For detailed configuration options and environment variable settings, refer to the `.env.example` file and the Docker Compose configuration files in the `docker` directory.
|
98 |
-
|
99 |
-
This README aims to guide you through the deployment process using the new Docker Compose setup. For any issues or further assistance, please refer to the official documentation or contact support.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docker/certbot/README.md
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
# Launching new servers with SSL certificates
|
2 |
-
|
3 |
-
## Short description
|
4 |
-
|
5 |
-
docker compose certbot configurations with Backward compatibility (without certbot container).
|
6 |
-
Use `docker compose --profile certbot up` to use this features.
|
7 |
-
|
8 |
-
## The simplest way for launching new servers with SSL certificates
|
9 |
-
|
10 |
-
1. Get letsencrypt certs
|
11 |
-
set `.env` values
|
12 |
-
```properties
|
13 |
-
NGINX_SSL_CERT_FILENAME=fullchain.pem
|
14 |
-
NGINX_SSL_CERT_KEY_FILENAME=privkey.pem
|
15 |
-
NGINX_ENABLE_CERTBOT_CHALLENGE=true
|
16 |
-
CERTBOT_DOMAIN=your_domain.com
|
17 |
-
CERTBOT_EMAIL=example@your_domain.com
|
18 |
-
```
|
19 |
-
execute command:
|
20 |
-
```shell
|
21 |
-
docker network prune
|
22 |
-
docker compose --profile certbot up --force-recreate -d
|
23 |
-
```
|
24 |
-
then after the containers launched:
|
25 |
-
```shell
|
26 |
-
docker compose exec -it certbot /bin/sh /update-cert.sh
|
27 |
-
```
|
28 |
-
2. Edit `.env` file and `docker compose --profile certbot up` again.
|
29 |
-
set `.env` value additionally
|
30 |
-
```properties
|
31 |
-
NGINX_HTTPS_ENABLED=true
|
32 |
-
```
|
33 |
-
execute command:
|
34 |
-
```shell
|
35 |
-
docker compose --profile certbot up -d --no-deps --force-recreate nginx
|
36 |
-
```
|
37 |
-
Then you can access your serve with HTTPS.
|
38 |
-
[https://your_domain.com](https://your_domain.com)
|
39 |
-
|
40 |
-
## SSL certificates renewal
|
41 |
-
|
42 |
-
For SSL certificates renewal, execute commands below:
|
43 |
-
|
44 |
-
```shell
|
45 |
-
docker compose exec -it certbot /bin/sh /update-cert.sh
|
46 |
-
docker compose exec nginx nginx -s reload
|
47 |
-
```
|
48 |
-
|
49 |
-
## Options for certbot
|
50 |
-
|
51 |
-
`CERTBOT_OPTIONS` key might be helpful for testing. i.e.,
|
52 |
-
|
53 |
-
```properties
|
54 |
-
CERTBOT_OPTIONS=--dry-run
|
55 |
-
```
|
56 |
-
|
57 |
-
To apply changes to `CERTBOT_OPTIONS`, regenerate the certbot container before updating the certificates.
|
58 |
-
|
59 |
-
```shell
|
60 |
-
docker compose --profile certbot up -d --no-deps --force-recreate certbot
|
61 |
-
docker compose exec -it certbot /bin/sh /update-cert.sh
|
62 |
-
```
|
63 |
-
|
64 |
-
Then, reload the nginx container if necessary.
|
65 |
-
|
66 |
-
```shell
|
67 |
-
docker compose exec nginx nginx -s reload
|
68 |
-
```
|
69 |
-
|
70 |
-
## For legacy servers
|
71 |
-
|
72 |
-
To use cert files dir `nginx/ssl` as before, simply launch containers WITHOUT `--profile certbot` option.
|
73 |
-
|
74 |
-
```shell
|
75 |
-
docker compose up -d
|
76 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdks/README.md
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
# SDK
|
2 |
-
|
3 |
-
## Java
|
4 |
-
|
5 |
-
https://github.com/langgenius/java-client/
|
6 |
-
|
7 |
-
## Go
|
8 |
-
|
9 |
-
https://github.com/langgenius/dify-sdk-go
|
10 |
-
|
11 |
-
## Ruby
|
12 |
-
|
13 |
-
https://github.com/langgenius/ruby-sdk
|
14 |
-
|
15 |
-
## Python
|
16 |
-
|
17 |
-
TODO move to another place
|
18 |
-
|
19 |
-
## PHP
|
20 |
-
|
21 |
-
TODO move to another place
|
22 |
-
|
23 |
-
## Node.js
|
24 |
-
|
25 |
-
TODO move to another place
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdks/nodejs-client/README.md
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
# Dify Node.js SDK
|
2 |
-
This is the Node.js SDK for the Dify API, which allows you to easily integrate Dify into your Node.js applications.
|
3 |
-
|
4 |
-
## Install
|
5 |
-
```bash
|
6 |
-
npm install dify-client
|
7 |
-
```
|
8 |
-
|
9 |
-
## Usage
|
10 |
-
After installing the SDK, you can use it in your project like this:
|
11 |
-
|
12 |
-
```js
|
13 |
-
import { DifyClient, ChatClient, CompletionClient } from 'dify-client'
|
14 |
-
|
15 |
-
const API_KEY = 'your-api-key-here'
|
16 |
-
const user = `random-user-id`
|
17 |
-
const query = 'Please tell me a short story in 10 words or less.'
|
18 |
-
const remote_url_files = [{
|
19 |
-
type: 'image',
|
20 |
-
transfer_method: 'remote_url',
|
21 |
-
url: 'your_url_address'
|
22 |
-
}]
|
23 |
-
|
24 |
-
// Create a completion client
|
25 |
-
const completionClient = new CompletionClient(API_KEY)
|
26 |
-
// Create a completion message
|
27 |
-
completionClient.createCompletionMessage({'query': query}, user)
|
28 |
-
// Create a completion message with vision model
|
29 |
-
completionClient.createCompletionMessage({'query': 'Describe the picture.'}, user, false, remote_url_files)
|
30 |
-
|
31 |
-
// Create a chat client
|
32 |
-
const chatClient = new ChatClient(API_KEY)
|
33 |
-
// Create a chat message in stream mode
|
34 |
-
const response = await chatClient.createChatMessage({}, query, user, true, null)
|
35 |
-
const stream = response.data;
|
36 |
-
stream.on('data', data => {
|
37 |
-
console.log(data);
|
38 |
-
});
|
39 |
-
stream.on('end', () => {
|
40 |
-
console.log('stream done');
|
41 |
-
});
|
42 |
-
// Create a chat message with vision model
|
43 |
-
chatClient.createChatMessage({}, 'Describe the picture.', user, false, null, remote_url_files)
|
44 |
-
// Fetch conversations
|
45 |
-
chatClient.getConversations(user)
|
46 |
-
// Fetch conversation messages
|
47 |
-
chatClient.getConversationMessages(conversationId, user)
|
48 |
-
// Rename conversation
|
49 |
-
chatClient.renameConversation(conversationId, name, user)
|
50 |
-
|
51 |
-
|
52 |
-
const client = new DifyClient(API_KEY)
|
53 |
-
// Fetch application parameters
|
54 |
-
client.getApplicationParameters(user)
|
55 |
-
// Provide feedback for a message
|
56 |
-
client.messageFeedback(messageId, rating, user)
|
57 |
-
|
58 |
-
```
|
59 |
-
|
60 |
-
Replace 'your-api-key-here' with your actual Dify API key.Replace 'your-app-id-here' with your actual Dify APP ID.
|
61 |
-
|
62 |
-
## License
|
63 |
-
This SDK is released under the MIT License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdks/php-client/README.md
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
# Dify PHP SDK
|
2 |
-
|
3 |
-
This is the PHP SDK for the Dify API, which allows you to easily integrate Dify into your PHP applications.
|
4 |
-
|
5 |
-
## Requirements
|
6 |
-
|
7 |
-
- PHP 7.2 or later
|
8 |
-
- Guzzle HTTP client library
|
9 |
-
|
10 |
-
## Usage
|
11 |
-
|
12 |
-
After installing the SDK, you can use it in your project like this:
|
13 |
-
|
14 |
-
```php
|
15 |
-
<?php
|
16 |
-
|
17 |
-
require 'vendor/autoload.php';
|
18 |
-
|
19 |
-
use YourVendorName\DifyPHP\DifyClient;
|
20 |
-
use YourVendorName\DifyPHP\CompletionClient;
|
21 |
-
use YourVendorName\DifyPHP\ChatClient;
|
22 |
-
|
23 |
-
$apiKey = 'your-api-key-here';
|
24 |
-
|
25 |
-
$difyClient = new DifyClient($apiKey);
|
26 |
-
|
27 |
-
// Create a completion client
|
28 |
-
$completionClient = new CompletionClient($apiKey);
|
29 |
-
$response = $completionClient->create_completion_message(array("query" => "Who are you?"), "blocking", "user_id");
|
30 |
-
|
31 |
-
// Create a chat client
|
32 |
-
$chatClient = new ChatClient($apiKey);
|
33 |
-
$response = $chatClient->create_chat_message(array(), "Who are you?", "user_id", "blocking", $conversation_id);
|
34 |
-
|
35 |
-
$fileForVision = [
|
36 |
-
[
|
37 |
-
"type" => "image",
|
38 |
-
"transfer_method" => "remote_url",
|
39 |
-
"url" => "your_image_url"
|
40 |
-
]
|
41 |
-
];
|
42 |
-
|
43 |
-
// $fileForVision = [
|
44 |
-
// [
|
45 |
-
// "type" => "image",
|
46 |
-
// "transfer_method" => "local_file",
|
47 |
-
// "url" => "your_file_id"
|
48 |
-
// ]
|
49 |
-
// ];
|
50 |
-
|
51 |
-
// Create a completion client with vision model like gpt-4-vision
|
52 |
-
$response = $completionClient->create_completion_message(array("query" => "Describe this image."), "blocking", "user_id", $fileForVision);
|
53 |
-
|
54 |
-
// Create a chat client with vision model like gpt-4-vision
|
55 |
-
$response = $chatClient->create_chat_message(array(), "Describe this image.", "user_id", "blocking", $conversation_id, $fileForVision);
|
56 |
-
|
57 |
-
// File Upload
|
58 |
-
$fileForUpload = [
|
59 |
-
[
|
60 |
-
'tmp_name' => '/path/to/file/filename.jpg',
|
61 |
-
'name' => 'filename.jpg'
|
62 |
-
]
|
63 |
-
];
|
64 |
-
$response = $difyClient->file_upload("user_id", $fileForUpload);
|
65 |
-
$result = json_decode($response->getBody(), true);
|
66 |
-
echo 'upload_file_id: ' . $result['id'];
|
67 |
-
|
68 |
-
// Fetch application parameters
|
69 |
-
$response = $difyClient->get_application_parameters("user_id");
|
70 |
-
|
71 |
-
// Provide feedback for a message
|
72 |
-
$response = $difyClient->message_feedback($message_id, $rating, "user_id");
|
73 |
-
|
74 |
-
// Other available methods:
|
75 |
-
// - get_conversation_messages()
|
76 |
-
// - get_conversations()
|
77 |
-
// - rename_conversation()
|
78 |
-
```
|
79 |
-
|
80 |
-
Replace 'your-api-key-here' with your actual Dify API key.
|
81 |
-
|
82 |
-
## License
|
83 |
-
|
84 |
-
This SDK is released under the MIT License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sdks/python-client/README.md
DELETED
@@ -1,185 +0,0 @@
|
|
1 |
-
# dify-client
|
2 |
-
|
3 |
-
A Dify App Service-API Client, using for build a webapp by request Service-API
|
4 |
-
|
5 |
-
## Usage
|
6 |
-
|
7 |
-
First, install `dify-client` python sdk package:
|
8 |
-
|
9 |
-
```
|
10 |
-
pip install dify-client
|
11 |
-
```
|
12 |
-
|
13 |
-
Write your code with sdk:
|
14 |
-
|
15 |
-
- completion generate with `blocking` response_mode
|
16 |
-
|
17 |
-
```python
|
18 |
-
from dify_client import CompletionClient
|
19 |
-
|
20 |
-
api_key = "your_api_key"
|
21 |
-
|
22 |
-
# Initialize CompletionClient
|
23 |
-
completion_client = CompletionClient(api_key)
|
24 |
-
|
25 |
-
# Create Completion Message using CompletionClient
|
26 |
-
completion_response = completion_client.create_completion_message(inputs={"query": "What's the weather like today?"},
|
27 |
-
response_mode="blocking", user="user_id")
|
28 |
-
completion_response.raise_for_status()
|
29 |
-
|
30 |
-
result = completion_response.json()
|
31 |
-
|
32 |
-
print(result.get('answer'))
|
33 |
-
```
|
34 |
-
|
35 |
-
- completion using vision model, like gpt-4-vision
|
36 |
-
|
37 |
-
```python
|
38 |
-
from dify_client import CompletionClient
|
39 |
-
|
40 |
-
api_key = "your_api_key"
|
41 |
-
|
42 |
-
# Initialize CompletionClient
|
43 |
-
completion_client = CompletionClient(api_key)
|
44 |
-
|
45 |
-
files = [{
|
46 |
-
"type": "image",
|
47 |
-
"transfer_method": "remote_url",
|
48 |
-
"url": "your_image_url"
|
49 |
-
}]
|
50 |
-
|
51 |
-
# files = [{
|
52 |
-
# "type": "image",
|
53 |
-
# "transfer_method": "local_file",
|
54 |
-
# "upload_file_id": "your_file_id"
|
55 |
-
# }]
|
56 |
-
|
57 |
-
# Create Completion Message using CompletionClient
|
58 |
-
completion_response = completion_client.create_completion_message(inputs={"query": "Describe the picture."},
|
59 |
-
response_mode="blocking", user="user_id", files=files)
|
60 |
-
completion_response.raise_for_status()
|
61 |
-
|
62 |
-
result = completion_response.json()
|
63 |
-
|
64 |
-
print(result.get('answer'))
|
65 |
-
```
|
66 |
-
|
67 |
-
- chat generate with `streaming` response_mode
|
68 |
-
|
69 |
-
```python
|
70 |
-
import json
|
71 |
-
from dify_client import ChatClient
|
72 |
-
|
73 |
-
api_key = "your_api_key"
|
74 |
-
|
75 |
-
# Initialize ChatClient
|
76 |
-
chat_client = ChatClient(api_key)
|
77 |
-
|
78 |
-
# Create Chat Message using ChatClient
|
79 |
-
chat_response = chat_client.create_chat_message(inputs={}, query="Hello", user="user_id", response_mode="streaming")
|
80 |
-
chat_response.raise_for_status()
|
81 |
-
|
82 |
-
for line in chat_response.iter_lines(decode_unicode=True):
|
83 |
-
line = line.split('data:', 1)[-1]
|
84 |
-
if line.strip():
|
85 |
-
line = json.loads(line.strip())
|
86 |
-
print(line.get('answer'))
|
87 |
-
```
|
88 |
-
|
89 |
-
- chat using vision model, like gpt-4-vision
|
90 |
-
|
91 |
-
```python
|
92 |
-
from dify_client import ChatClient
|
93 |
-
|
94 |
-
api_key = "your_api_key"
|
95 |
-
|
96 |
-
# Initialize ChatClient
|
97 |
-
chat_client = ChatClient(api_key)
|
98 |
-
|
99 |
-
files = [{
|
100 |
-
"type": "image",
|
101 |
-
"transfer_method": "remote_url",
|
102 |
-
"url": "your_image_url"
|
103 |
-
}]
|
104 |
-
|
105 |
-
# files = [{
|
106 |
-
# "type": "image",
|
107 |
-
# "transfer_method": "local_file",
|
108 |
-
# "upload_file_id": "your_file_id"
|
109 |
-
# }]
|
110 |
-
|
111 |
-
# Create Chat Message using ChatClient
|
112 |
-
chat_response = chat_client.create_chat_message(inputs={}, query="Describe the picture.", user="user_id",
|
113 |
-
response_mode="blocking", files=files)
|
114 |
-
chat_response.raise_for_status()
|
115 |
-
|
116 |
-
result = chat_response.json()
|
117 |
-
|
118 |
-
print(result.get("answer"))
|
119 |
-
```
|
120 |
-
|
121 |
-
- upload file when using vision model
|
122 |
-
|
123 |
-
```python
|
124 |
-
from dify_client import DifyClient
|
125 |
-
|
126 |
-
api_key = "your_api_key"
|
127 |
-
|
128 |
-
# Initialize Client
|
129 |
-
dify_client = DifyClient(api_key)
|
130 |
-
|
131 |
-
file_path = "your_image_file_path"
|
132 |
-
file_name = "panda.jpeg"
|
133 |
-
mime_type = "image/jpeg"
|
134 |
-
|
135 |
-
with open(file_path, "rb") as file:
|
136 |
-
files = {
|
137 |
-
"file": (file_name, file, mime_type)
|
138 |
-
}
|
139 |
-
response = dify_client.file_upload("user_id", files)
|
140 |
-
|
141 |
-
result = response.json()
|
142 |
-
print(f'upload_file_id: {result.get("id")}')
|
143 |
-
```
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
- Others
|
148 |
-
|
149 |
-
```python
|
150 |
-
from dify_client import ChatClient
|
151 |
-
|
152 |
-
api_key = "your_api_key"
|
153 |
-
|
154 |
-
# Initialize Client
|
155 |
-
client = ChatClient(api_key)
|
156 |
-
|
157 |
-
# Get App parameters
|
158 |
-
parameters = client.get_application_parameters(user="user_id")
|
159 |
-
parameters.raise_for_status()
|
160 |
-
|
161 |
-
print('[parameters]')
|
162 |
-
print(parameters.json())
|
163 |
-
|
164 |
-
# Get Conversation List (only for chat)
|
165 |
-
conversations = client.get_conversations(user="user_id")
|
166 |
-
conversations.raise_for_status()
|
167 |
-
|
168 |
-
print('[conversations]')
|
169 |
-
print(conversations.json())
|
170 |
-
|
171 |
-
# Get Message List (only for chat)
|
172 |
-
messages = client.get_conversation_messages(user="user_id", conversation_id="conversation_id")
|
173 |
-
messages.raise_for_status()
|
174 |
-
|
175 |
-
print('[messages]')
|
176 |
-
print(messages.json())
|
177 |
-
|
178 |
-
# Rename Conversation (only for chat)
|
179 |
-
rename_conversation_response = client.rename_conversation(conversation_id="conversation_id",
|
180 |
-
name="new_name", user="user_id")
|
181 |
-
rename_conversation_response.raise_for_status()
|
182 |
-
|
183 |
-
print('[rename result]')
|
184 |
-
print(rename_conversation_response.json())
|
185 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/README.md
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
# Dify Frontend
|
2 |
-
|
3 |
-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
4 |
-
|
5 |
-
## Getting Started
|
6 |
-
|
7 |
-
### Run by source code
|
8 |
-
|
9 |
-
To start the web frontend service, you will need [Node.js v18.x (LTS)](https://nodejs.org/en) and [NPM version 8.x.x](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/).
|
10 |
-
|
11 |
-
First, install the dependencies:
|
12 |
-
|
13 |
-
```bash
|
14 |
-
npm install
|
15 |
-
# or
|
16 |
-
yarn install --frozen-lockfile
|
17 |
-
```
|
18 |
-
|
19 |
-
Then, configure the environment variables. Create a file named `.env.local` in the current directory and copy the contents from `.env.example`. Modify the values of these environment variables according to your requirements:
|
20 |
-
|
21 |
-
```bash
|
22 |
-
cp .env.example .env.local
|
23 |
-
```
|
24 |
-
|
25 |
-
```
|
26 |
-
# For production release, change this to PRODUCTION
|
27 |
-
NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT
|
28 |
-
# The deployment edition, SELF_HOSTED
|
29 |
-
NEXT_PUBLIC_EDITION=SELF_HOSTED
|
30 |
-
# The base URL of console application, refers to the Console base URL of WEB service if console domain is
|
31 |
-
# different from api or web app domain.
|
32 |
-
# example: http://cloud.dify.ai/console/api
|
33 |
-
NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
|
34 |
-
# The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from
|
35 |
-
# console or api domain.
|
36 |
-
# example: http://udify.app/api
|
37 |
-
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
|
38 |
-
|
39 |
-
# SENTRY
|
40 |
-
NEXT_PUBLIC_SENTRY_DSN=
|
41 |
-
```
|
42 |
-
|
43 |
-
Finally, run the development server:
|
44 |
-
|
45 |
-
```bash
|
46 |
-
npm run dev
|
47 |
-
# or
|
48 |
-
yarn dev
|
49 |
-
```
|
50 |
-
|
51 |
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
52 |
-
|
53 |
-
You can start editing the file under folder `app`. The page auto-updates as you edit the file.
|
54 |
-
|
55 |
-
## Deploy
|
56 |
-
|
57 |
-
### Deploy on server
|
58 |
-
|
59 |
-
First, build the app for production:
|
60 |
-
|
61 |
-
```bash
|
62 |
-
npm run build
|
63 |
-
```
|
64 |
-
|
65 |
-
Then, start the server:
|
66 |
-
|
67 |
-
```bash
|
68 |
-
npm run start
|
69 |
-
```
|
70 |
-
|
71 |
-
If you want to customize the host and port:
|
72 |
-
|
73 |
-
```bash
|
74 |
-
npm run start --port=3001 --host=0.0.0.0
|
75 |
-
```
|
76 |
-
|
77 |
-
## Storybook
|
78 |
-
|
79 |
-
This project uses [Storybook](https://storybook.js.org/) for UI component development.
|
80 |
-
|
81 |
-
To start the storybook server, run:
|
82 |
-
|
83 |
-
```bash
|
84 |
-
yarn storybook
|
85 |
-
```
|
86 |
-
|
87 |
-
Open [http://localhost:6006](http://localhost:6006) with your browser to see the result.
|
88 |
-
|
89 |
-
## Lint Code
|
90 |
-
|
91 |
-
If your IDE is VSCode, rename `web/.vscode/settings.example.json` to `web/.vscode/settings.json` for lint code setting.
|
92 |
-
|
93 |
-
## Test
|
94 |
-
|
95 |
-
We start to use [Jest](https://jestjs.io/) and [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) for Unit Testing.
|
96 |
-
|
97 |
-
You can create a test file with a suffix of `.spec` beside the file that to be tested. For example, if you want to test a file named `util.ts`. The test file name should be `util.spec.ts`.
|
98 |
-
|
99 |
-
Run test:
|
100 |
-
|
101 |
-
```bash
|
102 |
-
npm run test
|
103 |
-
```
|
104 |
-
|
105 |
-
If you are not familiar with writing tests, here is some code to refer to:
|
106 |
-
* [classnames.spec.ts](./utils/classnames.spec.ts)
|
107 |
-
* [index.spec.tsx](./app/components/base/button/index.spec.tsx)
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
## Documentation
|
113 |
-
|
114 |
-
Visit <https://docs.dify.ai/getting-started/readme> to view the full documentation.
|
115 |
-
|
116 |
-
## Community
|
117 |
-
|
118 |
-
The Dify community can be found on [Discord community](https://discord.gg/5AEfbxcd9k), where you can ask questions, voice ideas, and share your projects.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/i18n/README.md
DELETED
@@ -1,175 +0,0 @@
|
|
1 |
-
# Internationalization (i18n)
|
2 |
-
|
3 |
-
## Introduction
|
4 |
-
|
5 |
-
This directory contains the internationalization (i18n) files for this project.
|
6 |
-
|
7 |
-
## File Structure
|
8 |
-
|
9 |
-
```
|
10 |
-
├── [ 24] README.md
|
11 |
-
├── [ 0] README_CN.md
|
12 |
-
├── [ 704] en-US
|
13 |
-
│ ├── [2.4K] app-annotation.ts
|
14 |
-
│ ├── [5.2K] app-api.ts
|
15 |
-
│ ├── [ 16K] app-debug.ts
|
16 |
-
│ ├── [2.1K] app-log.ts
|
17 |
-
│ ├── [5.3K] app-overview.ts
|
18 |
-
│ ├── [1.9K] app.ts
|
19 |
-
│ ├── [4.1K] billing.ts
|
20 |
-
│ ├── [ 17K] common.ts
|
21 |
-
│ ├── [ 859] custom.ts
|
22 |
-
│ ├── [5.7K] dataset-creation.ts
|
23 |
-
│ ├── [ 10K] dataset-documents.ts
|
24 |
-
│ ├── [ 761] dataset-hit-testing.ts
|
25 |
-
│ ├── [1.7K] dataset-settings.ts
|
26 |
-
│ ├── [2.0K] dataset.ts
|
27 |
-
│ ├── [ 941] explore.ts
|
28 |
-
│ ├── [ 52] layout.ts
|
29 |
-
│ ├── [2.3K] login.ts
|
30 |
-
│ ├── [ 52] register.ts
|
31 |
-
│ ├── [2.5K] share-app.ts
|
32 |
-
│ └── [2.8K] tools.ts
|
33 |
-
├── [1.6K] i18next-config.ts
|
34 |
-
├── [ 634] index.ts
|
35 |
-
├── [4.4K] language.ts
|
36 |
-
```
|
37 |
-
|
38 |
-
We use English as the default language. The i18n files are organized by language and then by module. For example, the English translation for the `app` module is in `en-US/app.ts`.
|
39 |
-
|
40 |
-
If you want to add a new language or modify an existing translation, you can create a new file for the language or modify the existing file. The file name should be the language code (e.g., `zh-CN` for Chinese) and the file extension should be `.ts`.
|
41 |
-
|
42 |
-
For example, if you want to add french translation, you can create a new folder `fr-FR` and add the translation files in it.
|
43 |
-
|
44 |
-
By default we will use `LanguagesSupported` to determine which languages are supported. For example, in login page and settings page, we will use `LanguagesSupported` to determine which languages are supported and display them in the language selection dropdown.
|
45 |
-
|
46 |
-
## Example
|
47 |
-
|
48 |
-
1. Create a new folder for the new language.
|
49 |
-
|
50 |
-
```
|
51 |
-
cp -r en-US fr-FR
|
52 |
-
```
|
53 |
-
|
54 |
-
2. Modify the translation files in the new folder.
|
55 |
-
|
56 |
-
3. Add type to new language in the `language.ts` file.
|
57 |
-
|
58 |
-
```typescript
|
59 |
-
export type I18nText = {
|
60 |
-
'en-US': string
|
61 |
-
'zh-Hans': string
|
62 |
-
'pt-BR': string
|
63 |
-
'es-ES': string
|
64 |
-
'fr-FR': string
|
65 |
-
'de-DE': string
|
66 |
-
'ja-JP': string
|
67 |
-
'ko-KR': string
|
68 |
-
'ru-RU': string
|
69 |
-
'it-IT': string
|
70 |
-
'uk-UA': string
|
71 |
-
'YOUR_LANGUAGE_CODE': string
|
72 |
-
}
|
73 |
-
```
|
74 |
-
|
75 |
-
4. Add the new language to the `language.ts` file.
|
76 |
-
|
77 |
-
```typescript
|
78 |
-
|
79 |
-
export const languages = [
|
80 |
-
{
|
81 |
-
value: 'en-US',
|
82 |
-
name: 'English(United States)',
|
83 |
-
example: 'Hello, Dify!',
|
84 |
-
supported: true,
|
85 |
-
},
|
86 |
-
{
|
87 |
-
value: 'zh-Hans',
|
88 |
-
name: '简体中文',
|
89 |
-
example: '你好,Dify!',
|
90 |
-
supported: true,
|
91 |
-
},
|
92 |
-
{
|
93 |
-
value: 'pt-BR',
|
94 |
-
name: 'Português(Brasil)',
|
95 |
-
example: 'Olá, Dify!',
|
96 |
-
supported: true,
|
97 |
-
},
|
98 |
-
{
|
99 |
-
value: 'es-ES',
|
100 |
-
name: 'Español(España)',
|
101 |
-
example: 'Saluton, Dify!',
|
102 |
-
supported: false,
|
103 |
-
},
|
104 |
-
{
|
105 |
-
value: 'fr-FR',
|
106 |
-
name: 'Français(France)',
|
107 |
-
example: 'Bonjour, Dify!',
|
108 |
-
supported: false,
|
109 |
-
},
|
110 |
-
{
|
111 |
-
value: 'de-DE',
|
112 |
-
name: 'Deutsch(Deutschland)',
|
113 |
-
example: 'Hallo, Dify!',
|
114 |
-
supported: false,
|
115 |
-
},
|
116 |
-
{
|
117 |
-
value: 'ja-JP',
|
118 |
-
name: '日本語(日本)',
|
119 |
-
example: 'こんにちは、Dify!',
|
120 |
-
supported: false,
|
121 |
-
},
|
122 |
-
{
|
123 |
-
value: 'ko-KR',
|
124 |
-
name: '한국어(대한민국)',
|
125 |
-
example: '안녕, Dify!',
|
126 |
-
supported: true,
|
127 |
-
},
|
128 |
-
{
|
129 |
-
value: 'ru-RU',
|
130 |
-
name: 'Русский(Россия)',
|
131 |
-
example: ' Привет, Dify!',
|
132 |
-
supported: false,
|
133 |
-
},
|
134 |
-
{
|
135 |
-
value: 'it-IT',
|
136 |
-
name: 'Italiano(Italia)',
|
137 |
-
example: 'Ciao, Dify!',
|
138 |
-
supported: false,
|
139 |
-
},
|
140 |
-
{
|
141 |
-
value: 'th-TH',
|
142 |
-
name: 'ไทย(ประเทศไทย)',
|
143 |
-
example: 'สวัสดี Dify!',
|
144 |
-
supported: false,
|
145 |
-
},
|
146 |
-
{
|
147 |
-
value: 'id-ID',
|
148 |
-
name: 'Bahasa Indonesia',
|
149 |
-
example: 'Saluto, Dify!',
|
150 |
-
supported: false,
|
151 |
-
},
|
152 |
-
{
|
153 |
-
value: 'uk-UA',
|
154 |
-
name: 'Українська(Україна)',
|
155 |
-
example: 'Привет, Dify!',
|
156 |
-
supported: true,
|
157 |
-
},
|
158 |
-
// Add your language here 👇
|
159 |
-
...
|
160 |
-
// Add your language here 👆
|
161 |
-
]
|
162 |
-
```
|
163 |
-
|
164 |
-
5. Don't forget to mark the supported field as `true` if the language is supported.
|
165 |
-
|
166 |
-
6. Sometime you might need to do some changes in the server side. Please change this file as well. 👇
|
167 |
-
https://github.com/langgenius/dify/blob/61e4bbabaf2758354db4073cbea09fdd21a5bec1/api/constants/languages.py#L5
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
## Clean Up
|
172 |
-
|
173 |
-
That's it! You have successfully added a new language to the project. If you want to remove a language, you can simply delete the folder and remove the language from the `language.ts` file.
|
174 |
-
|
175 |
-
We have a list of languages that we support in the `language.ts` file. But some of them are not supported yet. So, they are marked as `false`. If you want to support a language, you can follow the steps above and mark the supported field as `true`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|