kikuepi commited on
Commit
4304c6d
1 Parent(s): b740b05

Upload 4913 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .devcontainer/Dockerfile +5 -0
  2. .devcontainer/README.md +37 -0
  3. .devcontainer/devcontainer.json +52 -0
  4. .devcontainer/noop.txt +3 -0
  5. .devcontainer/post_create_command.sh +10 -0
  6. .devcontainer/post_start_command.sh +3 -0
  7. .devcontainer/troubleshooting.png +0 -0
  8. .gitattributes +2 -0
  9. .github/CODE_OF_CONDUCT.md +43 -0
  10. .github/ISSUE_TEMPLATE/bug_report.yml +60 -0
  11. .github/ISSUE_TEMPLATE/config.yml +5 -0
  12. .github/ISSUE_TEMPLATE/document_issue.yml +22 -0
  13. .github/ISSUE_TEMPLATE/feature_request.yml +50 -0
  14. .github/ISSUE_TEMPLATE/translation_issue.yml +54 -0
  15. .github/linters/.hadolint.yaml +1 -0
  16. .github/linters/.isort.cfg +2 -0
  17. .github/linters/.yaml-lint.yml +11 -0
  18. .github/pull_request_template.md +32 -0
  19. .github/workflows/api-tests.yml +73 -0
  20. .github/workflows/build-push.yml +64 -0
  21. .github/workflows/deploy-dev.yml +24 -0
  22. .github/workflows/stale.yml +30 -0
  23. .github/workflows/style.yml +79 -0
  24. .github/workflows/tool-test-sdks.yaml +34 -0
  25. .gitignore +158 -0
  26. AUTHORS +6 -0
  27. CONTRIBUTING.md +158 -0
  28. CONTRIBUTING_CN.md +155 -0
  29. CONTRIBUTING_JA.md +160 -0
  30. LICENSE +38 -0
  31. Makefile +43 -0
  32. README.md +243 -11
  33. README_CN.md +235 -0
  34. README_ES.md +251 -0
  35. README_FR.md +251 -0
  36. README_JA.md +246 -0
  37. README_KL.md +251 -0
  38. README_KR.md +243 -0
  39. api/.dockerignore +11 -0
  40. api/.env.example +181 -0
  41. api/.vscode/launch.json +42 -0
  42. api/Dockerfile +49 -0
  43. api/README.md +70 -0
  44. api/app.py +271 -0
  45. api/commands.py +511 -0
  46. api/config.py +393 -0
  47. api/constants/__init__.py +0 -0
  48. api/constants/languages.py +30 -0
  49. api/constants/model_template.py +86 -0
  50. api/constants/recommended_apps.json +0 -0
.devcontainer/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM mcr.microsoft.com/devcontainers/python:3.10
2
+
3
+ # [Optional] Uncomment this section to install additional OS packages.
4
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
.devcontainer/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Development with devcontainer
2
+ This project includes a devcontainer configuration that allows you to open the project in a container with a fully configured development environment.
3
+ Both frontend and backend environments are initialized when the container is started.
4
+ ## GitHub Codespaces
5
+ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/langgenius/dify)
6
+
7
+ you can simply click the button above to open this project in GitHub Codespaces.
8
+
9
+ For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
10
+
11
+
12
+ ## VS Code Dev Containers
13
+ [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/langgenius/dify)
14
+
15
+ if you have VS Code installed, you can click the button above to open this project in VS Code Dev Containers.
16
+
17
+ You can learn more in the [Dev Containers documentation](https://code.visualstudio.com/docs/devcontainers/containers).
18
+
19
+
20
+ ## Pros of Devcontainer
21
+ Unified Development Environment: By using devcontainers, you can ensure that all developers are developing in the same environment, reducing the occurrence of "it works on my machine" type of issues.
22
+
23
+ Quick Start: New developers can set up their development environment in a few simple steps, without spending a lot of time on environment configuration.
24
+
25
+ Isolation: Devcontainers isolate your project from your host operating system, reducing the chance of OS updates or other application installations impacting the development environment.
26
+
27
+ ## Cons of Devcontainer
28
+ Learning Curve: For developers unfamiliar with Docker and VS Code, using devcontainers may be somewhat complex.
29
+
30
+ Performance Impact: While usually minimal, programs running inside a devcontainer may be slightly slower than those running directly on the host.
31
+
32
+ ## Troubleshooting
33
+ if you see such error message when you open this project in codespaces:
34
+ ![Alt text](troubleshooting.png)
35
+
36
+ a simple workaround is change `/signin` endpoint into another one, then login with GitHub account and close the tab, then change it back to `/signin` endpoint. Then all things will be fine.
37
+ The reason is `signin` endpoint is not allowed in codespaces, details can be found [here](https://github.com/orgs/community/discussions/5204)
.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/anaconda
3
+ {
4
+ "name": "Python 3.10",
5
+ "build": {
6
+ "context": "..",
7
+ "dockerfile": "Dockerfile"
8
+ },
9
+ "features": {
10
+ "ghcr.io/devcontainers/features/node:1": {
11
+ "nodeGypDependencies": true,
12
+ "version": "lts"
13
+ },
14
+ "ghcr.io/devcontainers-contrib/features/npm-package:1": {
15
+ "package": "typescript",
16
+ "version": "latest"
17
+ },
18
+ "ghcr.io/devcontainers/features/docker-in-docker:2": {
19
+ "moby": true,
20
+ "azureDnsAutoDetection": true,
21
+ "installDockerBuildx": true,
22
+ "version": "latest",
23
+ "dockerDashComposeVersion": "v2"
24
+ }
25
+ },
26
+ "customizations": {
27
+ "vscode": {
28
+ "extensions": [
29
+ "ms-python.pylint",
30
+ "GitHub.copilot",
31
+ "ms-python.python"
32
+ ]
33
+ }
34
+ },
35
+ "postStartCommand": "./.devcontainer/post_start_command.sh",
36
+ "postCreateCommand": "./.devcontainer/post_create_command.sh"
37
+
38
+ // Features to add to the dev container. More info: https://containers.dev/features.
39
+ // "features": {},
40
+
41
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
42
+ // "forwardPorts": [],
43
+
44
+ // Use 'postCreateCommand' to run commands after the container is created.
45
+ // "postCreateCommand": "python --version",
46
+
47
+ // Configure tool-specific properties.
48
+ // "customizations": {},
49
+
50
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
51
+ // "remoteUser": "root"
52
+ }
.devcontainer/noop.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ This file copied into the container along with environment.yml* from the parent
2
+ folder. This file is included to prevents the Dockerfile COPY instruction from
3
+ failing if no environment.yml is found.
.devcontainer/post_create_command.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd web && npm install
4
+
5
+ echo 'alias start-api="cd /workspaces/dify/api && flask run --host 0.0.0.0 --port=5001 --debug"' >> ~/.bashrc
6
+ echo 'alias start-worker="cd /workspaces/dify/api && celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail"' >> ~/.bashrc
7
+ echo 'alias start-web="cd /workspaces/dify/web && npm run dev"' >> ~/.bashrc
8
+ echo 'alias start-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify up -d"' >> ~/.bashrc
9
+
10
+ source /home/vscode/.bashrc
.devcontainer/post_start_command.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ cd api && pip install -r requirements.txt
.devcontainer/troubleshooting.png ADDED
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* 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
 
 
 
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
+ docker/volumes/db/data/pgdata/pg_wal/000000010000000000000001 filter=lfs diff=lfs merge=lfs -text
37
+ images/GitHub_README_cover.png filter=lfs diff=lfs merge=lfs -text
.github/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dify Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Language Policy
40
+
41
+ To facilitate clear and effective communication, all discussions, comments, documentation, and pull requests in this project should be conducted in English. This ensures that all contributors can participate and collaborate effectively.
42
+
43
+
.github/ISSUE_TEMPLATE/bug_report.yml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "🕷️ Bug report"
2
+ description: Report errors or unexpected behavior
3
+ labels:
4
+ - bug
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
12
+ required: true
13
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
14
+ required: true
15
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
16
+ required: true
17
+ - label: "Please do not modify this template :) and fill in all the required fields."
18
+ required: true
19
+
20
+ - type: input
21
+ attributes:
22
+ label: Dify version
23
+ placeholder: 0.3.21
24
+ description: See about section in Dify console
25
+ validations:
26
+ required: true
27
+
28
+ - type: dropdown
29
+ attributes:
30
+ label: Cloud or Self Hosted
31
+ description: How / Where was Dify installed from?
32
+ multiple: true
33
+ options:
34
+ - Cloud
35
+ - Self Hosted (Docker)
36
+ - Self Hosted (Source)
37
+ validations:
38
+ required: true
39
+
40
+ - type: textarea
41
+ attributes:
42
+ label: Steps to reproduce
43
+ description: We highly suggest including screenshots and a bug report log.
44
+ placeholder: Having detailed steps helps us reproduce the bug.
45
+ validations:
46
+ required: true
47
+
48
+ - type: textarea
49
+ attributes:
50
+ label: ✔️ Expected Behavior
51
+ placeholder: What were you expecting?
52
+ validations:
53
+ required: false
54
+
55
+ - type: textarea
56
+ attributes:
57
+ label: ❌ Actual Behavior
58
+ placeholder: What happened instead?
59
+ validations:
60
+ required: false
.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: "\U0001F4E7 Discussions"
4
+ url: https://github.com/langgenius/dify/discussions/categories/general
5
+ about: General discussions and request help from the community
.github/ISSUE_TEMPLATE/document_issue.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "📚 Documentation Issue"
2
+ description: Report issues in our documentation
3
+ labels:
4
+ - documentation
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
12
+ required: true
13
+ - label: I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
14
+ required: true
15
+ - label: "Please do not modify this template :) and fill in all the required fields."
16
+ required: true
17
+ - type: textarea
18
+ attributes:
19
+ label: Provide a description of requested docs changes
20
+ placeholder: Briefly describe which document needs to be corrected and why.
21
+ validations:
22
+ required: true
.github/ISSUE_TEMPLATE/feature_request.yml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "⭐ Feature or enhancement request"
2
+ description: Propose something new.
3
+ labels:
4
+ - enhancement
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
12
+ required: true
13
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
14
+ required: true
15
+ - label: "Please do not modify this template :) and fill in all the required fields."
16
+ required: true
17
+ - type: textarea
18
+ attributes:
19
+ label: 1. Is this request related to a challenge you're experiencing?
20
+ placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ attributes:
25
+ label: 2. Describe the feature you'd like to see
26
+ placeholder: Think about what you want to achieve and how this feature will help you. Sketches, flow diagrams, or any visual representation will be a major plus.
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ attributes:
31
+ label: 3. How will this feature improve your workflow or experience?
32
+ placeholder: Tell us how this change will benefit your work. This helps us prioritize based on user impact.
33
+ validations:
34
+ required: true
35
+ - type: textarea
36
+ attributes:
37
+ label: 4. Additional context or comments
38
+ placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
39
+ validations:
40
+ required: false
41
+ - type: checkboxes
42
+ attributes:
43
+ label: 5. Can you help us with this feature?
44
+ description: Let us know! This is not a commitment, but a starting point for collaboration.
45
+ options:
46
+ - label: I am interested in contributing to this feature.
47
+ required: false
48
+ - type: markdown
49
+ attributes:
50
+ value: Please limit one request per issue.
.github/ISSUE_TEMPLATE/translation_issue.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "🌐 Localization/Translation issue"
2
+ description: Report incorrect translations. [please use English :)]
3
+ labels:
4
+ - translation
5
+ body:
6
+ - type: checkboxes
7
+ attributes:
8
+ label: Self Checks
9
+ description: "To make sure we get to you in time, please check the following :)"
10
+ options:
11
+ - label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
12
+ required: true
13
+ - label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
14
+ required: true
15
+ - label: "Please do not modify this template :) and fill in all the required fields."
16
+ required: true
17
+ - type: input
18
+ attributes:
19
+ label: Dify version
20
+ placeholder: 0.3.21
21
+ description: Hover over system tray icon or look at Settings
22
+ validations:
23
+ required: true
24
+ - type: input
25
+ attributes:
26
+ label: Utility with translation issue
27
+ placeholder: Some area
28
+ description: Please input here the utility with the translation issue
29
+ validations:
30
+ required: true
31
+ - type: input
32
+ attributes:
33
+ label: 🌐 Language affected
34
+ placeholder: "German"
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ attributes:
39
+ label: ❌ Actual phrase(s)
40
+ placeholder: What is there? Please include a screenshot as that is extremely helpful.
41
+ validations:
42
+ required: true
43
+ - type: textarea
44
+ attributes:
45
+ label: ✔️ Expected phrase(s)
46
+ placeholder: What was expected?
47
+ validations:
48
+ required: true
49
+ - type: textarea
50
+ attributes:
51
+ label: ℹ Why is the current translation wrong
52
+ placeholder: Why do you feel this is incorrect?
53
+ validations:
54
+ required: true
.github/linters/.hadolint.yaml ADDED
@@ -0,0 +1 @@
 
 
1
+ failure-threshold: "error"
.github/linters/.isort.cfg ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [settings]
2
+ line_length=120
.github/linters/.yaml-lint.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ extends: default
4
+
5
+ rules:
6
+ brackets:
7
+ max-spaces-inside: 1
8
+ comments-indentation: disable
9
+ document-start: disable
10
+ line-length: disable
11
+ truthy: disable
.github/pull_request_template.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Description
2
+
3
+ Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4
+
5
+ Fixes # (issue)
6
+
7
+ ## Type of Change
8
+
9
+ Please delete options that are not relevant.
10
+
11
+ - [ ] Bug fix (non-breaking change which fixes an issue)
12
+ - [ ] New feature (non-breaking change which adds functionality)
13
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14
+ - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs)
15
+ - [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
16
+ - [ ] Dependency upgrade
17
+
18
+ # How Has This Been Tested?
19
+
20
+ Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
21
+
22
+ - [ ] TODO
23
+
24
+ # Suggested Checklist:
25
+
26
+ - [ ] I have performed a self-review of my own code
27
+ - [ ] I have commented my code, particularly in hard-to-understand areas
28
+ - [ ] My changes generate no new warnings
29
+ - [ ] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
30
+ - [ ] `optional` I have made corresponding changes to the documentation
31
+ - [ ] `optional` I have added tests that prove my fix is effective or that my feature works
32
+ - [ ] `optional` New and existing unit tests pass locally with my changes
.github/workflows/api-tests.yml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run Pytest
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version:
14
+ - "3.10"
15
+ - "3.11"
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+ cache: 'pip'
26
+ cache-dependency-path: |
27
+ ./api/requirements.txt
28
+ ./api/requirements-dev.txt
29
+
30
+ - name: Install dependencies
31
+ run: pip install -r ./api/requirements.txt -r ./api/requirements-dev.txt
32
+
33
+ - name: Run Unit tests
34
+ run: dev/pytest/pytest_unit_tests.sh
35
+
36
+ - name: Run ModelRuntime
37
+ run: dev/pytest/pytest_model_runtime.sh
38
+
39
+ - name: Run Tool
40
+ run: dev/pytest/pytest_tools.sh
41
+
42
+ - name: Set up Sandbox
43
+ uses: hoverkraft-tech/compose-action@v2.0.0
44
+ with:
45
+ compose-file: |
46
+ docker/docker-compose.middleware.yaml
47
+ services: |
48
+ sandbox
49
+ ssrf_proxy
50
+
51
+ - name: Run Workflow
52
+ run: dev/pytest/pytest_workflow.sh
53
+
54
+ - name: Set up Vector Stores (Weaviate, Qdrant, PGVector, Milvus, PgVecto-RS)
55
+ uses: hoverkraft-tech/compose-action@v2.0.0
56
+ with:
57
+ compose-file: |
58
+ docker/docker-compose.middleware.yaml
59
+ docker/docker-compose.qdrant.yaml
60
+ docker/docker-compose.milvus.yaml
61
+ docker/docker-compose.pgvecto-rs.yaml
62
+ docker/docker-compose.pgvector.yaml
63
+ services: |
64
+ weaviate
65
+ qdrant
66
+ etcd
67
+ minio
68
+ milvus-standalone
69
+ pgvecto-rs
70
+ pgvector
71
+
72
+ - name: Test Vector Stores
73
+ run: dev/pytest/pytest_vdb.sh
.github/workflows/build-push.yml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Push API & Web
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ - "deploy/dev"
8
+ release:
9
+ types: [published]
10
+
11
+ env:
12
+ DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
13
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
14
+ DIFY_WEB_IMAGE_NAME: ${{ vars.DIFY_WEB_IMAGE_NAME || 'langgenius/dify-web' }}
15
+ DIFY_API_IMAGE_NAME: ${{ vars.DIFY_API_IMAGE_NAME || 'langgenius/dify-api' }}
16
+
17
+ jobs:
18
+ build-and-push:
19
+ runs-on: ubuntu-latest
20
+ if: github.event.pull_request.draft == false
21
+ strategy:
22
+ matrix:
23
+ include:
24
+ - service_name: "web"
25
+ image_name_env: "DIFY_WEB_IMAGE_NAME"
26
+ context: "web"
27
+ - service_name: "api"
28
+ image_name_env: "DIFY_API_IMAGE_NAME"
29
+ context: "api"
30
+ steps:
31
+ - name: Set up QEMU
32
+ uses: docker/setup-qemu-action@v3
33
+
34
+ - name: Set up Docker Buildx
35
+ uses: docker/setup-buildx-action@v3
36
+
37
+ - name: Login to Docker Hub
38
+ uses: docker/login-action@v2
39
+ with:
40
+ username: ${{ env.DOCKERHUB_USER }}
41
+ password: ${{ env.DOCKERHUB_TOKEN }}
42
+
43
+ - name: Extract metadata (tags, labels) for Docker
44
+ id: meta
45
+ uses: docker/metadata-action@v5
46
+ with:
47
+ images: ${{ env[matrix.image_name_env] }}
48
+ tags: |
49
+ type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
50
+ type=ref,event=branch
51
+ type=sha,enable=true,priority=100,prefix=,suffix=,format=long
52
+ type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
53
+
54
+ - name: Build and push
55
+ uses: docker/build-push-action@v5
56
+ with:
57
+ context: "{{defaultContext}}:${{ matrix.context }}"
58
+ platforms: ${{ startsWith(github.ref, 'refs/tags/') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
59
+ build-args: COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
60
+ push: true
61
+ tags: ${{ steps.meta.outputs.tags }}
62
+ labels: ${{ steps.meta.outputs.labels }}
63
+ cache-from: type=gha
64
+ cache-to: type=gha,mode=max
.github/workflows/deploy-dev.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy Dev
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Build and Push API & Web"]
6
+ branches:
7
+ - "deploy/dev"
8
+ types:
9
+ - completed
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+ if: |
15
+ github.event.workflow_run.conclusion == 'success'
16
+ steps:
17
+ - name: Deploy to server
18
+ uses: appleboy/ssh-action@v0.1.8
19
+ with:
20
+ host: ${{ secrets.SSH_HOST }}
21
+ username: ${{ secrets.SSH_USER }}
22
+ key: ${{ secrets.SSH_PRIVATE_KEY }}
23
+ script: |
24
+ ${{ vars.SSH_SCRIPT || secrets.SSH_SCRIPT }}
.github/workflows/stale.yml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2
+ #
3
+ # You can adjust the behavior by modifying this file.
4
+ # For more information, see:
5
+ # https://github.com/actions/stale
6
+ name: Mark stale issues and pull requests
7
+
8
+ on:
9
+ schedule:
10
+ - cron: '0 3 * * *'
11
+
12
+ jobs:
13
+ stale:
14
+
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ issues: write
18
+ pull-requests: write
19
+
20
+ steps:
21
+ - uses: actions/stale@v5
22
+ with:
23
+ days-before-issue-stale: 15
24
+ days-before-issue-close: 3
25
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
26
+ stale-issue-message: "Close due to it's no longer active, if you have any questions, you can reopen it."
27
+ stale-pr-message: "Close due to it's no longer active, if you have any questions, you can reopen it."
28
+ stale-issue-label: 'no-issue-activity'
29
+ stale-pr-label: 'no-pr-activity'
30
+ any-of-labels: 'duplicate,question,invalid,wontfix,no-issue-activity,no-pr-activity,enhancement,cant-reproduce,help-wanted'
.github/workflows/style.yml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Style check
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: dep-${{ github.head_ref || github.run_id }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ python-style:
14
+ name: Python Style
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: '3.10'
25
+
26
+ - name: Python dependencies
27
+ run: pip install ruff dotenv-linter
28
+
29
+ - name: Ruff check
30
+ run: ruff check ./api
31
+
32
+ - name: Dotenv check
33
+ run: dotenv-linter ./api/.env.example ./web/.env.example
34
+
35
+ - name: Lint hints
36
+ if: failure()
37
+ run: echo "Please run 'dev/reformat' to fix the fixable linting errors."
38
+
39
+ test:
40
+ name: ESLint and SuperLinter
41
+ runs-on: ubuntu-latest
42
+ needs: python-style
43
+
44
+ steps:
45
+ - name: Checkout code
46
+ uses: actions/checkout@v4
47
+ with:
48
+ fetch-depth: 0
49
+
50
+ - name: Setup NodeJS
51
+ uses: actions/setup-node@v4
52
+ with:
53
+ node-version: 20
54
+ cache: yarn
55
+ cache-dependency-path: ./web/package.json
56
+
57
+ - name: Web dependencies
58
+ run: |
59
+ cd ./web
60
+ yarn install --frozen-lockfile
61
+
62
+ - name: Web style check
63
+ run: |
64
+ cd ./web
65
+ yarn run lint
66
+
67
+ - name: Super-linter
68
+ uses: super-linter/super-linter/slim@v6
69
+ env:
70
+ BASH_SEVERITY: warning
71
+ DEFAULT_BRANCH: main
72
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73
+ IGNORE_GENERATED_FILES: true
74
+ IGNORE_GITIGNORED_FILES: true
75
+ VALIDATE_BASH: true
76
+ VALIDATE_BASH_EXEC: true
77
+ VALIDATE_GITHUB_ACTIONS: true
78
+ VALIDATE_DOCKERFILE_HADOLINT: true
79
+ VALIDATE_YAML: true
.github/workflows/tool-test-sdks.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run Unit Test For SDKs
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ jobs:
8
+ build:
9
+ name: unit test for Node.js SDK
10
+ runs-on: ubuntu-latest
11
+
12
+ strategy:
13
+ matrix:
14
+ node-version: [16, 18, 20]
15
+
16
+ defaults:
17
+ run:
18
+ working-directory: sdks/nodejs-client
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Use Node.js ${{ matrix.node-version }}
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: ${{ matrix.node-version }}
27
+ cache: ''
28
+ cache-dependency-path: 'yarn.lock'
29
+
30
+ - name: Install Dependencies
31
+ run: yarn install
32
+
33
+ - name: Test
34
+ run: yarn test
.gitignore ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ .ideaDataSources/
139
+
140
+ api/.env
141
+ api/storage/*
142
+
143
+ docker/volumes/app/storage/*
144
+ docker/volumes/db/data/*
145
+ docker/volumes/redis/data/*
146
+ docker/volumes/weaviate/*
147
+ docker/volumes/qdrant/*
148
+ docker/volumes/etcd/*
149
+ docker/volumes/minio/*
150
+ docker/volumes/milvus/*
151
+
152
+ sdks/python-client/build
153
+ sdks/python-client/dist
154
+ sdks/python-client/dify_client.egg-info
155
+
156
+ .vscode/*
157
+ !.vscode/launch.json
158
+ pyrightconfig.json
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,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 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.
2
+
3
+ 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.
4
+
5
+ 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.
6
+
7
+ 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).
8
+
9
+ ## Before you jump in
10
+
11
+ [Find](https://github.com/langgenius/dify/issues?q=is:issue+is:closed) an existing issue, or [open](https://github.com/langgenius/dify/issues/new/choose) a new one. We categorize issues into 2 types:
12
+
13
+ ### Feature requests:
14
+
15
+ * 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.
16
+
17
+ * If you want to pick one up from the existing issues, simply drop a comment below it saying so.
18
+
19
+
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
+
56
+ ## Installing
57
+
58
+ Here are the steps to set up Dify for development:
59
+
60
+ ### 1. Fork this repository
61
+
62
+ ### 2. Clone the repo
63
+
64
+ Clone the forked repository from your terminal:
65
+
66
+ ```
67
+ git clone git@github.com:<github_username>/dify.git
68
+ ```
69
+
70
+ ### 3. Verify dependencies
71
+
72
+ Dify requires the following dependencies to build, make sure they're installed on your system:
73
+
74
+ - [Docker](https://www.docker.com/)
75
+ - [Docker Compose](https://docs.docker.com/compose/install/)
76
+ - [Node.js v18.x (LTS)](http://nodejs.org)
77
+ - [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
78
+ - [Python](https://www.python.org/) version 3.10.x
79
+
80
+ ### 4. Installations
81
+
82
+ 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.
83
+
84
+ Check the [installation FAQ](https://docs.dify.ai/getting-started/faq/install-faq) for a list of common issues and steps to troubleshoot.
85
+
86
+ ### 5. Visit dify in your browser
87
+
88
+ 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.
89
+
90
+ ## Developing
91
+
92
+ 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.
93
+
94
+ If you are adding a tool provider to Agent or Workflow, [this guide](./api/core/tools/README.md) is for you.
95
+
96
+ To help you quickly navigate where your contribution fits, a brief, annotated outline of Dify's backend & frontend is as follows:
97
+
98
+ ### Backend
99
+
100
+ 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.
101
+
102
+ ```
103
+ [api/]
104
+ ├── constants // Constant settings used throughout code base.
105
+ ├── controllers // API route definitions and request handling logic.
106
+ ├── core // Core application orchestration, model integrations, and tools.
107
+ ├── docker // Docker & containerization related configurations.
108
+ ├── events // Event handling and processing
109
+ ├── extensions // Extensions with 3rd party frameworks/platforms.
110
+ ├── fields // field definitions for serialization/marshalling.
111
+ ├── libs // Reusable libraries and helpers.
112
+ ├── migrations // Scripts for database migration.
113
+ ├── models // Database models & schema definitions.
114
+ ├── services // Specifies business logic.
115
+ ├── storage // Private key storage.
116
+ ├── tasks // Handling of async tasks and background jobs.
117
+ └── tests
118
+ ```
119
+
120
+ ### Frontend
121
+
122
+ 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.
123
+
124
+ ```
125
+ [web/]
126
+ ├── app // layouts, pages, and components
127
+ │ ├── (commonLayout) // common layout used throughout the app
128
+ │ ├── (shareLayout) // layouts specifically shared across token-specific sessions
129
+ │ ├── activate // activate page
130
+ │ ├── components // shared by pages and layouts
131
+ │ ├── install // install page
132
+ │ ├── signin // signin page
133
+ │ └── styles // globally shared styles
134
+ ├── assets // Static assets
135
+ ├── bin // scripts ran at build step
136
+ ├── config // adjustable settings and options
137
+ ├── context // shared contexts used by different portions of the app
138
+ ├── dictionaries // Language-specific translate files
139
+ ├── docker // container configurations
140
+ ├── hooks // Reusable hooks
141
+ ├── i18n // Internationalization configuration
142
+ ├── models // describes data models & shapes of API responses
143
+ ├── public // meta assets like favicon
144
+ ├── service // specifies shapes of API actions
145
+ ├── test
146
+ ├── types // descriptions of function params and return values
147
+ └── utils // Shared utility functions
148
+ ```
149
+
150
+ ## Submitting your PR
151
+
152
+ 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).
153
+
154
+ 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).
155
+
156
+ ## Getting Help
157
+
158
+ 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,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:closed)现有问题,或[创建](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
+ | Member | Scope |
24
+ | ------------------------------------------------------------ | ---------------------------------------------------- |
25
+ | [@yeuoly](https://github.com/Yeuoly) | Architecting Agents |
26
+ | [@jyong](https://github.com/JohnJyong) | RAG pipeline design |
27
+ | [@GarfieldDai](https://github.com/GarfieldDai) | Building workflow orchestrations |
28
+ | [@iamjoel](https://github.com/iamjoel) & [@zxhlyh](https://github.com/zxhlyh) | Making our frontend a breeze to use |
29
+ | [@guchenhe](https://github.com/guchenhe) & [@crazywoola](https://github.com/crazywoola) | Developer experience, points of contact for anything |
30
+ | [@takatost](https://github.com/takatost) | Overall product direction and architecture |
31
+
32
+ How we prioritize:
33
+
34
+ | Feature Type | Priority |
35
+ | ------------------------------------------------------------ | --------------- |
36
+ | High-Priority Features as being labeled by a team member | High Priority |
37
+ | Popular feature requests from our [community feedback board](https://github.com/langgenius/dify/discussions/categories/feedbacks) | Medium Priority |
38
+ | Non-core features and minor enhancements | Low Priority |
39
+ | Valuable but not immediate | Future-Feature |
40
+
41
+ ### 其他任何事情(例如bug报告、性能优化、拼写错误更正):
42
+ * 立即开始编码。
43
+
44
+ How we prioritize:
45
+
46
+ | Issue Type | Priority |
47
+ | ------------------------------------------------------------ | --------------- |
48
+ | Bugs in core functions (cannot login, applications not working, security loopholes) | Critical |
49
+ | Non-critical bugs, performance boosts | Medium Priority |
50
+ | Minor fixes (typos, confusing but working UI) | Low Priority |
51
+
52
+
53
+ ## 安装
54
+
55
+ 以下是设置Dify进行开发的步骤:
56
+
57
+ ### 1. Fork该仓库
58
+
59
+ ### 2. 克隆仓库
60
+
61
+ 从终端克隆fork的仓库:
62
+
63
+ ```
64
+ git clone git@github.com:<github_username>/dify.git
65
+ ```
66
+
67
+ ### 3. 验证依赖项
68
+
69
+ Dify 依赖以下工具和库:
70
+
71
+ - [Docker](https://www.docker.com/)
72
+ - [Docker Compose](https://docs.docker.com/compose/install/)
73
+ - [Node.js v18.x (LTS)](http://nodejs.org)
74
+ - [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
75
+ - [Python](https://www.python.org/) version 3.10.x
76
+
77
+ ### 4. 安装
78
+
79
+ Dify由后端和前端组成。通过`cd api/`导航到后端目录,然后按照[后端README](api/README.md)进行安装。在另一个终端中,通过`cd web/`导航到前端目录,然后���照[前端README](web/README.md)进行安装。
80
+
81
+ 查看[安装常见问题解答](https://docs.dify.ai/getting-started/faq/install-faq)以获取常见问题列表和故障排除步骤。
82
+
83
+ ### 5. 在浏览器中访问Dify
84
+
85
+ 为了验证您的设置,打开浏览器并访问[http://localhost:3000](http://localhost:3000)(默认或您自定义的URL和端口)。现在您应该看到Dify正在运行。
86
+
87
+ ## 开发
88
+
89
+ 如果您要添加模型提供程序,请参考[此指南](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/README.md)。
90
+
91
+ 如果您要向Agent或Workflow添加工具提供程序,请参考[此指南](./api/core/tools/README.md)。
92
+
93
+ 为了帮助您快速了解您的贡献在哪个部分,以下是Dify后端和前端的简要注释大纲:
94
+
95
+ ### 后端
96
+
97
+ 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进行处理。
98
+
99
+ ```
100
+ [api/]
101
+ ├── constants // Constant settings used throughout code base.
102
+ ├── controllers // API route definitions and request handling logic.
103
+ ├── core // Core application orchestration, model integrations, and tools.
104
+ ├── docker // Docker & containerization related configurations.
105
+ ├── events // Event handling and processing
106
+ ├── extensions // Extensions with 3rd party frameworks/platforms.
107
+ ├── fields // field definitions for serialization/marshalling.
108
+ ├── libs // Reusable libraries and helpers.
109
+ ├── migrations // Scripts for database migration.
110
+ ├── models // Database models & schema definitions.
111
+ ├── services // Specifies business logic.
112
+ ├── storage // Private key storage.
113
+ ├── tasks // Handling of async tasks and background jobs.
114
+ └── tests
115
+ ```
116
+
117
+ ### 前端
118
+
119
+ 该网站使用基于Typescript的[Next.js](https://nextjs.org/)模板进行引导,并使用[Tailwind CSS](https://tailwindcss.com/)进行样式设计。[React-i18next](https://react.i18next.com/)用于国际化。
120
+
121
+ ```
122
+ [web/]
123
+ ├── app // layouts, pages, and components
124
+ │ ├── (commonLayout) // common layout used throughout the app
125
+ │ ├── (shareLayout) // layouts specifically shared across token-specific sessions
126
+ │ ├── activate // activate page
127
+ │ ├── components // shared by pages and layouts
128
+ │ ├── install // install page
129
+ │ ├── signin // signin page
130
+ │ └── styles // globally shared styles
131
+ ├── assets // Static assets
132
+ ├── bin // scripts ran at build step
133
+ ├── config // adjustable settings and options
134
+ ├── context // shared contexts used by different portions of the app
135
+ ├── dictionaries // Language-specific translate files
136
+ ├── docker // container configurations
137
+ ├── hooks // Reusable hooks
138
+ ├── i18n // Internationalization configuration
139
+ ├── models // describes data models & shapes of API responses
140
+ ├── public // meta assets like favicon
141
+ ├── service // specifies shapes of API actions
142
+ ├── test
143
+ ├── types // descriptions of function params and return values
144
+ └── utils // Shared utility functions
145
+ ```
146
+
147
+ ## 提交你的 PR
148
+
149
+ 最后,是时候向我们的仓库提交一个拉取请求(PR)了。对于重要的功能,我们首先将它们合并到 `deploy/dev` 分支进行测试,然后再合并到 `main` 分支。如果你遇到合并冲突或者不知道如何提交拉取请求的问题,请查看 [GitHub 的拉取请求教程](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests)。
150
+
151
+ 就是这样!一旦你的 PR 被合并,你将成为我们 [README](https://github.com/langgenius/dify/blob/main/README.md) 中的贡献者。
152
+
153
+ ## 获取帮助
154
+
155
+ 如果你在贡献过程中遇到困难或者有任何问题,可以通过相关的 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:closed) を探すか、[新しい 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 git@github.com:<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.10.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/getting-started/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)でチャットしてください。
LICENSE ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 SaaS 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 components, 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 components.
11
+
12
+ Please contact business@dify.ai by email to inquire about licensing matters.
13
+
14
+ 2. As a contributor, you should agree that:
15
+
16
+ a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
17
+ b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
18
+
19
+ 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.
20
+
21
+ The interactive design of this product is protected by appearance patent.
22
+
23
+ © 2024 LangGenius, Inc.
24
+
25
+
26
+ ----------
27
+
28
+ Licensed under the Apache License, Version 2.0 (the "License");
29
+ you may not use this file except in compliance with the License.
30
+ You may obtain a copy of the License at
31
+
32
+ http://www.apache.org/licenses/LICENSE-2.0
33
+
34
+ Unless required by applicable law or agreed to in writing, software
35
+ distributed under the License is distributed on an "AS IS" BASIS,
36
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37
+ See the License for the specific language governing permissions and
38
+ 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
README.md CHANGED
@@ -1,11 +1,243 @@
1
- ---
2
- title: Dify
3
- emoji: 🏢
4
- colorFrom: green
5
- colorTo: pink
6
- sdk: docker
7
- pinned: false
8
- license: unknown
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://cloud.dify.ai">Dify Cloud</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">Self-hosting</a> ·
6
+ <a href="https://docs.dify.ai">Documentation</a> ·
7
+ <a href="https://cal.com/guchenhe/60-min-meeting">Enterprise inquiry</a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Static Badge" src="https://img.shields.io/badge/Product-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Static Badge" src="https://img.shields.io/badge/free-pricing?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="chat on Discord"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="follow on Twitter"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="Commits last month" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <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>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="Discussion posts" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="./README.md"><img alt="README in English" src="https://img.shields.io/badge/English-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="日本語のREADME" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="README en Español" src="https://img.shields.io/badge/Español-d9d9d9"></a>
36
+ <a href="./README_FR.md"><img alt="README en Français" src="https://img.shields.io/badge/Français-d9d9d9"></a>
37
+ <a href="./README_KL.md"><img alt="README tlhIngan Hol" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="README in Korean" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
39
+ </p>
40
+
41
+
42
+ Dify is an open-source LLM app development platform. Its intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production. Here's a list of the core features:
43
+ </br> </br>
44
+
45
+ **1. Workflow**:
46
+ Build and test powerful AI workflows on a visual canvas, leveraging all the following features and beyond.
47
+
48
+
49
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
50
+
51
+
52
+
53
+ **2. Comprehensive model support**:
54
+ 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).
55
+
56
+ ![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
57
+
58
+
59
+ **3. Prompt IDE**:
60
+ Intuitive interface for crafting prompts, comparing model performance, and adding additional features such as text-to-speech to a chat-based app.
61
+
62
+ **4. RAG Pipeline**:
63
+ 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.
64
+
65
+ **5. Agent capabilities**:
66
+ 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, DELL·E, Stable Diffusion and WolframAlpha.
67
+
68
+ **6. LLMOps**:
69
+ Monitor and analyze application logs and performance over time. You could continuously improve prompts, datasets, and models based on production data and annotations.
70
+
71
+ **7. Backend-as-a-Service**:
72
+ All of Dify's offerings come with corresponding APIs, so you could effortlessly integrate Dify into your own business logic.
73
+
74
+
75
+ ## Feature comparison
76
+ <table style="width: 100%;">
77
+ <tr>
78
+ <th align="center">Feature</th>
79
+ <th align="center">Dify.AI</th>
80
+ <th align="center">LangChain</th>
81
+ <th align="center">Flowise</th>
82
+ <th align="center">OpenAI Assistants API</th>
83
+ </tr>
84
+ <tr>
85
+ <td align="center">Programming Approach</td>
86
+ <td align="center">API + App-oriented</td>
87
+ <td align="center">Python Code</td>
88
+ <td align="center">App-oriented</td>
89
+ <td align="center">API-oriented</td>
90
+ </tr>
91
+ <tr>
92
+ <td align="center">Supported LLMs</td>
93
+ <td align="center">Rich Variety</td>
94
+ <td align="center">Rich Variety</td>
95
+ <td align="center">Rich Variety</td>
96
+ <td align="center">OpenAI-only</td>
97
+ </tr>
98
+ <tr>
99
+ <td align="center">RAG Engine</td>
100
+ <td align="center">✅</td>
101
+ <td align="center">✅</td>
102
+ <td align="center">✅</td>
103
+ <td align="center">✅</td>
104
+ </tr>
105
+ <tr>
106
+ <td align="center">Agent</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">✅</td>
109
+ <td align="center">❌</td>
110
+ <td align="center">✅</td>
111
+ </tr>
112
+ <tr>
113
+ <td align="center">Workflow</td>
114
+ <td align="center">✅</td>
115
+ <td align="center">❌</td>
116
+ <td align="center">✅</td>
117
+ <td align="center">❌</td>
118
+ </tr>
119
+ <tr>
120
+ <td align="center">Observability</td>
121
+ <td align="center">✅</td>
122
+ <td align="center">✅</td>
123
+ <td align="center">❌</td>
124
+ <td align="center">❌</td>
125
+ </tr>
126
+ <tr>
127
+ <td align="center">Enterprise Features (SSO/Access control)</td>
128
+ <td align="center">✅</td>
129
+ <td align="center">❌</td>
130
+ <td align="center">❌</td>
131
+ <td align="center">❌</td>
132
+ </tr>
133
+ <tr>
134
+ <td align="center">Local Deployment</td>
135
+ <td align="center">✅</td>
136
+ <td align="center">✅</td>
137
+ <td align="center">✅</td>
138
+ <td align="center">❌</td>
139
+ </tr>
140
+ </table>
141
+
142
+ ## Using Dify
143
+
144
+ - **Cloud </br>**
145
+ 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.
146
+
147
+ - **Self-hosting Dify Community Edition</br>**
148
+ Quickly get Dify running in your environment with this [starter guide](#quick-start).
149
+ Use our [documentation](https://docs.dify.ai) for further references and more in-depth instructions.
150
+
151
+ - **Dify for enterprise / organizations</br>**
152
+ We provide additional enterprise-centric features. [Schedule a meeting with us](https://cal.com/guchenhe/30min) or [send us an email](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry) to discuss enterprise needs. </br>
153
+ > 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.
154
+
155
+
156
+ ## Staying ahead
157
+
158
+ Star Dify on GitHub and be instantly notified of new releases.
159
+
160
+ ![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
161
+
162
+
163
+
164
+ ## Quick start
165
+ > Before installing Dify, make sure your machine meets the following minimum system requirements:
166
+ >
167
+ >- CPU >= 2 Core
168
+ >- RAM >= 4GB
169
+
170
+ </br>
171
+
172
+ The easiest way to start the Dify server is to run our [docker-compose.yml](docker/docker-compose.yaml) file. Before running the installation command, make sure that [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed on your machine:
173
+
174
+ ```bash
175
+ cd docker
176
+ docker compose up -d
177
+ ```
178
+
179
+ After running, you can access the Dify dashboard in your browser at [http://localhost/install](http://localhost/install) and start the initialization process.
180
+
181
+ > 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)
182
+
183
+ ## Next steps
184
+
185
+ If you need to customize the configuration, please refer to the comments in our [docker-compose.yml](docker/docker-compose.yaml) file and manually set the environment configuration. After making the changes, please run `docker-compose up -d` again. You can see the full list of environment variables [here](https://docs.dify.ai/getting-started/install-self-hosted/environments).
186
+
187
+ If you'd like to configure a highly-available setup, there are community-contributed [Helm Charts](https://helm.sh/) which allow Dify to be deployed on Kubernetes.
188
+
189
+ - [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
190
+ - [Helm Chart by @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
191
+
192
+
193
+ ## Contributing
194
+
195
+ For those who'd like to contribute code, see our [Contribution Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
196
+ At the same time, please consider supporting Dify by sharing it on social media and at events and conferences.
197
+
198
+
199
+ > 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).
200
+
201
+ **Contributors**
202
+
203
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
204
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
205
+ </a>
206
+
207
+ ## Community & contact
208
+
209
+ * [Github Discussion](https://github.com/langgenius/dify/discussions). Best for: sharing feedback and asking questions.
210
+ * [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).
211
+ * [Email](mailto:support@dify.ai?subject=[GitHub]Questions%20About%20Dify). Best for: questions you have about using Dify.AI.
212
+ * [Discord](https://discord.gg/FngNHpbcY7). Best for: sharing your applications and hanging out with the community.
213
+ * [Twitter](https://twitter.com/dify_ai). Best for: sharing your applications and hanging out with the community.
214
+
215
+ Or, schedule a meeting directly with a team member:
216
+
217
+ <table>
218
+ <tr>
219
+ <th>Point of Contact</th>
220
+ <th>Purpose</th>
221
+ </tr>
222
+ <tr>
223
+ <td><a href='https://cal.com/guchenhe/15min' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/9ebcd111-1205-4d71-83d5-948d70b809f5' alt='Git-Hub-README-Button-3x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
224
+ <td>Business enquiries & product feedback</td>
225
+ </tr>
226
+ <tr>
227
+ <td><a href='https://cal.com/pinkbanana' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/d1edd00a-d7e4-4513-be6c-e57038e143fd' alt='Git-Hub-README-Button-2x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
228
+ <td>Contributions, issues & feature requests</td>
229
+ </tr>
230
+ </table>
231
+
232
+ ## Star history
233
+
234
+ [![Star History Chart](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
235
+
236
+
237
+ ## Security disclosure
238
+
239
+ 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.
240
+
241
+ ## License
242
+
243
+ This repository is available under the [Dify Open Source License](LICENSE), which is essentially Apache 2.0 with a few additional restrictions.
README_CN.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ![cover-v5-optimized](https://github.com/langgenius/dify/assets/13230914/f9e19af5-61ba-4119-b926-d10c4c06ebab)
2
+
3
+ <div align="center">
4
+ <a href="https://cloud.dify.ai">Dify 云服务</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">自托管</a> ·
6
+ <a href="https://docs.dify.ai">文档</a> ·
7
+ <a href="https://cal.com/guchenhe/dify-demo">预约演示</a>
8
+ </div>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Static Badge" src="https://img.shields.io/badge/Product-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Static Badge" src="https://img.shields.io/badge/free-pricing?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="chat on Discord"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="follow on Twitter"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="Commits last month" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <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>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="Discussion posts" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <div align="center">
32
+ <a href="./README.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/英文-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/西班牙语-d9d9d9"></a>
36
+ <a href="./README_KL.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/法语-d9d9d9"></a>
37
+ <a href="./README_FR.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/克林贡语-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="上个月的提交次数" src="https://img.shields.io/badge/韓國語-d9d9d9"></a>
39
+ </div>
40
+
41
+
42
+ #
43
+
44
+ <div align="center">
45
+ <a href="https://trendshift.io/repositories/2152" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2152" alt="langgenius%2Fdify | 趋势转变" style="width: 250px; height: 55px;" width="250" height="55"/></a>
46
+ </div>
47
+
48
+ Dify 是一个开源的 LLM 应用开发平台。其直观的界面结合了 AI 工作流、RAG 管道、Agent、模型管理、可观测性功能等,让您可以快速从原型到生产。以下是其核心功能列表:
49
+ </br> </br>
50
+
51
+ **1. 工作流**:
52
+ 在画布上构建和测试功能强大的 AI 工作流程,利用以下所有功能以及更多功能。
53
+
54
+
55
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
56
+
57
+
58
+
59
+ **2. 全面的模型支持**:
60
+ 与数百种专有/开源 LLMs 以及数十种推理提供商和自托管解决方案无缝集成,涵盖 GPT、Mistral、Llama3 以及任何与 OpenAI API 兼容的模型。完整的支持模型提供商列表可在[此处](https://docs.dify.ai/getting-started/readme/model-providers)找到。
61
+
62
+ ![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
63
+
64
+
65
+ **3. Prompt IDE**:
66
+ 用于制作提示、比较模型性能以及向基于聊天的应用程序添加其他功能(如文本转语音)的直观界面。
67
+
68
+ **4. RAG Pipeline**:
69
+ 广泛的 RAG 功能,涵盖从文档摄入到检索的所有内容,支持从 PDF、PPT 和其他常见文档格式中提取文本的开箱即用的支持。
70
+
71
+ **5. Agent 智能体**:
72
+ 您可以基于 LLM 函数调用或 ReAct 定义 Agent,并为 Agent 添加预构建或自定义工具。Dify 为 AI Agent 提供了50多种内置工具,如谷歌搜索、DELL·E、Stable Diffusion 和 WolframAlpha 等。
73
+
74
+ **6. LLMOps**:
75
+ 随时间监视和分析应用程序日志和性能。您可以根据生产数据和标注持续改进提示、数据集和模型��
76
+
77
+ **7. 后端即服务**:
78
+ 所有 Dify 的功能都带有相应的 API,因此您可以轻松地将 Dify 集成到自己的业务逻辑中。
79
+
80
+
81
+ ## 功能比较
82
+ <table style="width: 100%;">
83
+ <tr>
84
+ <th align="center">功能</th>
85
+ <th align="center">Dify.AI</th>
86
+ <th align="center">LangChain</th>
87
+ <th align="center">Flowise</th>
88
+ <th align="center">OpenAI Assistant API</th>
89
+ </tr>
90
+ <tr>
91
+ <td align="center">编程方法</td>
92
+ <td align="center">API + 应用程序导向</td>
93
+ <td align="center">Python 代码</td>
94
+ <td align="center">应用程序导向</td>
95
+ <td align="center">API 导向</td>
96
+ </tr>
97
+ <tr>
98
+ <td align="center">支持的 LLMs</td>
99
+ <td align="center">丰富多样</td>
100
+ <td align="center">丰富多样</td>
101
+ <td align="center">丰富多样</td>
102
+ <td align="center">仅限 OpenAI</td>
103
+ </tr>
104
+ <tr>
105
+ <td align="center">RAG引擎</td>
106
+ <td align="center">✅</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">✅</td>
109
+ <td align="center">✅</td>
110
+ </tr>
111
+ <tr>
112
+ <td align="center">Agent</td>
113
+ <td align="center">✅</td>
114
+ <td align="center">✅</td>
115
+ <td align="center">❌</td>
116
+ <td align="center">✅</td>
117
+ </tr>
118
+ <tr>
119
+ <td align="center">工作流</td>
120
+ <td align="center">✅</td>
121
+ <td align="center">❌</td>
122
+ <td align="center">✅</td>
123
+ <td align="center">❌</td>
124
+ </tr>
125
+ <tr>
126
+ <td align="center">可观测性</td>
127
+ <td align="center">✅</td>
128
+ <td align="center">✅</td>
129
+ <td align="center">❌</td>
130
+ <td align="center">❌</td>
131
+ </tr>
132
+ <tr>
133
+ <td align="center">企业功能(SSO/访问控制)</td>
134
+ <td align="center">✅</td>
135
+ <td align="center">❌</td>
136
+ <td align="center">❌</td>
137
+ <td align="center">❌</td>
138
+ </tr>
139
+ <tr>
140
+ <td align="center">本地部署</td>
141
+ <td align="center">✅</td>
142
+ <td align="center">✅</td>
143
+ <td align="center">✅</td>
144
+ <td align="center">❌</td>
145
+ </tr>
146
+ </table>
147
+
148
+ ## 使用 Dify
149
+
150
+ - **云 </br>**
151
+ 我们提供[ Dify 云服务](https://dify.ai),任何人都可以零设置尝试。它提供了自部署版本的所有功能,并在沙盒计划中包含 200 次免费的 GPT-4 调用。
152
+
153
+ - **自托管 Dify 社区版</br>**
154
+ 使用这个[入门指南](#quick-start)快速在您的环境中运行 Dify。
155
+ 使用我们的[文档](https://docs.dify.ai)进行进一步的参考和更深入的说明。
156
+
157
+ - **面向企业/组织的 Dify</br>**
158
+ 我们提供额外的面向企业的功能。[与我们安排会议](https://cal.com/guchenhe/30min)或[给我们发送电子邮件](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry)讨论企业需求。 </br>
159
+ > 对于使用 AWS 的初创公司和中小型企业,请查看 [AWS Marketplace 上的 Dify 高级版](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6),并使用一键部署到您自己的 AWS VPC。它是一个价格实惠的 AMI 产品,提供了使用自定义徽标和品牌创建应用程序的选项。
160
+
161
+ ## 保持领先
162
+
163
+ 在 GitHub 上给 Dify Star,并立即收到新版本的通知。
164
+
165
+ ![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
166
+
167
+ ## 安装社区版
168
+
169
+ ### 系统要求
170
+
171
+ 在安装 Dify 之前,请确保您的机器满足以下最低系统要求:
172
+
173
+ - CPU >= 2 Core
174
+ - RAM >= 4GB
175
+
176
+ ### 快速启动
177
+
178
+ 启动 Dify 服务器的最简单方法是运行我们的 [docker-compose.yml](docker/docker-compose.yaml) 文件。在运行安装命令之前,请确保您的机器上安装了 [Docker](https://docs.docker.com/get-docker/) 和 [Docker Compose](https://docs.docker.com/compose/install/):
179
+
180
+ ```bash
181
+ cd docker
182
+ docker compose up -d
183
+ ```
184
+
185
+ 运行后,可以在浏览器上访问 [http://localhost/install](http://localhost/install) 进入 Dify 控制台并开始初始化安装操作。
186
+
187
+ #### 使用 Helm Chart 部署
188
+
189
+ 使用 [Helm Chart](https://helm.sh/) 版本,可以在 Kubernetes 上部署 Dify。
190
+
191
+ - [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
192
+ - [Helm Chart by @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
193
+
194
+ ### 配置
195
+
196
+ 如果您需要自定义配置,请参考我们的 [docker-compose.yml](docker/docker-compose.yaml) 文件中的注释,并手动设置环境配置。更改后,请再次运行 `docker-compose up -d`。您可以在我们的[文档](https://docs.dify.ai/getting-started/install-self-hosted/environments)中查看所有环境变量的完整列表。
197
+
198
+ ## Star History
199
+
200
+ [![Star History Chart](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
201
+
202
+
203
+ ## Contributing
204
+
205
+ 对于那些想要贡献代码的人,请参阅我们的[贡献指南](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md)。
206
+ 同时,请考虑通过社交媒体、活动和会议来支持 Dify 的分享。
207
+
208
+ > 我们正在寻找贡献者来帮助将Dify翻译成除了中文和英文之外的其他语言。如果您有兴趣帮助,请参阅我们的[i18n README](https://github.com/langgenius/dify/blob/main/web/i18n/README.md)获取更多信息,并在我们的[Discord社区服务器](https://discord.gg/8Tpq4AcN9c)的`global-users`频道中留言。
209
+
210
+ **Contributors**
211
+
212
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
213
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
214
+ </a>
215
+
216
+ ## 社区与支持
217
+
218
+ 我们欢迎您为 Dify 做出贡献,以帮助改善 Dify。包括:提交代码、问题、新想法,或分享您基于 Dify 创建的有趣且有用的 AI 应用程序。同时,我们也欢迎您在不同的活动、会议和社交媒体上分享 Dify。
219
+
220
+ - [Github Discussion](https://github.com/langgenius/dify/discussions). 👉:分享您的应用程序并与社区交流。
221
+ - [GitHub Issues](https://github.com/langgenius/dify/issues)。👉:使用 Dify.AI 时遇到的错误和问题,请参阅[贡献指南](CONTRIBUTING.md)。
222
+ - [电子邮件支持](mailto:hello@dify.ai?subject=[GitHub]Questions%20About%20Dify)。👉:关于使用 Dify.AI 的问题。
223
+ - [Discord](https://discord.gg/FngNHpbcY7)。👉:分享您的应用程序并与社区交流。
224
+ - [Twitter](https://twitter.com/dify_ai)。👉:分享您的应用程序并与社区交流。
225
+ - [商业许可](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry)。👉:有关商业用途许可 Dify.AI 的商业咨询。
226
+ - [微信]() 👉:扫描下方二维码,添加微信好友,备注 Dify,我们将邀请您加入 Dify 社区。
227
+ <img src="./images/wechat.png" alt="wechat" width="100"/>
228
+
229
+ ## 安全问题
230
+
231
+ 为了保护您的隐私,请避免在 GitHub 上发布安全问题。发送问题至 security@dify.ai,我们将为您做更细致的解答。
232
+
233
+ ## License
234
+
235
+ 本仓库遵循 [Dify Open Source License](LICENSE) 开源协议,该许可证本质上是 Apache 2.0,但有一些额外的限制。
README_ES.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://cloud.dify.ai">Dify Cloud</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">Auto-alojamiento</a> ·
6
+ <a href="https://docs.dify.ai">Documentación</a> ·
7
+ <a href="https://cal.com/guchenhe/dify-demo">Programar demostración</a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Insignia Estática" src="https://img.shields.io/badge/Producto-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Insignia Estática" src="https://img.shields.io/badge/gratis-precios?logo=gratis&color=%20%23155EEF&label=precios&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="chat en Discord"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="seguir en Twitter"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Descargas de Docker" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="Actividad de Commits el último mes" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <img alt="Issues cerrados" src="https://img.shields.io/github/issues-search?query=repo%3Alanggenius%2Fdify%20is%3Aclosed&label=issues%20cerrados&labelColor=%20%237d89b0&color=%20%235d6b98"></a>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="Publicaciones de discusión" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="./README.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/Inglés-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/Español-d9d9d9"></a>
36
+ <a href="./README_KL.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/Français-d9d9d9"></a>
37
+ <a href="./README_FR.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="Actividad de Commits el último mes" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
39
+ </p>
40
+
41
+ #
42
+
43
+ <p align="center">
44
+ <a href="https://trendshift.io/repositories/2152" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2152" alt="langgenius%2Fdify | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
45
+ </p>
46
+ Dify es una plataforma de desarrollo de aplicaciones de LLM de código abierto. Su interfaz intuitiva combina flujo de trabajo de IA, pipeline RAG, capacidades de agente, gestión de modelos, características de observabilidad y más, lo que le permite pasar rápidamente de un prototipo a producción. Aquí hay una lista de las características principales:
47
+ </br> </br>
48
+
49
+ **1. Flujo de trabajo**:
50
+ Construye y prueba potentes flujos de trabajo de IA en un lienzo visual, aprovechando todas las siguientes características y más.
51
+
52
+
53
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
54
+
55
+
56
+
57
+ **2. Soporte de modelos completo**:
58
+ Integración perfecta con cientos de LLMs propietarios / de código abierto de docenas de proveedores de inferencia y soluciones auto-alojadas, que cubren GPT, Mistral, Llama3 y cualquier modelo compatible con la API de OpenAI. Se puede encontrar una lista completa de proveedores de modelos admitidos [aquí](https://docs.dify.ai/getting-started/readme/model-providers).
59
+
60
+ ![proveedores-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
61
+
62
+
63
+ **3. IDE de prompt**:
64
+ Interfaz intuitiva para crear prompts, comparar el rendimiento del modelo y agregar características adicionales como texto a voz a una aplicación basada en chat.
65
+
66
+ **4. Pipeline RAG**:
67
+ Amplias capacidades de RAG que cubren todo, desde la ingestión de documentos hasta la recuperación, con soporte listo para usar para la extracción de texto de PDF, PPT y otros formatos de documento comunes.
68
+
69
+ **5. Capacidades de agente**:
70
+ Puedes definir agent
71
+
72
+ es basados en LLM Function Calling o ReAct, y agregar herramientas preconstruidas o personalizadas para el agente. Dify proporciona más de 50 herramientas integradas para agentes de IA, como Búsqueda de Google, DELL·E, Difusión Estable y WolframAlpha.
73
+
74
+ **6. LLMOps**:
75
+ Supervisa y analiza registros de aplicaciones y rendimiento a lo largo del tiempo. Podrías mejorar continuamente prompts, conjuntos de datos y modelos basados en datos de producción y anotaciones.
76
+
77
+ **7. Backend como servicio**:
78
+ Todas las ofertas de Dify vienen con APIs correspondientes, por lo que podrías integrar Dify sin esfuerzo en tu propia lógica empresarial.
79
+
80
+
81
+ ## Comparación de características
82
+ <table style="width: 100%;">
83
+ <tr>
84
+ <th align="center">Característica</th>
85
+ <th align="center">Dify.AI</th>
86
+ <th align="center">LangChain</th>
87
+ <th align="center">Flowise</th>
88
+ <th align="center">API de Asistentes de OpenAI</th>
89
+ </tr>
90
+ <tr>
91
+ <td align="center">Enfoque de programación</td>
92
+ <td align="center">API + orientado a la aplicación</td>
93
+ <td align="center">Código Python</td>
94
+ <td align="center">Orientado a la aplicación</td>
95
+ <td align="center">Orientado a la API</td>
96
+ </tr>
97
+ <tr>
98
+ <td align="center">LLMs admitidos</td>
99
+ <td align="center">Gran variedad</td>
100
+ <td align="center">Gran variedad</td>
101
+ <td align="center">Gran variedad</td>
102
+ <td align="center">Solo OpenAI</td>
103
+ </tr>
104
+ <tr>
105
+ <td align="center">Motor RAG</td>
106
+ <td align="center">✅</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">✅</td>
109
+ <td align="center">✅</td>
110
+ </tr>
111
+ <tr>
112
+ <td align="center">Agente</td>
113
+ <td align="center">✅</td>
114
+ <td align="center">✅</td>
115
+ <td align="center">❌</td>
116
+ <td align="center">✅</td>
117
+ </tr>
118
+ <tr>
119
+ <td align="center">Flujo de trabajo</td>
120
+ <td align="center">✅</td>
121
+ <td align="center">❌</td>
122
+ <td align="center">✅</td>
123
+ <td align="center">❌</td>
124
+ </tr>
125
+ <tr>
126
+ <td align="center">Observabilidad</td>
127
+ <td align="center">✅</td>
128
+ <td align="center">✅</td>
129
+ <td align="center">❌</td>
130
+ <td align="center">❌</td>
131
+ </tr>
132
+ <tr>
133
+ <td align="center">Característica empresarial (SSO/Control de acceso)</td>
134
+ <td align="center">✅</td>
135
+ <td align="center">❌</td>
136
+ <td align="center">❌</td>
137
+ <td align="center">❌</td>
138
+ </tr>
139
+ <tr>
140
+ <td align="center">Implementación local</td>
141
+ <td align="center">✅</td>
142
+ <td align="center">✅</td>
143
+ <td align="center">✅</td>
144
+ <td align="center">❌</td>
145
+ </tr>
146
+ </table>
147
+
148
+ ## Usando Dify
149
+
150
+ - **Nube </br>**
151
+ Hospedamos un servicio [Dify Cloud](https://dify.ai) para que cualquiera lo pruebe sin configuración. Proporciona todas las capacidades de la versión autoimplementada e incluye 200 llamadas gratuitas a GPT-4 en el plan sandbox.
152
+
153
+ - **Auto-alojamiento de Dify Community Edition</br>**
154
+ Pon rápidamente Dify en funcionamiento en tu entorno con esta [guía de inicio rápido](#quick-start).
155
+ Usa nuestra [documentación](https://docs.dify.ai) para más referencias e instrucciones más detalladas.
156
+
157
+ - **Dify para Empresas / Organizaciones</br>**
158
+ Proporcionamos características adicionales centradas en la empresa. [Programa una reunión con nosotros](https://cal.com/guchenhe/30min) o [envíanos un correo electrónico](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry) para discutir las necesidades empresariales. </br>
159
+ > Para startups y pequeñas empresas que utilizan AWS, echa un vistazo a [Dify Premium en AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6) e impleméntalo en tu propio VPC de AWS con un clic. Es una AMI asequible que ofrece la opción de crear aplicaciones con logotipo y marca personalizados.
160
+
161
+
162
+ ## Manteniéndote al tanto
163
+
164
+ Dale estrella a Dify en GitHub y serás notificado instantáneamente de las nuevas versiones.
165
+
166
+ ![danos estrella](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
167
+
168
+
169
+
170
+ ## Inicio Rápido
171
+ > Antes de instalar Dify, asegúrate de que tu máquina cumpla con los siguientes requisitos mínimos del sistema:
172
+ >
173
+ >- CPU >= 2 núcleos
174
+ >- RAM >= 4GB
175
+
176
+ </br>
177
+
178
+ La forma más fácil de iniciar el servidor de Dify es ejecutar nuestro archivo [docker-compose.yml](docker/docker-compose.yaml). Antes de ejecutar el comando de instalación, asegúrate de que [Docker](https://docs.docker.com/get-docker/) y [Docker Compose](https://docs.docker.com/compose/install/) estén instalados en tu máquina:
179
+
180
+ ```bash
181
+ cd docker
182
+ docker compose up -d
183
+ ```
184
+
185
+ Después de ejecutarlo, puedes acceder al panel de control de Dify en tu navegador en [http://localhost/install](http://localhost/install) y comenzar el proceso de inicialización.
186
+
187
+ > Si deseas contribuir a Dify o realizar desarrollo adicional, consulta nuestra [guía para implementar desde el código fuente](https://docs.dify.ai/getting-started/install-self-hosted/local-source-code)
188
+
189
+ ## Próximos pasos
190
+
191
+ Si necesitas personalizar la configuración, consulta los comentarios en nuestro archivo [docker-compose.yml](docker/docker-compose.yaml) y configura manualmente la configuración del entorno
192
+
193
+ . Después de realizar los cambios, ejecuta `docker-compose up -d` nuevamente. Puedes ver la lista completa de variables de entorno [aquí](https://docs.dify.ai/getting-started/install-self-hosted/environments).
194
+
195
+ Si deseas configurar una instalación altamente disponible, hay [Gráficos Helm](https://helm.sh/) contribuidos por la comunidad que permiten implementar Dify en Kubernetes.
196
+
197
+ - [Gráfico Helm por @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
198
+ - [Gráfico Helm por @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
199
+
200
+
201
+ ## Contribuir
202
+
203
+ Para aquellos que deseen contribuir con código, consulten nuestra [Guía de contribución](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
204
+ Al mismo tiempo, considera apoyar a Dify compartiéndolo en redes sociales y en eventos y conferencias.
205
+
206
+
207
+ > Estamos buscando colaboradores para ayudar con la traducción de Dify a idiomas que no sean el mandarín o el inglés. Si estás interesado en ayudar, consulta el [README de i18n](https://github.com/langgenius/dify/blob/main/web/i18n/README.md) para obtener más información y déjanos un comentario en el canal `global-users` de nuestro [Servidor de Comunidad en Discord](https://discord.gg/8Tpq4AcN9c).
208
+
209
+ **Contribuidores**
210
+
211
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
212
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
213
+ </a>
214
+
215
+ ## Comunidad y Contacto
216
+
217
+ * [Discusión en GitHub](https://github.com/langgenius/dify/discussions). Lo mejor para: compartir comentarios y hacer preguntas.
218
+ * [Reporte de problemas en GitHub](https://github.com/langgenius/dify/issues). Lo mejor para: errores que encuentres usando Dify.AI y propuestas de características. Consulta nuestra [Guía de contribución](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
219
+ * [Correo electrónico](mailto:support@dify.ai?subject=[GitHub]Questions%20About%20Dify). Lo mejor para: preguntas que tengas sobre el uso de Dify.AI.
220
+ * [Discord](https://discord.gg/FngNHpbcY7). Lo mejor para: compartir tus aplicaciones y pasar el rato con la comunidad.
221
+ * [Twitter](https://twitter.com/dify_ai). Lo mejor para: compartir tus aplicaciones y pasar el rato con la comunidad.
222
+
223
+ O, programa una reunión directamente con un miembro del equipo:
224
+
225
+ <table>
226
+ <tr>
227
+ <th>Punto de Contacto</th>
228
+ <th>Propósito</th>
229
+ </tr>
230
+ <tr>
231
+ <td><a href='https://cal.com/guchenhe/15min' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/9ebcd111-1205-4d71-83d5-948d70b809f5' alt='Git-Hub-README-Button-3x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
232
+ <td>Consultas comerciales y retroalimentación del producto</td>
233
+ </tr>
234
+ <tr>
235
+ <td><a href='https://cal.com/pinkbanana' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/d1edd00a-d7e4-4513-be6c-e57038e143fd' alt='Git-Hub-README-Button-2x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
236
+ <td>Contribuciones, problemas y solicitudes de características</td>
237
+ </tr>
238
+ </table>
239
+
240
+ ## Historial de Estrellas
241
+
242
+ [![Gráfico de Historial de Estrellas](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
243
+
244
+
245
+ ## Divulgación de Seguridad
246
+
247
+ Para proteger tu privacidad, evita publicar problemas de seguridad en GitHub. En su lugar, envía tus preguntas a security@dify.ai y te proporcionaremos una respuesta más detallada.
248
+
249
+ ## Licencia
250
+
251
+ Este repositorio está disponible bajo la [Licencia de Código Abierto de Dify](LICENSE), que es esencialmente Apache 2.0 con algunas restricciones adicionales.
README_FR.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://cloud.dify.ai">Dify Cloud</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">Auto-hébergement</a> ·
6
+ <a href="https://docs.dify.ai">Documentation</a> ·
7
+ <a href="https://cal.com/guchenhe/dify-demo">Planifier une démo</a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Badge statique" src="https://img.shields.io/badge/Produit-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Badge statique" src="https://img.shields.io/badge/gratuit-Tarification?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="chat sur Discord"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="suivre sur Twitter"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Tirages Docker" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="Commits le mois dernier" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <img alt="Problèmes fermés" src="https://img.shields.io/github/issues-search?query=repo%3Alanggenius%2Fdify%20is%3Aclosed&label=issues%20closed&labelColor=%20%237d89b0&color=%20%235d6b98"></a>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="Messages de discussion" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="./README.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/Anglais-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/Español-d9d9d9"></a>
36
+ <a href="./README_KL.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/Français-d9d9d9"></a>
37
+ <a href="./README_FR.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="Commits le mois dernier" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
39
+ </p>
40
+
41
+ #
42
+
43
+ <p align="center">
44
+ <a href="https://trendshift.io/repositories/2152" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2152" alt="langgenius%2Fdify | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
45
+ </p>
46
+ Dify est une plateforme de développement d'applications LLM open source. Son interface intuitive combine un flux de travail d'IA, un pipeline RAG, des capacités d'agent, une gestion de modèles, des fonctionnalités d'observabilité, et plus encore, vous permettant de passer rapidement du prototype à la production. Voici une liste des fonctionnalités principales:
47
+ </br> </br>
48
+
49
+ **1. Flux de travail**:
50
+ Construisez et testez des flux de travail d'IA puissants sur un canevas visuel, en utilisant toutes les fonctionnalités suivantes et plus encore.
51
+
52
+
53
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
54
+
55
+
56
+
57
+ **2. Prise en charge complète des modèles**:
58
+ Intégration transparente avec des centaines de LLM propriétaires / open source provenant de dizaines de fournisseurs d'inférence et de solutions auto-hébergées, couvrant GPT, Mistral, Llama3, et tous les modèles compatibles avec l'API OpenAI. Une liste complète des fournisseurs de modèles pris en charge se trouve [ici](https://docs.dify.ai/getting-started/readme/model-providers).
59
+
60
+ ![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
61
+
62
+
63
+ **3. IDE de prompt**:
64
+ Interface intuitive pour créer des prompts, comparer les performances des modèles et ajouter des fonctionnalités supplémentaires telles que la synthèse vocale à une application basée sur des chats.
65
+
66
+ **4. Pipeline RAG**:
67
+ Des capacités RAG étendues qui couvrent tout, de l'ingestion de documents à la récupération, avec un support prêt à l'emploi pour l'extraction de texte à partir de PDF, PPT et autres formats de document courants.
68
+
69
+ **5. Capac
70
+
71
+ ités d'agent**:
72
+ Vous pouvez définir des agents basés sur l'appel de fonction LLM ou ReAct, et ajouter des outils pré-construits ou personnalisés pour l'agent. Dify fournit plus de 50 outils intégrés pour les agents d'IA, tels que la recherche Google, DELL·E, Stable Diffusion et WolframAlpha.
73
+
74
+ **6. LLMOps**:
75
+ Surveillez et analysez les journaux d'application et les performances au fil du temps. Vous pouvez continuellement améliorer les prompts, les ensembles de données et les modèles en fonction des données de production et des annotations.
76
+
77
+ **7. Backend-as-a-Service**:
78
+ Toutes les offres de Dify sont accompagnées d'API correspondantes, vous permettant d'intégrer facilement Dify dans votre propre logique métier.
79
+
80
+
81
+ ## Comparaison des fonctionnalités
82
+ <table style="width: 100%;">
83
+ <tr>
84
+ <th align="center">Fonctionnalité</th>
85
+ <th align="center">Dify.AI</th>
86
+ <th align="center">LangChain</th>
87
+ <th align="center">Flowise</th>
88
+ <th align="center">OpenAI Assistants API</th>
89
+ </tr>
90
+ <tr>
91
+ <td align="center">Approche de programmation</td>
92
+ <td align="center">API + Application</td>
93
+ <td align="center">Code Python</td>
94
+ <td align="center">Application</td>
95
+ <td align="center">API</td>
96
+ </tr>
97
+ <tr>
98
+ <td align="center">LLMs pris en charge</td>
99
+ <td align="center">Grande variété</td>
100
+ <td align="center">Grande variété</td>
101
+ <td align="center">Grande variété</td>
102
+ <td align="center">Uniquement OpenAI</td>
103
+ </tr>
104
+ <tr>
105
+ <td align="center">Moteur RAG</td>
106
+ <td align="center">✅</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">✅</td>
109
+ <td align="center">✅</td>
110
+ </tr>
111
+ <tr>
112
+ <td align="center">Agent</td>
113
+ <td align="center">✅</td>
114
+ <td align="center">✅</td>
115
+ <td align="center">❌</td>
116
+ <td align="center">✅</td>
117
+ </tr>
118
+ <tr>
119
+ <td align="center">Flux de travail</td>
120
+ <td align="center">✅</td>
121
+ <td align="center">❌</td>
122
+ <td align="center">✅</td>
123
+ <td align="center">❌</td>
124
+ </tr>
125
+ <tr>
126
+ <td align="center">Observabilité</td>
127
+ <td align="center">✅</td>
128
+ <td align="center">✅</td>
129
+ <td align="center">❌</td>
130
+ <td align="center">❌</td>
131
+ </tr>
132
+ <tr>
133
+ <td align="center">Fonctionnalité d'entreprise (SSO/Contrôle d'accès)</td>
134
+ <td align="center">✅</td>
135
+ <td align="center">❌</td>
136
+ <td align="center">❌</td>
137
+ <td align="center">❌</td>
138
+ </tr>
139
+ <tr>
140
+ <td align="center">Déploiement local</td>
141
+ <td align="center">✅</td>
142
+ <td align="center">✅</td>
143
+ <td align="center">✅</td>
144
+ <td align="center">❌</td>
145
+ </tr>
146
+ </table>
147
+
148
+ ## Utiliser Dify
149
+
150
+ - **Cloud </br>**
151
+ Nous hébergeons un service [Dify Cloud](https://dify.ai) pour que tout le monde puisse l'essayer sans aucune configuration. Il fournit toutes les capacités de la version auto-hébergée et comprend 200 appels GPT-4 gratuits dans le plan bac à sable.
152
+
153
+ - **Auto-hébergement Dify Community Edition</br>**
154
+ Lancez rapidement Dify dans votre environnement avec ce [guide de démarrage](#quick-start).
155
+ Utilisez notre [documentation](https://docs.dify.ai) pour plus de références et des instructions plus détaillées.
156
+
157
+ - **Dify pour les entreprises / organisations</br>**
158
+ Nous proposons des fonctionnalités supplémentaires adaptées aux entreprises. [Planifiez une réunion avec nous](https://cal.com/guchenhe/30min) ou [envoyez-nous un e-mail](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry) pour discuter des besoins de l'entreprise. </br>
159
+ > Pour les startups et les petites entreprises utilisant AWS, consultez [Dify Premium sur AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6) et déployez-le dans votre propre VPC AWS en un clic. C'est une offre AMI abordable avec la possibilité de créer des applications avec un logo et une marque personnalisés.
160
+
161
+
162
+ ## Rester en avance
163
+
164
+ Mettez une étoile à Dify sur GitHub et soyez instantanément informé des nouvelles versions.
165
+
166
+ ![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
167
+
168
+
169
+
170
+ ## Démarrage rapide
171
+ > Avant d'installer Dify, assurez-vous que votre machine répond aux exigences système minimales suivantes:
172
+ >
173
+ >- CPU >= 2 cœurs
174
+ >- RAM >= 4 Go
175
+
176
+ </br>
177
+
178
+ La manière la plus simple de démarrer le serveur Dify est d'exécuter notre fichier [docker-compose.yml](docker/docker-compose.yaml). Avant d'exécuter la commande d'installation, assurez-vous que [Docker](https://docs.docker.com/get-docker/) et [Docker Compose](https://docs.docker.com/compose/install/) sont installés sur votre machine:
179
+
180
+ ```bash
181
+ cd docker
182
+ docker compose up -d
183
+ ```
184
+
185
+ Après l'exécution, vous pouvez accéder au tableau de bord Dify dans votre navigateur à [http://localhost/install](http://localhost/install) et commencer le processus d'initialisation.
186
+
187
+ > Si vous souhaitez contribuer à Dify ou effectuer un développement supplémentaire, consultez notre [guide de déploiement à partir du code source](https://docs.dify.ai/getting-started/install-self-hosted/local-source-code)
188
+
189
+ ## Prochaines étapes
190
+
191
+ Si vous devez personnaliser la configuration, veuillez
192
+
193
+ vous référer aux commentaires dans notre fichier [docker-compose.yml](docker/docker-compose.yaml) et définir manuellement la configuration de l'environnement. Après avoir apporté les modifications, veuillez exécuter à nouveau `docker-compose up -d`. Vous pouvez voir la liste complète des variables d'environnement [ici](https://docs.dify.ai/getting-started/install-self-hosted/environments).
194
+
195
+ Si vous souhaitez configurer une installation hautement disponible, il existe des [Helm Charts](https://helm.sh/) contribués par la communauté qui permettent de déployer Dify sur Kubernetes.
196
+
197
+ - [Helm Chart par @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
198
+ - [Helm Chart par @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
199
+
200
+
201
+ ## Contribuer
202
+
203
+ Pour ceux qui souhaitent contribuer du code, consultez notre [Guide de contribution](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
204
+ Dans le même temps, veuillez envisager de soutenir Dify en le partageant sur les réseaux sociaux et lors d'événements et de conférences.
205
+
206
+
207
+ > Nous recherchons des contributeurs pour aider à traduire Dify dans des langues autres que le mandarin ou l'anglais. Si vous êtes intéressé à aider, veuillez consulter le [README i18n](https://github.com/langgenius/dify/blob/main/web/i18n/README.md) pour plus d'informations, et laissez-nous un commentaire dans le canal `global-users` de notre [Serveur communautaire Discord](https://discord.gg/8Tpq4AcN9c).
208
+
209
+ **Contributeurs**
210
+
211
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
212
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
213
+ </a>
214
+
215
+ ## Communauté & Contact
216
+
217
+ * [Discussion GitHub](https://github.com/langgenius/dify/discussions). Meilleur pour: partager des commentaires et poser des questions.
218
+ * [Problèmes GitHub](https://github.com/langgenius/dify/issues). Meilleur pour: les bogues que vous rencontrez en utilisant Dify.AI et les propositions de fonctionnalités. Consultez notre [Guide de contribution](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
219
+ * [E-mail](mailto:support@dify.ai?subject=[GitHub]Questions%20About%20Dify). Meilleur pour: les questions que vous avez sur l'utilisation de Dify.AI.
220
+ * [Discord](https://discord.gg/FngNHpbcY7). Meilleur pour: partager vos applications et passer du temps avec la communauté.
221
+ * [Twitter](https://twitter.com/dify_ai). Meilleur pour: partager vos applications et passer du temps avec la communauté.
222
+
223
+ Ou, planifiez directement une réunion avec un membre de l'équipe:
224
+
225
+ <table>
226
+ <tr>
227
+ <th>Point de contact</th>
228
+ <th>Objectif</th>
229
+ </tr>
230
+ <tr>
231
+ <td><a href='https://cal.com/guchenhe/15min' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/9ebcd111-1205-4d71-83d5-948d70b809f5' alt='Git-Hub-README-Button-3x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
232
+ <td>Demandes commerciales & retours produit</td>
233
+ </tr>
234
+ <tr>
235
+ <td><a href='https://cal.com/pinkbanana' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/d1edd00a-d7e4-4513-be6c-e57038e143fd' alt='Git-Hub-README-Button-2x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
236
+ <td>Contributions, problèmes & demandes de fonctionnalités</td>
237
+ </tr>
238
+ </table>
239
+
240
+ ## Historique des étoiles
241
+
242
+ [![Graphique de l'historique des étoiles](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
243
+
244
+
245
+ ## Divulgation de sécurité
246
+
247
+ Pour protéger votre vie privée, veuillez éviter de publier des problèmes de sécurité sur GitHub. Au lieu de cela, envoyez vos questions à security@dify.ai et nous vous fournirons une réponse plus détaillée.
248
+
249
+ ## Licence
250
+
251
+ Ce référentiel est disponible sous la [Licence open source Dify](LICENSE), qui est essentiellement l'Apache 2.0 avec quelques restrictions supplémentaires.
README_JA.md ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://cloud.dify.ai">Dify Cloud</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">セルフホスト</a> ·
6
+ <a href="https://docs.dify.ai">ドキュメント</a> ·
7
+ <a href="https://cal.com/guchenhe/dify-demo">デモのスケジュール</a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Static Badge" src="https://img.shields.io/badge/Product-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Static Badge" src="https://img.shields.io/badge/free-pricing?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="Discordでチャット"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="Twitterでフォロー"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="先月のコミット" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <img alt="クローズされた問題" src="https://img.shields.io/github/issues-search?query=repo%3Alanggenius%2Fdify%20is%3Aclosed&label=issues%20closed&labelColor=%20%237d89b0&color=%20%235d6b98"></a>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="ディスカッション投稿" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="./README.md"><img alt="先月のコミット" src="https://img.shields.io/badge/English-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="先月のコミット" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="先月のコミット" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="先月のコミット" src="https://img.shields.io/badge/Español-d9d9d9"></a>
36
+ <a href="./README_KL.md"><img alt="先月のコミット" src="https://img.shields.io/badge/Français-d9d9d9"></a>
37
+ <a href="./README_FR.md"><img alt="先月のコミット" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="先月のコミット" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
39
+ </p>
40
+
41
+ #
42
+
43
+ <p align="center">
44
+ <a href="https://trendshift.io/repositories/2152" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2152" alt="langgenius%2Fdify | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
45
+ </p>
46
+
47
+ DifyはオープンソースのLLMアプリケーション開発プラットフォームです。直感的なインターフェースには、AIワークフロー、RAGパイプライン、エージェント機能、モデル管理、観測機能などが組み合わさっており、プロトタイプから本番までの移行を迅速に行うことができます。以下は、主要機能のリストです:
48
+ </br> </br>
49
+
50
+ **1. ワークフロー**:
51
+ ビジュアルキャンバス上で強力なAIワークフローを構築してテストし、以下の機能を活用してプロトタイプを超えることができます。
52
+
53
+
54
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
55
+
56
+
57
+
58
+ **2. 包括的なモデルサポート**:
59
+ 数百のプロプライエタリ/オープンソースのLLMと、数十の推論プロバイダーおよびセルフホスティングソリューションとのシームレスな統合を提供します。GPT、Mistral、Llama3、およびOpenAI API互換のモデルをカバーします。サポートされているモデルプロバイダーの完全なリストは[こちら](https://docs.dify.ai/getting-started/readme/model-providers)をご覧ください。
60
+
61
+ ![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
62
+
63
+
64
+ **3. プロンプトIDE**:
65
+ チャットベースのアプリにテキスト読み上げなどの追加機能を追加するプロンプトを作成し、モデルのパフォーマンスを比較する直感的なインターフェース。
66
+
67
+ **4. RAGパイプライ���**:
68
+ 文書の取り込みから取得までをカバーする幅広いRAG機能で、PDF、PPTなどの一般的なドキュメント形式からのテキスト抽出に対するアウトオブボックスのサポートを提供します。
69
+
70
+ **5. エージェント機能**:
71
+ LLM関数呼び出しまたはReActに基づいてエージェントを定義し、エージェント向けの事前構築済みまたはカスタムのツールを追加できます。Difyには、Google検索、DELL·E、Stable Diffusion、WolframAlphaなどのAIエージェント用の50以上の組み込みツールが用意されています。
72
+
73
+ **6. LLMOps**:
74
+ アプリケーションログとパフォーマンスを時間の経過とともにモニタリングおよび分析します。本番データと注釈に基づいて、プロンプト、データセット、およびモデルを継続的に改善できます。
75
+
76
+ **7. Backend-as-a-Service**:
77
+ Difyのすべての提供には、それに対応するAPIが付属しており、独自のビジネスロジックにDifyをシームレスに統合できます。
78
+
79
+
80
+ ## 機能比較
81
+ <table style="width: 100%;">
82
+ <tr>
83
+ <th align="center">機能</th>
84
+ <th align="center">Dify.AI</th>
85
+ <th align="center">LangChain</th>
86
+ <th align="center">Flowise</th>
87
+ <th align="center">OpenAI Assistants API</th>
88
+ </tr>
89
+ <tr>
90
+ <td align="center">プログラミングアプローチ</td>
91
+ <td align="center">API + アプリ指向</td>
92
+ <td align="center">Pythonコード</td>
93
+ <td align="center">アプリ指向</td>
94
+ <td align="center">API指向</td>
95
+ </tr>
96
+ <tr>
97
+ <td align="center">サポートされているLLM</td>
98
+ <td align="center">バリエーション豊富</td>
99
+ <td align="center">バリエーション豊富</td>
100
+ <td align="center">バリエーション豊富</td>
101
+ <td align="center">OpenAIのみ</td>
102
+ </tr>
103
+ <tr>
104
+ <td align="center">RAGエンジン</td>
105
+ <td align="center">✅</td>
106
+ <td align="center">✅</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">✅</td>
109
+ </tr>
110
+ <tr>
111
+ <td align="center">エージェント</td>
112
+ <td align="center">✅</td>
113
+ <td align="center">✅</td>
114
+ <td align="center">❌</td>
115
+ <td align="center">✅</td>
116
+ </tr>
117
+ <tr>
118
+ <td align="center">ワークフロー</td>
119
+ <td align="center">✅</td>
120
+ <td align="center">❌</td>
121
+ <td align="center">✅</td>
122
+ <td align="center">❌</td>
123
+ </tr>
124
+ <tr>
125
+ <td align="center">観測性</td>
126
+ <td align="center">✅</td>
127
+ <td align="center">✅</td>
128
+ <td align="center">❌</td>
129
+ <td align="center">❌</td>
130
+ </tr>
131
+ <tr>
132
+ <td align="center">エンタープライズ機能(SSO/アクセス制御)</td>
133
+ <td align="center">✅</td>
134
+ <td align="center">❌</td>
135
+ <td align="center">❌</td>
136
+ <td align="center">❌</td>
137
+ </tr>
138
+ <tr>
139
+ <td align="center">ローカル展開</td>
140
+ <td align="center">✅</td>
141
+ <td align="center">✅</td>
142
+ <td align="center">✅</td>
143
+ <td align="center">❌</td>
144
+ </tr>
145
+ </table>
146
+
147
+ ## Difyの使用方法
148
+
149
+ - **クラウド </br>**
150
+ [こちら](https://dify.ai)のDify Cloudサービスを利用して、セットアップ不要で試すことができます。サンドボックスプランには、200回の無料のGPT-4呼び出しが含まれています。
151
+
152
+ - **Dify Community Editionのセルフホスティング</br>**
153
+ この[スターターガイド](#quick-start)を使用して、ローカル環境でDifyを簡単に実行できます。
154
+ さらなる参考資料や詳細な手順については、[ドキュメント](https://docs.dify.ai)をご覧ください。
155
+
156
+ - **エンタープライズ/組織向けのDify</br>**
157
+ 追加のエンタープライズ向け機能を提供しています。[こちらからミーティングを予約](https://cal.com/guchenhe/30min)したり、[メールを送信](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry)してエンタープライズのニーズについて相談してください。 </br>
158
+ > AWSを使用しているスタートアップや中小企業の場合は、[AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6)のDify Premiumをチェックして、ワンクリックで独自のAWS VPCにデプロイできます。カスタムロゴとブランディングでアプリを作成するオプションを備えた手頃な価格のAMIオファリングです。
159
+
160
+
161
+ ## 最新の情報を入手
162
+
163
+ GitHub上でDifyにスターを付けることで、Difyに関する新しいニュースを受け取れます。
164
+
165
+ ![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
166
+
167
+
168
+
169
+ ## クイックスタート
170
+ > Difyをインストールする前に、お使いのマシンが以下の最小システム要件を満たしていることを確認してください:
171
+ >
172
+ >- CPU >= 2コア
173
+ >- RAM >= 4GB
174
+
175
+ </br>
176
+
177
+ Difyサーバーを起動する最も簡単な方法は、[docker-compose.yml](docker/docker-compose.yaml)ファイルを実行することです。インストールコマンドを実行する前に、マシンに[Docker](https://docs.docker.com/get-docker/)と[Docker Compose](https://docs.docker.com/compose/install/)がインストールされていることを確認してください。
178
+
179
+ ```bash
180
+ cd docker
181
+ docker compose up -d
182
+ ```
183
+
184
+ 実行後、ブラウザで[http://localhost/install](http://localhost/install)にアクセスし、初期化プロセスを開始できます。
185
+
186
+ > Difyに貢献したり、追加の開発を行う場合は、[ソースコードからのデプロイガイド](https://docs.dify.ai/getting-started/install-self-hosted/local-source-code)を参照してください。
187
+
188
+ ## 次のステップ
189
+
190
+ 環境設定をカスタマイズする場合は、[docker-compose.yml](docker/docker-compose.yaml)ファイル内のコメントを参照して、環境設定を手動で設定してください。変更を加えた後は、再び `docker-compose up -d` を実行してください。環境変数の完全なリストは[こちら](https://docs.dify.ai/getting-started/install-self-hosted/environments)をご覧ください。
191
+
192
+ 高可用性のセットアップを構成する場合は、コミュニティによって提供されている[Helm Charts](https://helm.sh/)があり、これによりKubernetes上にDifyを展開できます。
193
+
194
+ - [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
195
+ - [Helm Chart by @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
196
+
197
+
198
+ ## 貢献
199
+
200
+ コードに貢献したい方は、[Contribution Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md)を参照してください。
201
+ 同時に、DifyをSNSやイベント、カンファレンスで共有してサポートしていただけると幸いです。
202
+
203
+
204
+ > Difyを英語または中国語以外の言語に翻訳してくれる貢献者を募集しています。興味がある場合は、詳細については[i18n README](https://github.com/langgenius/dify/blob/main/web/i18n/README.md)を参照してください。また、[Discordコミュニティサーバー](https://discord.gg/8Tpq4AcN9c)の`global-users`チャンネルにコメントを残してください。
205
+
206
+ **貢献者**
207
+
208
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
209
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
210
+ </a>
211
+
212
+ ## コミュニティ & お問い合わせ
213
+
214
+ * [Github Discussion](https://github.com/langgenius/dify/discussions). 主に: フィードバックの共有や質問。
215
+ * [GitHub Issues](https://github.com/langgenius/dify/issues). 主に: Dify.AIの使用中に遭遇したバグや機能提案。
216
+ * [Email](mailto:support@dify.ai?subject=[GitHub]Questions%20About%20Dify). 主に: Dify.AIの使用に関する質問。
217
+ * [Discord](https://discord.gg/FngNHpbcY7). 主に: アプリケーションの共有やコミュニティとの交流。
218
+ * [Twitter](https://twitter.com/dify_ai). 主に: アプリケーションの共有やコミュニティとの交流。
219
+
220
+ または、直接チームメンバーとミーティングをスケジュール:
221
+
222
+ <table>
223
+ <tr>
224
+ <th>連絡先</th>
225
+ <th>目的</th>
226
+ </tr>
227
+ <tr>
228
+ <td><a href='https://cal.com
229
+
230
+ /guchenhe/30min'>ミーティング</a></td>
231
+ <td>無料の30分間のミーティングをスケジュール</td>
232
+ </tr>
233
+ <tr>
234
+ <td><a href='mailto:support@dify.ai?subject=[GitHub]Technical%20Support'>技術サポート</a></td>
235
+ <td>技術的な問題やサポートに関する質問</td>
236
+ </tr>
237
+ <tr>
238
+ <td><a href='mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry'>営業担当</a></td>
239
+ <td>法人ライセンスに関するお問い合わせ</td>
240
+ </tr>
241
+ </table>
242
+
243
+
244
+ ## ライセンス
245
+
246
+ このリポジトリは、Dify Open Source License にいくつかの追加制限を加えた[Difyオープンソースライセンス](LICENSE)の下で利用可能です。
README_KL.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://cloud.dify.ai">Dify Cloud</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">Self-hosting</a> ·
6
+ <a href="https://docs.dify.ai">Documentation</a> ·
7
+ <a href="https://cal.com/guchenhe/dify-demo">Schedule demo</a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Static Badge" src="https://img.shields.io/badge/Product-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Static Badge" src="https://img.shields.io/badge/free-pricing?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="chat on Discord"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="follow on Twitter"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="Commits last month" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <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>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="Discussion posts" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="./README.md"><img alt="Commits last month" src="https://img.shields.io/badge/English-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="Commits last month" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="Commits last month" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="Commits last month" src="https://img.shields.io/badge/Español-d9d9d9"></a>
36
+ <a href="./README_KL.md"><img alt="Commits last month" src="https://img.shields.io/badge/Français-d9d9d9"></a>
37
+ <a href="./README_FR.md"><img alt="Commits last month" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="Commits last month" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
39
+ </p>
40
+
41
+ #
42
+
43
+ <p align="center">
44
+ <a href="https://trendshift.io/repositories/2152" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2152" alt="langgenius%2Fdify | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
45
+ </p>
46
+ Dify is an open-source LLM app development platform. Its intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production. Here's a list of the core features:
47
+ </br> </br>
48
+
49
+ **1. Workflow**:
50
+ Build and test powerful AI workflows on a visual canvas, leveraging all the following features and beyond.
51
+
52
+
53
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
54
+
55
+
56
+
57
+ **2. Comprehensive model support**:
58
+ 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).
59
+
60
+ ![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
61
+
62
+
63
+ **3. Prompt IDE**:
64
+ Intuitive interface for crafting prompts, comparing model performance, and adding additional features such as text-to-speech to a chat-based app.
65
+
66
+ **4. RAG Pipeline**:
67
+ 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.
68
+
69
+ **5. Agent capabilities**:
70
+ 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, DELL·E, Stable Diffusion and WolframAlpha.
71
+
72
+ **6. LLMOps**:
73
+ Monitor and analyze application logs and performance over time. You could continuously improve prompts, datasets, and models based on production data and annotations.
74
+
75
+ **7. Backend-as-a-Service**:
76
+ All of Dify's offerings come with corresponding APIs, so you could effortlessly integrate Dify into your own business logic.
77
+
78
+
79
+ ## Feature Comparison
80
+ <table style="width: 100%;">
81
+ <tr
82
+
83
+ >
84
+ <th align="center">Feature</th>
85
+ <th align="center">Dify.AI</th>
86
+ <th align="center">LangChain</th>
87
+ <th align="center">Flowise</th>
88
+ <th align="center">OpenAI Assistants API</th>
89
+ </tr>
90
+ <tr>
91
+ <td align="center">Programming Approach</td>
92
+ <td align="center">API + App-oriented</td>
93
+ <td align="center">Python Code</td>
94
+ <td align="center">App-oriented</td>
95
+ <td align="center">API-oriented</td>
96
+ </tr>
97
+ <tr>
98
+ <td align="center">Supported LLMs</td>
99
+ <td align="center">Rich Variety</td>
100
+ <td align="center">Rich Variety</td>
101
+ <td align="center">Rich Variety</td>
102
+ <td align="center">OpenAI-only</td>
103
+ </tr>
104
+ <tr>
105
+ <td align="center">RAG Engine</td>
106
+ <td align="center">✅</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">✅</td>
109
+ <td align="center">✅</td>
110
+ </tr>
111
+ <tr>
112
+ <td align="center">Agent</td>
113
+ <td align="center">✅</td>
114
+ <td align="center">✅</td>
115
+ <td align="center">❌</td>
116
+ <td align="center">✅</td>
117
+ </tr>
118
+ <tr>
119
+ <td align="center">Workflow</td>
120
+ <td align="center">✅</td>
121
+ <td align="center">❌</td>
122
+ <td align="center">✅</td>
123
+ <td align="center">❌</td>
124
+ </tr>
125
+ <tr>
126
+ <td align="center">Observability</td>
127
+ <td align="center">✅</td>
128
+ <td align="center">✅</td>
129
+ <td align="center">❌</td>
130
+ <td align="center">❌</td>
131
+ </tr>
132
+ <tr>
133
+ <td align="center">Enterprise Feature (SSO/Access control)</td>
134
+ <td align="center">✅</td>
135
+ <td align="center">❌</td>
136
+ <td align="center">❌</td>
137
+ <td align="center">❌</td>
138
+ </tr>
139
+ <tr>
140
+ <td align="center">Local Deployment</td>
141
+ <td align="center">✅</td>
142
+ <td align="center">✅</td>
143
+ <td align="center">✅</td>
144
+ <td align="center">❌</td>
145
+ </tr>
146
+ </table>
147
+
148
+ ## Using Dify
149
+
150
+ - **Cloud </br>**
151
+ 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.
152
+
153
+ - **Self-hosting Dify Community Edition</br>**
154
+ Quickly get Dify running in your environment with this [starter guide](#quick-start).
155
+ Use our [documentation](https://docs.dify.ai) for further references and more in-depth instructions.
156
+
157
+ - **Dify for Enterprise / Organizations</br>**
158
+ We provide additional enterprise-centric features. [Schedule a meeting with us](https://cal.com/guchenhe/30min) or [send us an email](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry) to discuss enterprise needs. </br>
159
+ > 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.
160
+
161
+
162
+ ## Staying ahead
163
+
164
+ Star Dify on GitHub and be instantly notified of new releases.
165
+
166
+ ![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
167
+
168
+
169
+
170
+ ## Quick Start
171
+ > Before installing Dify, make sure your machine meets the following minimum system requirements:
172
+ >
173
+ >- CPU >= 2 Core
174
+ >- RAM >= 4GB
175
+
176
+ </br>
177
+
178
+ The easiest way to start the Dify server is to run our [docker-compose.yml](docker/docker-compose.yaml) file. Before running the installation command, make sure that [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed on your machine:
179
+
180
+ ```bash
181
+ cd docker
182
+ docker compose up -d
183
+ ```
184
+
185
+ After running, you can access the Dify dashboard in your browser at [http://localhost/install](http://localhost/install) and start the initialization process.
186
+
187
+ > 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)
188
+
189
+ ## Next steps
190
+
191
+ If you need to customize the configuration, please refer to the comments in our [docker-compose.yml](docker/docker-compose.yaml) file and manually set the environment configuration. After making the changes, please run `docker-compose up -d` again. You can see the full list of environment variables [here](https://docs.dify.ai/getting-started/install-self-hosted/environments).
192
+
193
+ If you'd like to configure a highly-available setup, there are community-contributed [Helm Charts](https://helm.sh/) which allow Dify to be deployed on Kubernetes.
194
+
195
+ - [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
196
+ - [Helm Chart by @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
197
+
198
+
199
+ ## Contributing
200
+
201
+ For those who'd like to contribute code, see our [Contribution Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md).
202
+ At the same time, please consider supporting Dify by sharing it on social media and at events and conferences.
203
+
204
+
205
+ > 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).
206
+
207
+ **Contributors**
208
+
209
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
210
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
211
+ </a>
212
+
213
+ ## Community & Contact
214
+
215
+ * [Github Discussion](https://github.com/langgenius/dify/discussions
216
+
217
+ ). Best for: sharing feedback and asking questions.
218
+ * [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).
219
+ * [Email](mailto:support@dify.ai?subject=[GitHub]Questions%20About%20Dify). Best for: questions you have about using Dify.AI.
220
+ * [Discord](https://discord.gg/FngNHpbcY7). Best for: sharing your applications and hanging out with the community.
221
+ * [Twitter](https://twitter.com/dify_ai). Best for: sharing your applications and hanging out with the community.
222
+
223
+ Or, schedule a meeting directly with a team member:
224
+
225
+ <table>
226
+ <tr>
227
+ <th>Point of Contact</th>
228
+ <th>Purpose</th>
229
+ </tr>
230
+ <tr>
231
+ <td><a href='https://cal.com/guchenhe/15min' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/9ebcd111-1205-4d71-83d5-948d70b809f5' alt='Git-Hub-README-Button-3x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
232
+ <td>Business enquiries & product feedback</td>
233
+ </tr>
234
+ <tr>
235
+ <td><a href='https://cal.com/pinkbanana' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/d1edd00a-d7e4-4513-be6c-e57038e143fd' alt='Git-Hub-README-Button-2x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
236
+ <td>Contributions, issues & feature requests</td>
237
+ </tr>
238
+ </table>
239
+
240
+ ## Star History
241
+
242
+ [![Star History Chart](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
243
+
244
+
245
+ ## Security Disclosure
246
+
247
+ 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.
248
+
249
+ ## License
250
+
251
+ This repository is available under the [Dify Open Source License](LICENSE), which is essentially Apache 2.0 with a few additional restrictions.
README_KR.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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://cloud.dify.ai">Dify 클라우드</a> ·
5
+ <a href="https://docs.dify.ai/getting-started/install-self-hosted">셀프-호스팅</a> ·
6
+ <a href="https://docs.dify.ai">문서</a> ·
7
+ <a href="https://cal.com/guchenhe/60-min-meeting">기업 문의</a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://dify.ai" target="_blank">
12
+ <img alt="Static Badge" src="https://img.shields.io/badge/Product-F04438"></a>
13
+ <a href="https://dify.ai/pricing" target="_blank">
14
+ <img alt="Static Badge" src="https://img.shields.io/badge/free-pricing?logo=free&color=%20%23155EEF&label=pricing&labelColor=%20%23528bff"></a>
15
+ <a href="https://discord.gg/FngNHpbcY7" target="_blank">
16
+ <img src="https://img.shields.io/discord/1082486657678311454?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
17
+ alt="chat on Discord"></a>
18
+ <a href="https://twitter.com/intent/follow?screen_name=dify_ai" target="_blank">
19
+ <img src="https://img.shields.io/twitter/follow/dify_ai?logo=X&color=%20%23f5f5f5"
20
+ alt="follow on Twitter"></a>
21
+ <a href="https://hub.docker.com/u/langgenius" target="_blank">
22
+ <img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/langgenius/dify-web?labelColor=%20%23FDB062&color=%20%23f79009"></a>
23
+ <a href="https://github.com/langgenius/dify/graphs/commit-activity" target="_blank">
24
+ <img alt="Commits last month" src="https://img.shields.io/github/commit-activity/m/langgenius/dify?labelColor=%20%2332b583&color=%20%2312b76a"></a>
25
+ <a href="https://github.com/langgenius/dify/" target="_blank">
26
+ <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>
27
+ <a href="https://github.com/langgenius/dify/discussions/" target="_blank">
28
+ <img alt="Discussion posts" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="./README.md"><img alt="README in English" src="https://img.shields.io/badge/English-d9d9d9"></a>
33
+ <a href="./README_CN.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-d9d9d9"></a>
34
+ <a href="./README_JA.md"><img alt="日本語のREADME" src="https://img.shields.io/badge/日本語-d9d9d9"></a>
35
+ <a href="./README_ES.md"><img alt="README en Español" src="https://img.shields.io/badge/Español-d9d9d9"></a>
36
+ <a href="./README_FR.md"><img alt="README en Français" src="https://img.shields.io/badge/Français-d9d9d9"></a>
37
+ <a href="./README_KL.md"><img alt="README tlhIngan Hol" src="https://img.shields.io/badge/Klingon-d9d9d9"></a>
38
+ <a href="./README_KR.md"><img alt="한국어 README" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
39
+
40
+ </p>
41
+
42
+
43
+ Dify는 오픈 소스 LLM 앱 개발 플랫폼입니다. 직관적인 인터페이스를 통해 AI 워크플로우, RAG 파이프라인, 에이전트 기능, 모델 관리, 관찰 기능 등을 결합하여 프로토타입에서 프로덕션까지 빠르게 전환할 수 있습니다. 주요 기능 목록은 다음과 같습니다:</br> </br>
44
+
45
+ **1. 워크플로우**:
46
+ 다음 기능들을 비롯한 다양한 기능을 활용하여 시각적 캔버스에서 강력한 AI 워크플로우를 구축하고 테스트하세요.
47
+
48
+
49
+ https://github.com/langgenius/dify/assets/13230914/356df23e-1604-483d-80a6-9517ece318aa
50
+
51
+
52
+
53
+ **2. 포괄적인 모델 지원:**:
54
+
55
+ 수십 개의 추론 제공업체와 자체 호스팅 솔루션에서 제공하는 수백 개의 독점 및 오픈 소스 LLM과 원활하게 통합되며, GPT, Mistral, Llama3 및 모든 OpenAI API 호환 모델을 포함합니다. 지원되는 모델 제공업체의 전체 목록은 [여기](https://docs.dify.ai/getting-started/readme/model-providers)에서 확인할 수 있습니다.
56
+ ![providers-v5](https://github.com/langgenius/dify/assets/13230914/5a17bdbe-097a-4100-8363-40255b70f6e3)
57
+
58
+
59
+ **3. 통합 개발환경**:
60
+ 프롬프트를 작성하고, 모델 성능을 비교하며, 텍스트-음성 변환과 같은 추가 기능을 채팅 기반 앱에 추가할 수 있는 직관적인 인터페이스를 제공합니다.
61
+
62
+ **4. RAG 파이프라인**:
63
+ 문서 수집부터 검색까지 모든 것을 다루며, PDF, PPT 및 기타 일반적인 문서 형식에서 텍스트 추출을 위한 기본 지원이 포함되어 있는 광범위한 RAG 기능을 제공합니다.
64
+
65
+ **5. 에이전트 기능**:
66
+ LLM 함수 호출 또는 ReAct를 기반으로 에이전트를 정의하고 에이전트에 대해 사전 구축된 도구나 사용자 정의 도구를 추가할 수 있습니다. Dify는 Google Search, DELL·E, Stable Diffusion, WolframAlpha 등 AI 에이전트를 위한 50개 이상의 내장 도구를 제공합니다.
67
+
68
+ **6. LLMOps**:
69
+ 시간 경과에 따른 애플리케이션 로그와 성능을 모니터링하고 분석합니다. 생산 데이터와 주석을 기반으로 프롬프트, 데이터세트, 모델을 지속적으로 개선할 수 있습니다.
70
+
71
+ **7. Backend-as-a-Service**:
72
+ Dify의 모든 제품에는 해당 API가 함께 제공되므로 Dify를 자신의 비즈니스 로직에 쉽게 통합할 수 있습니다.
73
+
74
+ ## 기능 비교
75
+ <table style="width: 100%;">
76
+ <tr>
77
+ <th align="center">기능</th>
78
+ <th align="center">Dify.AI</th>
79
+ <th align="center">LangChain</th>
80
+ <th align="center">Flowise</th>
81
+ <th align="center">OpenAI Assistants API</th>
82
+ </tr>
83
+ <tr>
84
+ <td align="center">프로그래밍 접근 방식</td>
85
+ <td align="center">API + 앱 중심</td>
86
+ <td align="center">Python 코드</td>
87
+ <td align="center">앱 중심</td>
88
+ <td align="center">API 중심</td>
89
+ </tr>
90
+ <tr>
91
+ <td align="center">지원되는 LLMs</td>
92
+ <td align="center">다양한 종류</td>
93
+ <td align="center">다양한 종류</td>
94
+ <td align="center">다양한 종류</td>
95
+ <td align="center">OpenAI 전용</td>
96
+ </tr>
97
+ <tr>
98
+ <td align="center">RAG 엔진</td>
99
+ <td align="center">✅</td>
100
+ <td align="center">✅</td>
101
+ <td align="center">✅</td>
102
+ <td align="center">✅</td>
103
+ </tr>
104
+ <tr>
105
+ <td align="center">에이전트</td>
106
+ <td align="center">✅</td>
107
+ <td align="center">✅</td>
108
+ <td align="center">❌</td>
109
+ <td align="center">✅</td>
110
+ </tr>
111
+ <tr>
112
+ <td align="center">워크플로우</td>
113
+ <td align="center">✅</td>
114
+ <td align="center">❌</td>
115
+ <td align="center">✅</td>
116
+ <td align="center">❌</td>
117
+ </tr>
118
+ <tr>
119
+ <td align="center">가시성</td>
120
+ <td align="center">✅</td>
121
+ <td align="center">✅</td>
122
+ <td align="center">❌</td>
123
+ <td align="center">❌</td>
124
+ </tr>
125
+ <tr>
126
+ <td align="center">기업용 기능 (SSO/접근 제어)</td>
127
+ <td align="center">✅</td>
128
+ <td align="center">❌</td>
129
+ <td align="center">❌</td>
130
+ <td align="center">❌</td>
131
+ </tr>
132
+ <tr>
133
+ <td align="center">로컬 배포</td>
134
+ <td align="center">✅</td>
135
+ <td align="center">✅</td>
136
+ <td align="center">✅</td>
137
+ <td align="center">❌</td>
138
+ </tr>
139
+ </table>
140
+
141
+ ## Dify 사용하기
142
+
143
+ - **클라우드 </br>**
144
+ 우리는 누구나 설정이 필요 없이 사용해 볼 수 있도록 [Dify 클라우드](https://dify.ai) 서비스를 호스팅합니다. 이는 자체 배포 버전의 모든 기능을 제공하며, 샌드박스 플랜에서 무료로 200회의 GPT-4 호출을 포함합니다.
145
+
146
+ - **셀프-호스팅 Dify 커뮤니티 에디션</br>**
147
+ 환경에서 Dify를 빠르게 실행하려면 이 [스타터 가이드를](#quick-start) 참조하세요.
148
+ 추가 참조 및 더 심층적인 지침은 [문서](https://docs.dify.ai)를 사용하세요.
149
+
150
+ - **기업 / 조직을 위한 Dify</br>**
151
+ 우리는 추가적인 기업 중심 기능을 제공합니다. 당사와 [미팅일정](https://cal.com/guchenhe/30min)을 잡거나 [이메일 보내기](mailto:business@dify.ai?subject=[GitHub]Business%20License%20Inquiry)를 통해 기업 요구 사항을 논의하십시오. </br>
152
+ > AWS를 사용하는 스타트업 및 중소기업의 경우 [AWS Marketplace에서 Dify Premium](https://aws.amazon.com/marketplace/pp/prodview-t22mebxzwjhu6)을 확인하고 한 번의 클릭으로 자체 AWS VPC에 배포하십시오. 맞춤형 로고와 브랜딩이 포함된 앱을 생성할 수 있는 옵션이 포함된 저렴한 AMI 제품입니다.
153
+
154
+
155
+
156
+ ## 앞서가기
157
+
158
+ GitHub에서 Dify에 별표를 찍어 새로운 릴리스를 즉시 알림 받으세요.
159
+
160
+ ![star-us](https://github.com/langgenius/dify/assets/13230914/b823edc1-6388-4e25-ad45-2f6b187adbb4)
161
+
162
+
163
+
164
+ ## 빠른 시작
165
+ >Dify를 설치하기 전에 컴퓨터가 다음과 같은 최소 시스템 요구 사항을 충족하는지 확인하세요 :
166
+ >- CPU >= 2 Core
167
+ >- RAM >= 4GB
168
+
169
+ </br>
170
+
171
+ Dify 서버를 시작하는 가장 쉬운 방법은 [docker-compose.yml](docker/docker-compose.yaml) 파일을 실행하는 것입니다. 설치 명령을 실행하기 전에 [Docker](https://docs.docker.com/get-docker/) 및 [Docker Compose](https://docs.docker.com/compose/install/)가 머신에 설치되어 있는지 확인하세요.
172
+
173
+ ```bash
174
+ cd docker
175
+ docker compose up -d
176
+ ```
177
+
178
+ 실행 후 브라우저의 [http://localhost/install](http://localhost/install) 에서 Dify 대시보드에 액세스하고 초기화 프로세스를 시작할 수 있습니다.
179
+
180
+ > Dify에 기여하거나 추가 개발을 하고 싶다면 소스 코드에서 [배포에 대한 가이드](https://docs.dify.ai/getting-started/install-self-hosted/local-source-code)를 참조하세요.
181
+
182
+ ## 다음 단계
183
+
184
+ 구성 커스터마이징이 필요한 경우, [docker-compose.yml](docker/docker-compose.yaml) 파일의 코멘트를 참조하여 환경 구성을 수동으로 설정하십시오. 변경 후 `docker-compose up -d` 를 다시 실행하십시오. 환경 변수의 전체 목록은 [여기](https://docs.dify.ai/getting-started/install-self-hosted/environments)에서 확인할 수 있습니다.
185
+
186
+
187
+ 고가용성 설정을 구성하려면 Dify를 Kubernetes에 배포할 수 있는 커뮤니티 제공 [Helm Charts](https://helm.sh/)가 있습니다.
188
+
189
+ - [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)
190
+ - [Helm Chart by @BorisPolonsky](https://github.com/BorisPolonsky/dify-helm)
191
+
192
+
193
+ ## 기여
194
+
195
+ 코드에 기여하고 싶은 분들은 [기여 가이드](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md)를 참조하세요.
196
+ 동시에 Dify를 소셜 미디어와 행사 및 컨퍼런스에 공유하여 지원하는 것을 고려해 주시기 바랍니다.
197
+
198
+
199
+ > 우리는 Dify를 중국어나 영어 이외의 언어로 번역하는 데 도움을 줄 수 있는 기여자를 찾고 있습니다. 도움을 주고 싶으시다면 [i18n README](https://github.com/langgenius/dify/blob/main/web/i18n/README.md)에서 더 많은 정보를 확인하시고 [Discord 커뮤니티 서버](https://discord.gg/8Tpq4AcN9c)의 `global-users` 채널에 댓글을 남겨주세요.
200
+
201
+ **기여자**
202
+
203
+ <a href="https://github.com/langgenius/dify/graphs/contributors">
204
+ <img src="https://contrib.rocks/image?repo=langgenius/dify" />
205
+ </a>
206
+
207
+ ## 커뮤니티 & 연락처
208
+
209
+ * [Github 토론](https://github.com/langgenius/dify/discussions). 피드백 공유 및 질문하기에 적합합니다.
210
+ * [GitHub 이슈](https://github.com/langgenius/dify/issues). Dify.AI 사용 중 발견한 버그와 기능 제안에 적합합니다. [기여 가이드](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md)를 참조하세요.
211
+ * [이메일](mailto:support@dify.ai?subject=[GitHub]Questions%20About%20Dify). Dify.AI 사용에 대한 질문하기에 적합합니다.
212
+ * [디스코드](https://discord.gg/FngNHpbcY7). 애플리케이션 공유 및 커뮤니티와 소통하기에 적합합니다.
213
+ * [트위터](https://twitter.com/dify_ai). 애플리케이션 공유 및 커뮤니티와 소통하기에 적합합니다.
214
+
215
+ 또는 팀원과 직접 미팅을 예약하세요:
216
+
217
+ <table>
218
+ <tr>
219
+ <th>연락처</th>
220
+ <th>목적</th>
221
+ </tr>
222
+ <tr>
223
+ <td><a href='https://cal.com/guchenhe/15min' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/9ebcd111-1205-4d71-83d5-948d70b809f5' alt='Git-Hub-README-Button-3x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
224
+ <td>비즈니스 문의 및 제품 피드백</td>
225
+ </tr>
226
+ <tr>
227
+ <td><a href='https://cal.com/pinkbanana' target='_blank'><img class="schedule-button" src='https://github.com/langgenius/dify/assets/13230914/d1edd00a-d7e4-4513-be6c-e57038e143fd' alt='Git-Hub-README-Button-2x' style="width: 180px; height: auto; object-fit: contain;"/></a></td>
228
+ <td>기여, 이슈 및 기능 요청</td>
229
+ </tr>
230
+ </table>
231
+
232
+ ## Star 히스토리
233
+
234
+ [![Star History Chart](https://api.star-history.com/svg?repos=langgenius/dify&type=Date)](https://star-history.com/#langgenius/dify&Date)
235
+
236
+
237
+ ## 보안 공개
238
+
239
+ 개인정보 보호를 위해 보안 문제를 GitHub에 게시하지 마십시오. 대신 security@dify.ai로 질문을 보내주시면 더 자세한 답변을 드리겠습니다.
240
+
241
+ ## 라이선스
242
+
243
+ 이 저장소는 기본적으로 몇 가지 추가 제한 사항이 있는 Apache 2.0인 [Dify 오픈 소스 라이선스](LICENSE)에 따라 사용할 수 있습니다.
api/.dockerignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .env
2
+ *.env.*
3
+
4
+ storage/privkeys/*
5
+
6
+ # Logs
7
+ logs
8
+ *.log*
9
+
10
+ # jetbrains
11
+ .idea
api/.env.example ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Your App secret key will be used for securely signing the session cookie
2
+ # Make sure you are changing this key for your deployment with a strong key.
3
+ # You can generate a strong key using `openssl rand -base64 42`.
4
+ # Alternatively you can set it with `SECRET_KEY` environment variable.
5
+ SECRET_KEY=
6
+
7
+ # Console API base URL
8
+ CONSOLE_API_URL=http://127.0.0.1:5001
9
+ CONSOLE_WEB_URL=http://127.0.0.1:3000
10
+
11
+ # Service API base URL
12
+ SERVICE_API_URL=http://127.0.0.1:5001
13
+
14
+ # Web APP base URL
15
+ APP_WEB_URL=http://127.0.0.1:3000
16
+
17
+ # Files URL
18
+ FILES_URL=http://127.0.0.1:5001
19
+
20
+ # celery configuration
21
+ CELERY_BROKER_URL=redis://:difyai123456@localhost:6379/1
22
+
23
+ # redis configuration
24
+ REDIS_HOST=localhost
25
+ REDIS_PORT=6379
26
+ REDIS_USERNAME=
27
+ REDIS_PASSWORD=difyai123456
28
+ REDIS_DB=0
29
+
30
+ # PostgreSQL database configuration
31
+ DB_USERNAME=postgres
32
+ DB_PASSWORD=difyai123456
33
+ DB_HOST=localhost
34
+ DB_PORT=5432
35
+ DB_DATABASE=dify
36
+
37
+ # Storage configuration
38
+ # use for store upload files, private keys...
39
+ # storage type: local, s3, azure-blob
40
+ STORAGE_TYPE=local
41
+ STORAGE_LOCAL_PATH=storage
42
+ S3_ENDPOINT=https://your-bucket-name.storage.s3.clooudflare.com
43
+ S3_BUCKET_NAME=your-bucket-name
44
+ S3_ACCESS_KEY=your-access-key
45
+ S3_SECRET_KEY=your-secret-key
46
+ S3_REGION=your-region
47
+ # Azure Blob Storage configuration
48
+ AZURE_BLOB_ACCOUNT_NAME=your-account-name
49
+ AZURE_BLOB_ACCOUNT_KEY=your-account-key
50
+ AZURE_BLOB_CONTAINER_NAME=yout-container-name
51
+ AZURE_BLOB_ACCOUNT_URL=https://<your_account_name>.blob.core.windows.net
52
+ # Aliyun oss Storage configuration
53
+ ALIYUN_OSS_BUCKET_NAME=your-bucket-name
54
+ ALIYUN_OSS_ACCESS_KEY=your-access-key
55
+ ALIYUN_OSS_SECRET_KEY=your-secret-key
56
+ ALIYUN_OSS_ENDPOINT=your-endpoint
57
+ ALIYUN_OSS_AUTH_VERSION=v1
58
+ ALIYUN_OSS_REGION=your-region
59
+
60
+ # Google Storage configuration
61
+ GOOGLE_STORAGE_BUCKET_NAME=yout-bucket-name
62
+ GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON=your-google-service-account-json-base64-string
63
+
64
+ # CORS configuration
65
+ WEB_API_CORS_ALLOW_ORIGINS=http://127.0.0.1:3000,*
66
+ CONSOLE_CORS_ALLOW_ORIGINS=http://127.0.0.1:3000,*
67
+
68
+ # Vector database configuration, support: weaviate, qdrant, milvus, relyt, pgvecto_rs, pgvector
69
+ VECTOR_STORE=weaviate
70
+
71
+ # Weaviate configuration
72
+ WEAVIATE_ENDPOINT=http://localhost:8080
73
+ WEAVIATE_API_KEY=WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
74
+ WEAVIATE_GRPC_ENABLED=false
75
+ WEAVIATE_BATCH_SIZE=100
76
+
77
+ # Qdrant configuration, use `http://localhost:6333` for local mode or `https://your-qdrant-cluster-url.qdrant.io` for remote mode
78
+ QDRANT_URL=http://localhost:6333
79
+ QDRANT_API_KEY=difyai123456
80
+ QDRANT_CLIENT_TIMEOUT=20
81
+ QDRANT_GRPC_ENABLED=false
82
+ QDRANT_GRPC_PORT=6334
83
+
84
+ # Milvus configuration
85
+ MILVUS_HOST=127.0.0.1
86
+ MILVUS_PORT=19530
87
+ MILVUS_USER=root
88
+ MILVUS_PASSWORD=Milvus
89
+ MILVUS_SECURE=false
90
+
91
+ # Relyt configuration
92
+ RELYT_HOST=127.0.0.1
93
+ RELYT_PORT=5432
94
+ RELYT_USER=postgres
95
+ RELYT_PASSWORD=postgres
96
+ RELYT_DATABASE=postgres
97
+
98
+ # PGVECTO_RS configuration
99
+ PGVECTO_RS_HOST=localhost
100
+ PGVECTO_RS_PORT=5431
101
+ PGVECTO_RS_USER=postgres
102
+ PGVECTO_RS_PASSWORD=difyai123456
103
+ PGVECTO_RS_DATABASE=postgres
104
+
105
+ # PGVector configuration
106
+ PGVECTOR_HOST=127.0.0.1
107
+ PGVECTOR_PORT=5433
108
+ PGVECTOR_USER=postgres
109
+ PGVECTOR_PASSWORD=postgres
110
+ PGVECTOR_DATABASE=postgres
111
+
112
+ # Upload configuration
113
+ UPLOAD_FILE_SIZE_LIMIT=15
114
+ UPLOAD_FILE_BATCH_LIMIT=5
115
+ UPLOAD_IMAGE_FILE_SIZE_LIMIT=10
116
+
117
+ # Model Configuration
118
+ MULTIMODAL_SEND_IMAGE_FORMAT=base64
119
+
120
+ # Mail configuration, support: resend, smtp
121
+ MAIL_TYPE=
122
+ MAIL_DEFAULT_SEND_FROM=no-reply <no-reply@dify.ai>
123
+ RESEND_API_KEY=
124
+ RESEND_API_URL=https://api.resend.com
125
+ # smtp configuration
126
+ SMTP_SERVER=smtp.gmail.com
127
+ SMTP_PORT=587
128
+ SMTP_USERNAME=123
129
+ SMTP_PASSWORD=abc
130
+ SMTP_USE_TLS=false
131
+
132
+ # Sentry configuration
133
+ SENTRY_DSN=
134
+
135
+ # DEBUG
136
+ DEBUG=false
137
+ SQLALCHEMY_ECHO=false
138
+
139
+ # Notion import configuration, support public and internal
140
+ NOTION_INTEGRATION_TYPE=public
141
+ NOTION_CLIENT_SECRET=you-client-secret
142
+ NOTION_CLIENT_ID=you-client-id
143
+ NOTION_INTERNAL_SECRET=you-internal-secret
144
+
145
+ ETL_TYPE=dify
146
+ UNSTRUCTURED_API_URL=
147
+ UNSTRUCTURED_API_KEY=
148
+
149
+ SSRF_PROXY_HTTP_URL=
150
+ SSRF_PROXY_HTTPS_URL=
151
+
152
+ BATCH_UPLOAD_LIMIT=10
153
+ KEYWORD_DATA_SOURCE_TYPE=database
154
+
155
+ # CODE EXECUTION CONFIGURATION
156
+ CODE_EXECUTION_ENDPOINT=http://127.0.0.1:8194
157
+ CODE_EXECUTION_API_KEY=dify-sandbox
158
+ CODE_MAX_NUMBER=9223372036854775807
159
+ CODE_MIN_NUMBER=-9223372036854775808
160
+ CODE_MAX_STRING_LENGTH=80000
161
+ TEMPLATE_TRANSFORM_MAX_LENGTH=80000
162
+ CODE_MAX_STRING_ARRAY_LENGTH=30
163
+ CODE_MAX_OBJECT_ARRAY_LENGTH=30
164
+ CODE_MAX_NUMBER_ARRAY_LENGTH=1000
165
+
166
+ # API Tool configuration
167
+ API_TOOL_DEFAULT_CONNECT_TIMEOUT=10
168
+ API_TOOL_DEFAULT_READ_TIMEOUT=60
169
+
170
+ # HTTP Node configuration
171
+ HTTP_REQUEST_MAX_CONNECT_TIMEOUT=300
172
+ HTTP_REQUEST_MAX_READ_TIMEOUT=600
173
+ HTTP_REQUEST_MAX_WRITE_TIMEOUT=600
174
+ HTTP_REQUEST_NODE_MAX_BINARY_SIZE=10485760 # 10MB
175
+ HTTP_REQUEST_NODE_MAX_TEXT_SIZE=1048576 # 1MB
176
+
177
+ # Log file path
178
+ LOG_FILE=
179
+
180
+ # Indexing configuration
181
+ INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH=1000
api/.vscode/launch.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Python: Celery",
9
+ "type": "debugpy",
10
+ "request": "launch",
11
+ "module": "celery",
12
+ "justMyCode": true,
13
+ "args": ["-A", "app.celery", "worker", "-P", "gevent", "-c", "1", "--loglevel", "info", "-Q", "dataset,generation,mail"],
14
+ "envFile": "${workspaceFolder}/.env",
15
+ "env": {
16
+ "FLASK_APP": "app.py",
17
+ "FLASK_DEBUG": "1",
18
+ "GEVENT_SUPPORT": "True"
19
+ },
20
+ "console": "integratedTerminal"
21
+ },
22
+ {
23
+ "name": "Python: Flask",
24
+ "type": "debugpy",
25
+ "request": "launch",
26
+ "module": "flask",
27
+ "env": {
28
+ "FLASK_APP": "app.py",
29
+ "FLASK_DEBUG": "1",
30
+ "GEVENT_SUPPORT": "True"
31
+ },
32
+ "args": [
33
+ "run",
34
+ "--host=0.0.0.0",
35
+ "--port=5001",
36
+ "--debug"
37
+ ],
38
+ "jinja": true,
39
+ "justMyCode": true
40
+ }
41
+ ]
42
+ }
api/Dockerfile ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # base image
2
+ FROM python:3.10-slim-bookworm AS base
3
+
4
+ LABEL maintainer="takatost@gmail.com"
5
+
6
+ # install packages
7
+ FROM base as packages
8
+
9
+ RUN apt-get update \
10
+ && apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev
11
+
12
+ COPY requirements.txt /requirements.txt
13
+
14
+ RUN --mount=type=cache,target=/root/.cache/pip \
15
+ pip install --prefix=/pkg -r requirements.txt
16
+
17
+ # production stage
18
+ FROM base AS production
19
+
20
+ ENV FLASK_APP app.py
21
+ ENV EDITION SELF_HOSTED
22
+ ENV DEPLOY_ENV PRODUCTION
23
+ ENV CONSOLE_API_URL http://127.0.0.1:5001
24
+ ENV CONSOLE_WEB_URL http://127.0.0.1:3000
25
+ ENV SERVICE_API_URL http://127.0.0.1:5001
26
+ ENV APP_WEB_URL http://127.0.0.1:3000
27
+
28
+ EXPOSE 5001
29
+
30
+ # set timezone
31
+ ENV TZ UTC
32
+
33
+ WORKDIR /app/api
34
+
35
+ RUN apt-get update \
36
+ && apt-get install -y --no-install-recommends curl wget vim nodejs ffmpeg libgmp-dev libmpfr-dev libmpc-dev \
37
+ && apt-get autoremove \
38
+ && rm -rf /var/lib/apt/lists/*
39
+
40
+ COPY --from=packages /pkg /usr/local
41
+ COPY . /app/api/
42
+
43
+ COPY docker/entrypoint.sh /entrypoint.sh
44
+ RUN chmod +x /entrypoint.sh
45
+
46
+ ARG COMMIT_SHA
47
+ ENV COMMIT_SHA ${COMMIT_SHA}
48
+
49
+ ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
api/README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dify Backend API
2
+
3
+ ## Usage
4
+
5
+ 1. Start the docker-compose stack
6
+
7
+ The backend require some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using `docker-compose`.
8
+
9
+ ```bash
10
+ cd ../docker
11
+ docker-compose -f docker-compose.middleware.yaml -p dify up -d
12
+ cd ../api
13
+ ```
14
+ 2. Copy `.env.example` to `.env`
15
+ 3. Generate a `SECRET_KEY` in the `.env` file.
16
+
17
+ ```bash
18
+ sed -i "/^SECRET_KEY=/c\SECRET_KEY=$(openssl rand -base64 42)" .env
19
+ ```
20
+ 4. If you use Anaconda, create a new environment and activate it
21
+ ```bash
22
+ conda create --name dify python=3.10
23
+ conda activate dify
24
+ ```
25
+ 5. Install dependencies
26
+ ```bash
27
+ pip install -r requirements.txt
28
+ ```
29
+ 6. Run migrate
30
+
31
+ Before the first launch, migrate the database to the latest version.
32
+
33
+ ```bash
34
+ flask db upgrade
35
+ ```
36
+
37
+ ⚠️ If you encounter problems with jieba, for example
38
+
39
+ ```
40
+ > flask db upgrade
41
+ Error: While importing 'app', an ImportError was raised:
42
+ ```
43
+
44
+ Please run the following command instead.
45
+
46
+ ```
47
+ pip install -r requirements.txt --upgrade --force-reinstall
48
+ ```
49
+
50
+ 7. Start backend:
51
+ ```bash
52
+ flask run --host 0.0.0.0 --port=5001 --debug
53
+ ```
54
+ 8. Setup your application by visiting http://localhost:5001/console/api/setup or other apis...
55
+ 9. If you need to debug local async processing, please start the worker service by running
56
+ `celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail`.
57
+ The started celery app handles the async tasks, e.g. dataset importing and documents indexing.
58
+
59
+
60
+ ## Testing
61
+
62
+ 1. Install dependencies for both the backend and the test environment
63
+ ```bash
64
+ pip install -r requirements.txt -r requirements-dev.txt
65
+ ```
66
+
67
+ 2. Run the tests locally with mocked system environment variables in `tool.pytest_env` section in `pyproject.toml`
68
+ ```bash
69
+ dev/pytest/pytest_all_tests.sh
70
+ ```
api/app.py ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ if not os.environ.get("DEBUG") or os.environ.get("DEBUG").lower() != 'true':
4
+ from gevent import monkey
5
+
6
+ monkey.patch_all()
7
+
8
+ import grpc.experimental.gevent
9
+
10
+ grpc.experimental.gevent.init_gevent()
11
+
12
+ import json
13
+ import logging
14
+ import sys
15
+ import threading
16
+ import time
17
+ import warnings
18
+ from logging.handlers import RotatingFileHandler
19
+
20
+ from flask import Flask, Response, request
21
+ from flask_cors import CORS
22
+ from werkzeug.exceptions import Unauthorized
23
+
24
+ from commands import register_commands
25
+ from config import Config
26
+
27
+ # DO NOT REMOVE BELOW
28
+ from events import event_handlers
29
+ from extensions import (
30
+ ext_celery,
31
+ ext_code_based_extension,
32
+ ext_compress,
33
+ ext_database,
34
+ ext_hosting_provider,
35
+ ext_login,
36
+ ext_mail,
37
+ ext_migrate,
38
+ ext_redis,
39
+ ext_sentry,
40
+ ext_storage,
41
+ )
42
+ from extensions.ext_database import db
43
+ from extensions.ext_login import login_manager
44
+ from libs.passport import PassportService
45
+ from models import account, dataset, model, source, task, tool, tools, web
46
+ from services.account_service import AccountService
47
+
48
+ # DO NOT REMOVE ABOVE
49
+
50
+
51
+ warnings.simplefilter("ignore", ResourceWarning)
52
+
53
+ # fix windows platform
54
+ if os.name == "nt":
55
+ os.system('tzutil /s "UTC"')
56
+ else:
57
+ os.environ['TZ'] = 'UTC'
58
+ time.tzset()
59
+
60
+
61
+ class DifyApp(Flask):
62
+ pass
63
+
64
+
65
+ # -------------
66
+ # Configuration
67
+ # -------------
68
+
69
+
70
+ config_type = os.getenv('EDITION', default='SELF_HOSTED') # ce edition first
71
+
72
+
73
+ # ----------------------------
74
+ # Application Factory Function
75
+ # ----------------------------
76
+
77
+
78
+ def create_app() -> Flask:
79
+ app = DifyApp(__name__)
80
+ app.config.from_object(Config())
81
+
82
+ app.secret_key = app.config['SECRET_KEY']
83
+
84
+ log_handlers = None
85
+ log_file = app.config.get('LOG_FILE')
86
+ if log_file:
87
+ log_dir = os.path.dirname(log_file)
88
+ os.makedirs(log_dir, exist_ok=True)
89
+ log_handlers = [
90
+ RotatingFileHandler(
91
+ filename=log_file,
92
+ maxBytes=1024 * 1024 * 1024,
93
+ backupCount=5
94
+ ),
95
+ logging.StreamHandler(sys.stdout)
96
+ ]
97
+
98
+ logging.basicConfig(
99
+ level=app.config.get('LOG_LEVEL'),
100
+ format=app.config.get('LOG_FORMAT'),
101
+ datefmt=app.config.get('LOG_DATEFORMAT'),
102
+ handlers=log_handlers
103
+ )
104
+
105
+ initialize_extensions(app)
106
+ register_blueprints(app)
107
+ register_commands(app)
108
+
109
+ return app
110
+
111
+
112
+ def initialize_extensions(app):
113
+ # Since the application instance is now created, pass it to each Flask
114
+ # extension instance to bind it to the Flask application instance (app)
115
+ ext_compress.init_app(app)
116
+ ext_code_based_extension.init()
117
+ ext_database.init_app(app)
118
+ ext_migrate.init(app, db)
119
+ ext_redis.init_app(app)
120
+ ext_storage.init_app(app)
121
+ ext_celery.init_app(app)
122
+ ext_login.init_app(app)
123
+ ext_mail.init_app(app)
124
+ ext_hosting_provider.init_app(app)
125
+ ext_sentry.init_app(app)
126
+
127
+
128
+ # Flask-Login configuration
129
+ @login_manager.request_loader
130
+ def load_user_from_request(request_from_flask_login):
131
+ """Load user based on the request."""
132
+ if request.blueprint in ['console', 'inner_api']:
133
+ # Check if the user_id contains a dot, indicating the old format
134
+ auth_header = request.headers.get('Authorization', '')
135
+ if not auth_header:
136
+ auth_token = request.args.get('_token')
137
+ if not auth_token:
138
+ raise Unauthorized('Invalid Authorization token.')
139
+ else:
140
+ if ' ' not in auth_header:
141
+ raise Unauthorized('Invalid Authorization header format. Expected \'Bearer <api-key>\' format.')
142
+ auth_scheme, auth_token = auth_header.split(None, 1)
143
+ auth_scheme = auth_scheme.lower()
144
+ if auth_scheme != 'bearer':
145
+ raise Unauthorized('Invalid Authorization header format. Expected \'Bearer <api-key>\' format.')
146
+
147
+ decoded = PassportService().verify(auth_token)
148
+ user_id = decoded.get('user_id')
149
+
150
+ return AccountService.load_user(user_id)
151
+ else:
152
+ return None
153
+
154
+
155
+ @login_manager.unauthorized_handler
156
+ def unauthorized_handler():
157
+ """Handle unauthorized requests."""
158
+ return Response(json.dumps({
159
+ 'code': 'unauthorized',
160
+ 'message': "Unauthorized."
161
+ }), status=401, content_type="application/json")
162
+
163
+
164
+ # register blueprint routers
165
+ def register_blueprints(app):
166
+ from controllers.console import bp as console_app_bp
167
+ from controllers.files import bp as files_bp
168
+ from controllers.inner_api import bp as inner_api_bp
169
+ from controllers.service_api import bp as service_api_bp
170
+ from controllers.web import bp as web_bp
171
+
172
+ CORS(service_api_bp,
173
+ allow_headers=['Content-Type', 'Authorization', 'X-App-Code'],
174
+ methods=['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'PATCH']
175
+ )
176
+ app.register_blueprint(service_api_bp)
177
+
178
+ CORS(web_bp,
179
+ resources={
180
+ r"/*": {"origins": app.config['WEB_API_CORS_ALLOW_ORIGINS']}},
181
+ supports_credentials=True,
182
+ allow_headers=['Content-Type', 'Authorization', 'X-App-Code'],
183
+ methods=['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'PATCH'],
184
+ expose_headers=['X-Version', 'X-Env']
185
+ )
186
+
187
+ app.register_blueprint(web_bp)
188
+
189
+ CORS(console_app_bp,
190
+ resources={
191
+ r"/*": {"origins": app.config['CONSOLE_CORS_ALLOW_ORIGINS']}},
192
+ supports_credentials=True,
193
+ allow_headers=['Content-Type', 'Authorization'],
194
+ methods=['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'PATCH'],
195
+ expose_headers=['X-Version', 'X-Env']
196
+ )
197
+
198
+ app.register_blueprint(console_app_bp)
199
+
200
+ CORS(files_bp,
201
+ allow_headers=['Content-Type'],
202
+ methods=['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'PATCH']
203
+ )
204
+ app.register_blueprint(files_bp)
205
+
206
+ app.register_blueprint(inner_api_bp)
207
+
208
+
209
+ # create app
210
+ app = create_app()
211
+ celery = app.extensions["celery"]
212
+
213
+ if app.config['TESTING']:
214
+ print("App is running in TESTING mode")
215
+
216
+
217
+ @app.after_request
218
+ def after_request(response):
219
+ """Add Version headers to the response."""
220
+ response.set_cookie('remember_token', '', expires=0)
221
+ response.headers.add('X-Version', app.config['CURRENT_VERSION'])
222
+ response.headers.add('X-Env', app.config['DEPLOY_ENV'])
223
+ return response
224
+
225
+
226
+ @app.route('/health')
227
+ def health():
228
+ return Response(json.dumps({
229
+ 'status': 'ok',
230
+ 'version': app.config['CURRENT_VERSION']
231
+ }), status=200, content_type="application/json")
232
+
233
+
234
+ @app.route('/threads')
235
+ def threads():
236
+ num_threads = threading.active_count()
237
+ threads = threading.enumerate()
238
+
239
+ thread_list = []
240
+ for thread in threads:
241
+ thread_name = thread.name
242
+ thread_id = thread.ident
243
+ is_alive = thread.is_alive()
244
+
245
+ thread_list.append({
246
+ 'name': thread_name,
247
+ 'id': thread_id,
248
+ 'is_alive': is_alive
249
+ })
250
+
251
+ return {
252
+ 'thread_num': num_threads,
253
+ 'threads': thread_list
254
+ }
255
+
256
+
257
+ @app.route('/db-pool-stat')
258
+ def pool_stat():
259
+ engine = db.engine
260
+ return {
261
+ 'pool_size': engine.pool.size(),
262
+ 'checked_in_connections': engine.pool.checkedin(),
263
+ 'checked_out_connections': engine.pool.checkedout(),
264
+ 'overflow_connections': engine.pool.overflow(),
265
+ 'connection_timeout': engine.pool.timeout(),
266
+ 'recycle_time': db.engine.pool._recycle
267
+ }
268
+
269
+
270
+ if __name__ == '__main__':
271
+ app.run(host='0.0.0.0', port=5001)
api/commands.py ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import base64
2
+ import json
3
+ import secrets
4
+
5
+ import click
6
+ from flask import current_app
7
+ from werkzeug.exceptions import NotFound
8
+
9
+ from core.rag.datasource.vdb.vector_factory import Vector
10
+ from core.rag.models.document import Document
11
+ from extensions.ext_database import db
12
+ from libs.helper import email as email_validate
13
+ from libs.password import hash_password, password_pattern, valid_password
14
+ from libs.rsa import generate_key_pair
15
+ from models.account import Tenant
16
+ from models.dataset import Dataset, DatasetCollectionBinding, DocumentSegment
17
+ from models.dataset import Document as DatasetDocument
18
+ from models.model import Account, App, AppAnnotationSetting, AppMode, Conversation, MessageAnnotation
19
+ from models.provider import Provider, ProviderModel
20
+
21
+
22
+ @click.command('reset-password', help='Reset the account password.')
23
+ @click.option('--email', prompt=True, help='The email address of the account whose password you need to reset')
24
+ @click.option('--new-password', prompt=True, help='the new password.')
25
+ @click.option('--password-confirm', prompt=True, help='the new password confirm.')
26
+ def reset_password(email, new_password, password_confirm):
27
+ """
28
+ Reset password of owner account
29
+ Only available in SELF_HOSTED mode
30
+ """
31
+ if str(new_password).strip() != str(password_confirm).strip():
32
+ click.echo(click.style('sorry. The two passwords do not match.', fg='red'))
33
+ return
34
+
35
+ account = db.session.query(Account). \
36
+ filter(Account.email == email). \
37
+ one_or_none()
38
+
39
+ if not account:
40
+ click.echo(click.style('sorry. the account: [{}] not exist .'.format(email), fg='red'))
41
+ return
42
+
43
+ try:
44
+ valid_password(new_password)
45
+ except:
46
+ click.echo(
47
+ click.style('sorry. The passwords must match {} '.format(password_pattern), fg='red'))
48
+ return
49
+
50
+ # generate password salt
51
+ salt = secrets.token_bytes(16)
52
+ base64_salt = base64.b64encode(salt).decode()
53
+
54
+ # encrypt password with salt
55
+ password_hashed = hash_password(new_password, salt)
56
+ base64_password_hashed = base64.b64encode(password_hashed).decode()
57
+ account.password = base64_password_hashed
58
+ account.password_salt = base64_salt
59
+ db.session.commit()
60
+ click.echo(click.style('Congratulations!, password has been reset.', fg='green'))
61
+
62
+
63
+ @click.command('reset-email', help='Reset the account email.')
64
+ @click.option('--email', prompt=True, help='The old email address of the account whose email you need to reset')
65
+ @click.option('--new-email', prompt=True, help='the new email.')
66
+ @click.option('--email-confirm', prompt=True, help='the new email confirm.')
67
+ def reset_email(email, new_email, email_confirm):
68
+ """
69
+ Replace account email
70
+ :return:
71
+ """
72
+ if str(new_email).strip() != str(email_confirm).strip():
73
+ click.echo(click.style('Sorry, new email and confirm email do not match.', fg='red'))
74
+ return
75
+
76
+ account = db.session.query(Account). \
77
+ filter(Account.email == email). \
78
+ one_or_none()
79
+
80
+ if not account:
81
+ click.echo(click.style('sorry. the account: [{}] not exist .'.format(email), fg='red'))
82
+ return
83
+
84
+ try:
85
+ email_validate(new_email)
86
+ except:
87
+ click.echo(
88
+ click.style('sorry. {} is not a valid email. '.format(email), fg='red'))
89
+ return
90
+
91
+ account.email = new_email
92
+ db.session.commit()
93
+ click.echo(click.style('Congratulations!, email has been reset.', fg='green'))
94
+
95
+
96
+ @click.command('reset-encrypt-key-pair', help='Reset the asymmetric key pair of workspace for encrypt LLM credentials. '
97
+ 'After the reset, all LLM credentials will become invalid, '
98
+ 'requiring re-entry.'
99
+ 'Only support SELF_HOSTED mode.')
100
+ @click.confirmation_option(prompt=click.style('Are you sure you want to reset encrypt key pair?'
101
+ ' this operation cannot be rolled back!', fg='red'))
102
+ def reset_encrypt_key_pair():
103
+ """
104
+ Reset the encrypted key pair of workspace for encrypt LLM credentials.
105
+ After the reset, all LLM credentials will become invalid, requiring re-entry.
106
+ Only support SELF_HOSTED mode.
107
+ """
108
+ if current_app.config['EDITION'] != 'SELF_HOSTED':
109
+ click.echo(click.style('Sorry, only support SELF_HOSTED mode.', fg='red'))
110
+ return
111
+
112
+ tenants = db.session.query(Tenant).all()
113
+ for tenant in tenants:
114
+ if not tenant:
115
+ click.echo(click.style('Sorry, no workspace found. Please enter /install to initialize.', fg='red'))
116
+ return
117
+
118
+ tenant.encrypt_public_key = generate_key_pair(tenant.id)
119
+
120
+ db.session.query(Provider).filter(Provider.provider_type == 'custom', Provider.tenant_id == tenant.id).delete()
121
+ db.session.query(ProviderModel).filter(ProviderModel.tenant_id == tenant.id).delete()
122
+ db.session.commit()
123
+
124
+ click.echo(click.style('Congratulations! '
125
+ 'the asymmetric key pair of workspace {} has been reset.'.format(tenant.id), fg='green'))
126
+
127
+
128
+ @click.command('vdb-migrate', help='migrate vector db.')
129
+ @click.option('--scope', default='all', prompt=False, help='The scope of vector database to migrate, Default is All.')
130
+ def vdb_migrate(scope: str):
131
+ if scope in ['knowledge', 'all']:
132
+ migrate_knowledge_vector_database()
133
+ if scope in ['annotation', 'all']:
134
+ migrate_annotation_vector_database()
135
+
136
+
137
+ def migrate_annotation_vector_database():
138
+ """
139
+ Migrate annotation datas to target vector database .
140
+ """
141
+ click.echo(click.style('Start migrate annotation data.', fg='green'))
142
+ create_count = 0
143
+ skipped_count = 0
144
+ total_count = 0
145
+ page = 1
146
+ while True:
147
+ try:
148
+ # get apps info
149
+ apps = db.session.query(App).filter(
150
+ App.status == 'normal'
151
+ ).order_by(App.created_at.desc()).paginate(page=page, per_page=50)
152
+ except NotFound:
153
+ break
154
+
155
+ page += 1
156
+ for app in apps:
157
+ total_count = total_count + 1
158
+ click.echo(f'Processing the {total_count} app {app.id}. '
159
+ + f'{create_count} created, {skipped_count} skipped.')
160
+ try:
161
+ click.echo('Create app annotation index: {}'.format(app.id))
162
+ app_annotation_setting = db.session.query(AppAnnotationSetting).filter(
163
+ AppAnnotationSetting.app_id == app.id
164
+ ).first()
165
+
166
+ if not app_annotation_setting:
167
+ skipped_count = skipped_count + 1
168
+ click.echo('App annotation setting is disabled: {}'.format(app.id))
169
+ continue
170
+ # get dataset_collection_binding info
171
+ dataset_collection_binding = db.session.query(DatasetCollectionBinding).filter(
172
+ DatasetCollectionBinding.id == app_annotation_setting.collection_binding_id
173
+ ).first()
174
+ if not dataset_collection_binding:
175
+ click.echo('App annotation collection binding is not exist: {}'.format(app.id))
176
+ continue
177
+ annotations = db.session.query(MessageAnnotation).filter(MessageAnnotation.app_id == app.id).all()
178
+ dataset = Dataset(
179
+ id=app.id,
180
+ tenant_id=app.tenant_id,
181
+ indexing_technique='high_quality',
182
+ embedding_model_provider=dataset_collection_binding.provider_name,
183
+ embedding_model=dataset_collection_binding.model_name,
184
+ collection_binding_id=dataset_collection_binding.id
185
+ )
186
+ documents = []
187
+ if annotations:
188
+ for annotation in annotations:
189
+ document = Document(
190
+ page_content=annotation.question,
191
+ metadata={
192
+ "annotation_id": annotation.id,
193
+ "app_id": app.id,
194
+ "doc_id": annotation.id
195
+ }
196
+ )
197
+ documents.append(document)
198
+
199
+ vector = Vector(dataset, attributes=['doc_id', 'annotation_id', 'app_id'])
200
+ click.echo(f"Start to migrate annotation, app_id: {app.id}.")
201
+
202
+ try:
203
+ vector.delete()
204
+ click.echo(
205
+ click.style(f'Successfully delete vector index for app: {app.id}.',
206
+ fg='green'))
207
+ except Exception as e:
208
+ click.echo(
209
+ click.style(f'Failed to delete vector index for app {app.id}.',
210
+ fg='red'))
211
+ raise e
212
+ if documents:
213
+ try:
214
+ click.echo(click.style(
215
+ f'Start to created vector index with {len(documents)} annotations for app {app.id}.',
216
+ fg='green'))
217
+ vector.create(documents)
218
+ click.echo(
219
+ click.style(f'Successfully created vector index for app {app.id}.', fg='green'))
220
+ except Exception as e:
221
+ click.echo(click.style(f'Failed to created vector index for app {app.id}.', fg='red'))
222
+ raise e
223
+ click.echo(f'Successfully migrated app annotation {app.id}.')
224
+ create_count += 1
225
+ except Exception as e:
226
+ click.echo(
227
+ click.style('Create app annotation index error: {} {}'.format(e.__class__.__name__, str(e)),
228
+ fg='red'))
229
+ continue
230
+
231
+ click.echo(
232
+ click.style(f'Congratulations! Create {create_count} app annotation indexes, and skipped {skipped_count} apps.',
233
+ fg='green'))
234
+
235
+
236
+ def migrate_knowledge_vector_database():
237
+ """
238
+ Migrate vector database datas to target vector database .
239
+ """
240
+ click.echo(click.style('Start migrate vector db.', fg='green'))
241
+ create_count = 0
242
+ skipped_count = 0
243
+ total_count = 0
244
+ config = current_app.config
245
+ vector_type = config.get('VECTOR_STORE')
246
+ page = 1
247
+ while True:
248
+ try:
249
+ datasets = db.session.query(Dataset).filter(Dataset.indexing_technique == 'high_quality') \
250
+ .order_by(Dataset.created_at.desc()).paginate(page=page, per_page=50)
251
+ except NotFound:
252
+ break
253
+
254
+ page += 1
255
+ for dataset in datasets:
256
+ total_count = total_count + 1
257
+ click.echo(f'Processing the {total_count} dataset {dataset.id}. '
258
+ + f'{create_count} created, {skipped_count} skipped.')
259
+ try:
260
+ click.echo('Create dataset vdb index: {}'.format(dataset.id))
261
+ if dataset.index_struct_dict:
262
+ if dataset.index_struct_dict['type'] == vector_type:
263
+ skipped_count = skipped_count + 1
264
+ continue
265
+ collection_name = ''
266
+ if vector_type == "weaviate":
267
+ dataset_id = dataset.id
268
+ collection_name = Dataset.gen_collection_name_by_id(dataset_id)
269
+ index_struct_dict = {
270
+ "type": 'weaviate',
271
+ "vector_store": {"class_prefix": collection_name}
272
+ }
273
+ dataset.index_struct = json.dumps(index_struct_dict)
274
+ elif vector_type == "qdrant":
275
+ if dataset.collection_binding_id:
276
+ dataset_collection_binding = db.session.query(DatasetCollectionBinding). \
277
+ filter(DatasetCollectionBinding.id == dataset.collection_binding_id). \
278
+ one_or_none()
279
+ if dataset_collection_binding:
280
+ collection_name = dataset_collection_binding.collection_name
281
+ else:
282
+ raise ValueError('Dataset Collection Bindings is not exist!')
283
+ else:
284
+ dataset_id = dataset.id
285
+ collection_name = Dataset.gen_collection_name_by_id(dataset_id)
286
+ index_struct_dict = {
287
+ "type": 'qdrant',
288
+ "vector_store": {"class_prefix": collection_name}
289
+ }
290
+ dataset.index_struct = json.dumps(index_struct_dict)
291
+
292
+ elif vector_type == "milvus":
293
+ dataset_id = dataset.id
294
+ collection_name = Dataset.gen_collection_name_by_id(dataset_id)
295
+ index_struct_dict = {
296
+ "type": 'milvus',
297
+ "vector_store": {"class_prefix": collection_name}
298
+ }
299
+ dataset.index_struct = json.dumps(index_struct_dict)
300
+ elif vector_type == "relyt":
301
+ dataset_id = dataset.id
302
+ collection_name = Dataset.gen_collection_name_by_id(dataset_id)
303
+ index_struct_dict = {
304
+ "type": 'relyt',
305
+ "vector_store": {"class_prefix": collection_name}
306
+ }
307
+ dataset.index_struct = json.dumps(index_struct_dict)
308
+ elif vector_type == "pgvector":
309
+ dataset_id = dataset.id
310
+ collection_name = Dataset.gen_collection_name_by_id(dataset_id)
311
+ index_struct_dict = {
312
+ "type": 'pgvector',
313
+ "vector_store": {"class_prefix": collection_name}
314
+ }
315
+ dataset.index_struct = json.dumps(index_struct_dict)
316
+ else:
317
+ raise ValueError(f"Vector store {config.get('VECTOR_STORE')} is not supported.")
318
+
319
+ vector = Vector(dataset)
320
+ click.echo(f"Start to migrate dataset {dataset.id}.")
321
+
322
+ try:
323
+ vector.delete()
324
+ click.echo(
325
+ click.style(f'Successfully delete vector index {collection_name} for dataset {dataset.id}.',
326
+ fg='green'))
327
+ except Exception as e:
328
+ click.echo(
329
+ click.style(f'Failed to delete vector index {collection_name} for dataset {dataset.id}.',
330
+ fg='red'))
331
+ raise e
332
+
333
+ dataset_documents = db.session.query(DatasetDocument).filter(
334
+ DatasetDocument.dataset_id == dataset.id,
335
+ DatasetDocument.indexing_status == 'completed',
336
+ DatasetDocument.enabled == True,
337
+ DatasetDocument.archived == False,
338
+ ).all()
339
+
340
+ documents = []
341
+ segments_count = 0
342
+ for dataset_document in dataset_documents:
343
+ segments = db.session.query(DocumentSegment).filter(
344
+ DocumentSegment.document_id == dataset_document.id,
345
+ DocumentSegment.status == 'completed',
346
+ DocumentSegment.enabled == True
347
+ ).all()
348
+
349
+ for segment in segments:
350
+ document = Document(
351
+ page_content=segment.content,
352
+ metadata={
353
+ "doc_id": segment.index_node_id,
354
+ "doc_hash": segment.index_node_hash,
355
+ "document_id": segment.document_id,
356
+ "dataset_id": segment.dataset_id,
357
+ }
358
+ )
359
+
360
+ documents.append(document)
361
+ segments_count = segments_count + 1
362
+
363
+ if documents:
364
+ try:
365
+ click.echo(click.style(
366
+ f'Start to created vector index with {len(documents)} documents of {segments_count} segments for dataset {dataset.id}.',
367
+ fg='green'))
368
+ vector.create(documents)
369
+ click.echo(
370
+ click.style(f'Successfully created vector index for dataset {dataset.id}.', fg='green'))
371
+ except Exception as e:
372
+ click.echo(click.style(f'Failed to created vector index for dataset {dataset.id}.', fg='red'))
373
+ raise e
374
+ db.session.add(dataset)
375
+ db.session.commit()
376
+ click.echo(f'Successfully migrated dataset {dataset.id}.')
377
+ create_count += 1
378
+ except Exception as e:
379
+ db.session.rollback()
380
+ click.echo(
381
+ click.style('Create dataset index error: {} {}'.format(e.__class__.__name__, str(e)),
382
+ fg='red'))
383
+ continue
384
+
385
+ click.echo(
386
+ click.style(f'Congratulations! Create {create_count} dataset indexes, and skipped {skipped_count} datasets.',
387
+ fg='green'))
388
+
389
+
390
+ @click.command('convert-to-agent-apps', help='Convert Agent Assistant to Agent App.')
391
+ def convert_to_agent_apps():
392
+ """
393
+ Convert Agent Assistant to Agent App.
394
+ """
395
+ click.echo(click.style('Start convert to agent apps.', fg='green'))
396
+
397
+ proceeded_app_ids = []
398
+
399
+ while True:
400
+ # fetch first 1000 apps
401
+ sql_query = """SELECT a.id AS id FROM apps a
402
+ INNER JOIN app_model_configs am ON a.app_model_config_id=am.id
403
+ WHERE a.mode = 'chat'
404
+ AND am.agent_mode is not null
405
+ AND (
406
+ am.agent_mode like '%"strategy": "function_call"%'
407
+ OR am.agent_mode like '%"strategy": "react"%'
408
+ )
409
+ AND (
410
+ am.agent_mode like '{"enabled": true%'
411
+ OR am.agent_mode like '{"max_iteration": %'
412
+ ) ORDER BY a.created_at DESC LIMIT 1000
413
+ """
414
+
415
+ with db.engine.begin() as conn:
416
+ rs = conn.execute(db.text(sql_query))
417
+
418
+ apps = []
419
+ for i in rs:
420
+ app_id = str(i.id)
421
+ if app_id not in proceeded_app_ids:
422
+ proceeded_app_ids.append(app_id)
423
+ app = db.session.query(App).filter(App.id == app_id).first()
424
+ apps.append(app)
425
+
426
+ if len(apps) == 0:
427
+ break
428
+
429
+ for app in apps:
430
+ click.echo('Converting app: {}'.format(app.id))
431
+
432
+ try:
433
+ app.mode = AppMode.AGENT_CHAT.value
434
+ db.session.commit()
435
+
436
+ # update conversation mode to agent
437
+ db.session.query(Conversation).filter(Conversation.app_id == app.id).update(
438
+ {Conversation.mode: AppMode.AGENT_CHAT.value}
439
+ )
440
+
441
+ db.session.commit()
442
+ click.echo(click.style('Converted app: {}'.format(app.id), fg='green'))
443
+ except Exception as e:
444
+ click.echo(
445
+ click.style('Convert app error: {} {}'.format(e.__class__.__name__,
446
+ str(e)), fg='red'))
447
+
448
+ click.echo(click.style('Congratulations! Converted {} agent apps.'.format(len(proceeded_app_ids)), fg='green'))
449
+
450
+
451
+ @click.command('add-qdrant-doc-id-index', help='add qdrant doc_id index.')
452
+ @click.option('--field', default='metadata.doc_id', prompt=False, help='index field , default is metadata.doc_id.')
453
+ def add_qdrant_doc_id_index(field: str):
454
+ click.echo(click.style('Start add qdrant doc_id index.', fg='green'))
455
+ config = current_app.config
456
+ vector_type = config.get('VECTOR_STORE')
457
+ if vector_type != "qdrant":
458
+ click.echo(click.style('Sorry, only support qdrant vector store.', fg='red'))
459
+ return
460
+ create_count = 0
461
+
462
+ try:
463
+ bindings = db.session.query(DatasetCollectionBinding).all()
464
+ if not bindings:
465
+ click.echo(click.style('Sorry, no dataset collection bindings found.', fg='red'))
466
+ return
467
+ import qdrant_client
468
+ from qdrant_client.http.exceptions import UnexpectedResponse
469
+ from qdrant_client.http.models import PayloadSchemaType
470
+
471
+ from core.rag.datasource.vdb.qdrant.qdrant_vector import QdrantConfig
472
+ for binding in bindings:
473
+ qdrant_config = QdrantConfig(
474
+ endpoint=config.get('QDRANT_URL'),
475
+ api_key=config.get('QDRANT_API_KEY'),
476
+ root_path=current_app.root_path,
477
+ timeout=config.get('QDRANT_CLIENT_TIMEOUT'),
478
+ grpc_port=config.get('QDRANT_GRPC_PORT'),
479
+ prefer_grpc=config.get('QDRANT_GRPC_ENABLED')
480
+ )
481
+ try:
482
+ client = qdrant_client.QdrantClient(**qdrant_config.to_qdrant_params())
483
+ # create payload index
484
+ client.create_payload_index(binding.collection_name, field,
485
+ field_schema=PayloadSchemaType.KEYWORD)
486
+ create_count += 1
487
+ except UnexpectedResponse as e:
488
+ # Collection does not exist, so return
489
+ if e.status_code == 404:
490
+ click.echo(click.style(f'Collection not found, collection_name:{binding.collection_name}.', fg='red'))
491
+ continue
492
+ # Some other error occurred, so re-raise the exception
493
+ else:
494
+ click.echo(click.style(f'Failed to create qdrant index, collection_name:{binding.collection_name}.', fg='red'))
495
+
496
+ except Exception as e:
497
+ click.echo(click.style('Failed to create qdrant client.', fg='red'))
498
+
499
+ click.echo(
500
+ click.style(f'Congratulations! Create {create_count} collection indexes.',
501
+ fg='green'))
502
+
503
+
504
+ def register_commands(app):
505
+ app.cli.add_command(reset_password)
506
+ app.cli.add_command(reset_email)
507
+ app.cli.add_command(reset_encrypt_key_pair)
508
+ app.cli.add_command(vdb_migrate)
509
+ app.cli.add_command(convert_to_agent_apps)
510
+ app.cli.add_command(add_qdrant_doc_id_index)
511
+
api/config.py ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import dotenv
4
+
5
+ dotenv.load_dotenv()
6
+
7
+ DEFAULTS = {
8
+ 'EDITION': 'SELF_HOSTED',
9
+ 'DB_USERNAME': 'postgres',
10
+ 'DB_PASSWORD': '',
11
+ 'DB_HOST': 'localhost',
12
+ 'DB_PORT': '5432',
13
+ 'DB_DATABASE': 'dify',
14
+ 'DB_CHARSET': '',
15
+ 'REDIS_HOST': 'localhost',
16
+ 'REDIS_PORT': '6379',
17
+ 'REDIS_DB': '0',
18
+ 'REDIS_USE_SSL': 'False',
19
+ 'OAUTH_REDIRECT_PATH': '/console/api/oauth/authorize',
20
+ 'OAUTH_REDIRECT_INDEX_PATH': '/',
21
+ 'CONSOLE_WEB_URL': 'https://cloud.dify.ai',
22
+ 'CONSOLE_API_URL': 'https://cloud.dify.ai',
23
+ 'SERVICE_API_URL': 'https://api.dify.ai',
24
+ 'APP_WEB_URL': 'https://udify.app',
25
+ 'FILES_URL': '',
26
+ 'S3_ADDRESS_STYLE': 'auto',
27
+ 'STORAGE_TYPE': 'local',
28
+ 'STORAGE_LOCAL_PATH': 'storage',
29
+ 'CHECK_UPDATE_URL': 'https://updates.dify.ai',
30
+ 'DEPLOY_ENV': 'PRODUCTION',
31
+ 'SQLALCHEMY_DATABASE_URI_SCHEME': 'postgresql',
32
+ 'SQLALCHEMY_POOL_SIZE': 30,
33
+ 'SQLALCHEMY_MAX_OVERFLOW': 10,
34
+ 'SQLALCHEMY_POOL_RECYCLE': 3600,
35
+ 'SQLALCHEMY_POOL_PRE_PING': 'False',
36
+ 'SQLALCHEMY_ECHO': 'False',
37
+ 'SENTRY_TRACES_SAMPLE_RATE': 1.0,
38
+ 'SENTRY_PROFILES_SAMPLE_RATE': 1.0,
39
+ 'WEAVIATE_GRPC_ENABLED': 'True',
40
+ 'WEAVIATE_BATCH_SIZE': 100,
41
+ 'QDRANT_CLIENT_TIMEOUT': 20,
42
+ 'QDRANT_GRPC_ENABLED': 'False',
43
+ 'QDRANT_GRPC_PORT': '6334',
44
+ 'CELERY_BACKEND': 'database',
45
+ 'LOG_LEVEL': 'INFO',
46
+ 'LOG_FILE': '',
47
+ 'LOG_FORMAT': '%(asctime)s.%(msecs)03d %(levelname)s [%(threadName)s] [%(filename)s:%(lineno)d] - %(message)s',
48
+ 'LOG_DATEFORMAT': '%Y-%m-%d %H:%M:%S',
49
+ 'HOSTED_OPENAI_QUOTA_LIMIT': 200,
50
+ 'HOSTED_OPENAI_TRIAL_ENABLED': 'False',
51
+ 'HOSTED_OPENAI_TRIAL_MODELS': 'gpt-3.5-turbo,gpt-3.5-turbo-1106,gpt-3.5-turbo-instruct,gpt-3.5-turbo-16k,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-0613,gpt-3.5-turbo-0125,text-davinci-003',
52
+ 'HOSTED_OPENAI_PAID_ENABLED': 'False',
53
+ 'HOSTED_OPENAI_PAID_MODELS': 'gpt-4,gpt-4-turbo-preview,gpt-4-turbo-2024-04-09,gpt-4-1106-preview,gpt-4-0125-preview,gpt-3.5-turbo,gpt-3.5-turbo-16k,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-1106,gpt-3.5-turbo-0613,gpt-3.5-turbo-0125,gpt-3.5-turbo-instruct,text-davinci-003',
54
+ 'HOSTED_AZURE_OPENAI_ENABLED': 'False',
55
+ 'HOSTED_AZURE_OPENAI_QUOTA_LIMIT': 200,
56
+ 'HOSTED_ANTHROPIC_QUOTA_LIMIT': 600000,
57
+ 'HOSTED_ANTHROPIC_TRIAL_ENABLED': 'False',
58
+ 'HOSTED_ANTHROPIC_PAID_ENABLED': 'False',
59
+ 'HOSTED_MODERATION_ENABLED': 'False',
60
+ 'HOSTED_MODERATION_PROVIDERS': '',
61
+ 'HOSTED_FETCH_APP_TEMPLATES_MODE': 'remote',
62
+ 'HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN': 'https://tmpl.dify.ai',
63
+ 'CLEAN_DAY_SETTING': 30,
64
+ 'UPLOAD_FILE_SIZE_LIMIT': 15,
65
+ 'UPLOAD_FILE_BATCH_LIMIT': 5,
66
+ 'UPLOAD_IMAGE_FILE_SIZE_LIMIT': 10,
67
+ 'OUTPUT_MODERATION_BUFFER_SIZE': 300,
68
+ 'MULTIMODAL_SEND_IMAGE_FORMAT': 'base64',
69
+ 'INVITE_EXPIRY_HOURS': 72,
70
+ 'BILLING_ENABLED': 'False',
71
+ 'CAN_REPLACE_LOGO': 'False',
72
+ 'ETL_TYPE': 'dify',
73
+ 'KEYWORD_STORE': 'jieba',
74
+ 'BATCH_UPLOAD_LIMIT': 20,
75
+ 'CODE_EXECUTION_ENDPOINT': 'http://sandbox:8194',
76
+ 'CODE_EXECUTION_API_KEY': 'dify-sandbox',
77
+ 'TOOL_ICON_CACHE_MAX_AGE': 3600,
78
+ 'MILVUS_DATABASE': 'default',
79
+ 'KEYWORD_DATA_SOURCE_TYPE': 'database',
80
+ 'INNER_API': 'False',
81
+ 'ENTERPRISE_ENABLED': 'False',
82
+ 'INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH': 1000,
83
+ 'WORKFLOW_MAX_EXECUTION_STEPS': 50,
84
+ 'WORKFLOW_MAX_EXECUTION_TIME': 600,
85
+ }
86
+
87
+
88
+ def get_env(key):
89
+ return os.environ.get(key, DEFAULTS.get(key))
90
+
91
+
92
+ def get_bool_env(key):
93
+ value = get_env(key)
94
+ return value.lower() == 'true' if value is not None else False
95
+
96
+
97
+ def get_cors_allow_origins(env, default):
98
+ cors_allow_origins = []
99
+ if get_env(env):
100
+ for origin in get_env(env).split(','):
101
+ cors_allow_origins.append(origin)
102
+ else:
103
+ cors_allow_origins = [default]
104
+
105
+ return cors_allow_origins
106
+
107
+
108
+ class Config:
109
+ """Application configuration class."""
110
+
111
+ def __init__(self):
112
+ # ------------------------
113
+ # General Configurations.
114
+ # ------------------------
115
+ self.CURRENT_VERSION = "0.6.8"
116
+ self.COMMIT_SHA = get_env('COMMIT_SHA')
117
+ self.EDITION = get_env('EDITION')
118
+ self.DEPLOY_ENV = get_env('DEPLOY_ENV')
119
+ self.TESTING = False
120
+ self.LOG_LEVEL = get_env('LOG_LEVEL')
121
+ self.LOG_FILE = get_env('LOG_FILE')
122
+ self.LOG_FORMAT = get_env('LOG_FORMAT')
123
+ self.LOG_DATEFORMAT = get_env('LOG_DATEFORMAT')
124
+
125
+ # The backend URL prefix of the console API.
126
+ # used to concatenate the login authorization callback or notion integration callback.
127
+ self.CONSOLE_API_URL = get_env('CONSOLE_API_URL')
128
+
129
+ # The front-end URL prefix of the console web.
130
+ # used to concatenate some front-end addresses and for CORS configuration use.
131
+ self.CONSOLE_WEB_URL = get_env('CONSOLE_WEB_URL')
132
+
133
+ # WebApp Url prefix.
134
+ # used to display WebAPP API Base Url to the front-end.
135
+ self.APP_WEB_URL = get_env('APP_WEB_URL')
136
+
137
+ # Service API Url prefix.
138
+ # used to display Service API Base Url to the front-end.
139
+ self.SERVICE_API_URL = get_env('SERVICE_API_URL')
140
+
141
+ # File preview or download Url prefix.
142
+ # used to display File preview or download Url to the front-end or as Multi-model inputs;
143
+ # Url is signed and has expiration time.
144
+ self.FILES_URL = get_env('FILES_URL') if get_env('FILES_URL') else self.CONSOLE_API_URL
145
+
146
+ # Your App secret key will be used for securely signing the session cookie
147
+ # Make sure you are changing this key for your deployment with a strong key.
148
+ # You can generate a strong key using `openssl rand -base64 42`.
149
+ # Alternatively you can set it with `SECRET_KEY` environment variable.
150
+ self.SECRET_KEY = get_env('SECRET_KEY')
151
+
152
+ # Enable or disable the inner API.
153
+ self.INNER_API = get_bool_env('INNER_API')
154
+ # The inner API key is used to authenticate the inner API.
155
+ self.INNER_API_KEY = get_env('INNER_API_KEY')
156
+
157
+ # cors settings
158
+ self.CONSOLE_CORS_ALLOW_ORIGINS = get_cors_allow_origins(
159
+ 'CONSOLE_CORS_ALLOW_ORIGINS', self.CONSOLE_WEB_URL)
160
+ self.WEB_API_CORS_ALLOW_ORIGINS = get_cors_allow_origins(
161
+ 'WEB_API_CORS_ALLOW_ORIGINS', '*')
162
+
163
+ # check update url
164
+ self.CHECK_UPDATE_URL = get_env('CHECK_UPDATE_URL')
165
+
166
+ # ------------------------
167
+ # Database Configurations.
168
+ # ------------------------
169
+ db_credentials = {
170
+ key: get_env(key) for key in
171
+ ['DB_USERNAME', 'DB_PASSWORD', 'DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_CHARSET']
172
+ }
173
+ self.SQLALCHEMY_DATABASE_URI_SCHEME = get_env('SQLALCHEMY_DATABASE_URI_SCHEME')
174
+
175
+ db_extras = f"?client_encoding={db_credentials['DB_CHARSET']}" if db_credentials['DB_CHARSET'] else ""
176
+
177
+ self.SQLALCHEMY_DATABASE_URI = f"{self.SQLALCHEMY_DATABASE_URI_SCHEME}://{db_credentials['DB_USERNAME']}:{db_credentials['DB_PASSWORD']}@{db_credentials['DB_HOST']}:{db_credentials['DB_PORT']}/{db_credentials['DB_DATABASE']}{db_extras}"
178
+ self.SQLALCHEMY_ENGINE_OPTIONS = {
179
+ 'pool_size': int(get_env('SQLALCHEMY_POOL_SIZE')),
180
+ 'max_overflow': int(get_env('SQLALCHEMY_MAX_OVERFLOW')),
181
+ 'pool_recycle': int(get_env('SQLALCHEMY_POOL_RECYCLE')),
182
+ 'pool_pre_ping': get_bool_env('SQLALCHEMY_POOL_PRE_PING'),
183
+ 'connect_args': {'options': '-c timezone=UTC'},
184
+ }
185
+
186
+ self.SQLALCHEMY_ECHO = get_bool_env('SQLALCHEMY_ECHO')
187
+
188
+ # ------------------------
189
+ # Redis Configurations.
190
+ # ------------------------
191
+ self.REDIS_HOST = get_env('REDIS_HOST')
192
+ self.REDIS_PORT = get_env('REDIS_PORT')
193
+ self.REDIS_USERNAME = get_env('REDIS_USERNAME')
194
+ self.REDIS_PASSWORD = get_env('REDIS_PASSWORD')
195
+ self.REDIS_DB = get_env('REDIS_DB')
196
+ self.REDIS_USE_SSL = get_bool_env('REDIS_USE_SSL')
197
+
198
+ # ------------------------
199
+ # Celery worker Configurations.
200
+ # ------------------------
201
+ self.CELERY_BROKER_URL = get_env('CELERY_BROKER_URL')
202
+ self.CELERY_BACKEND = get_env('CELERY_BACKEND')
203
+ self.CELERY_RESULT_BACKEND = 'db+{}'.format(self.SQLALCHEMY_DATABASE_URI) \
204
+ if self.CELERY_BACKEND == 'database' else self.CELERY_BROKER_URL
205
+ self.BROKER_USE_SSL = self.CELERY_BROKER_URL.startswith('rediss://')
206
+
207
+ # ------------------------
208
+ # File Storage Configurations.
209
+ # ------------------------
210
+ self.STORAGE_TYPE = get_env('STORAGE_TYPE')
211
+ self.STORAGE_LOCAL_PATH = get_env('STORAGE_LOCAL_PATH')
212
+ self.S3_ENDPOINT = get_env('S3_ENDPOINT')
213
+ self.S3_BUCKET_NAME = get_env('S3_BUCKET_NAME')
214
+ self.S3_ACCESS_KEY = get_env('S3_ACCESS_KEY')
215
+ self.S3_SECRET_KEY = get_env('S3_SECRET_KEY')
216
+ self.S3_REGION = get_env('S3_REGION')
217
+ self.S3_ADDRESS_STYLE = get_env('S3_ADDRESS_STYLE')
218
+ self.AZURE_BLOB_ACCOUNT_NAME = get_env('AZURE_BLOB_ACCOUNT_NAME')
219
+ self.AZURE_BLOB_ACCOUNT_KEY = get_env('AZURE_BLOB_ACCOUNT_KEY')
220
+ self.AZURE_BLOB_CONTAINER_NAME = get_env('AZURE_BLOB_CONTAINER_NAME')
221
+ self.AZURE_BLOB_ACCOUNT_URL = get_env('AZURE_BLOB_ACCOUNT_URL')
222
+ self.ALIYUN_OSS_BUCKET_NAME = get_env('ALIYUN_OSS_BUCKET_NAME')
223
+ self.ALIYUN_OSS_ACCESS_KEY = get_env('ALIYUN_OSS_ACCESS_KEY')
224
+ self.ALIYUN_OSS_SECRET_KEY = get_env('ALIYUN_OSS_SECRET_KEY')
225
+ self.ALIYUN_OSS_ENDPOINT = get_env('ALIYUN_OSS_ENDPOINT')
226
+ self.ALIYUN_OSS_REGION = get_env('ALIYUN_OSS_REGION')
227
+ self.ALIYUN_OSS_AUTH_VERSION = get_env('ALIYUN_OSS_AUTH_VERSION')
228
+ self.GOOGLE_STORAGE_BUCKET_NAME = get_env('GOOGLE_STORAGE_BUCKET_NAME')
229
+ self.GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64 = get_env('GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64')
230
+
231
+ # ------------------------
232
+ # Vector Store Configurations.
233
+ # Currently, only support: qdrant, milvus, zilliz, weaviate, relyt, pgvector
234
+ # ------------------------
235
+ self.VECTOR_STORE = get_env('VECTOR_STORE')
236
+ self.KEYWORD_STORE = get_env('KEYWORD_STORE')
237
+ # qdrant settings
238
+ self.QDRANT_URL = get_env('QDRANT_URL')
239
+ self.QDRANT_API_KEY = get_env('QDRANT_API_KEY')
240
+ self.QDRANT_CLIENT_TIMEOUT = get_env('QDRANT_CLIENT_TIMEOUT')
241
+ self.QDRANT_GRPC_ENABLED = get_env('QDRANT_GRPC_ENABLED')
242
+ self.QDRANT_GRPC_PORT = get_env('QDRANT_GRPC_PORT')
243
+
244
+ # milvus / zilliz setting
245
+ self.MILVUS_HOST = get_env('MILVUS_HOST')
246
+ self.MILVUS_PORT = get_env('MILVUS_PORT')
247
+ self.MILVUS_USER = get_env('MILVUS_USER')
248
+ self.MILVUS_PASSWORD = get_env('MILVUS_PASSWORD')
249
+ self.MILVUS_SECURE = get_env('MILVUS_SECURE')
250
+ self.MILVUS_DATABASE = get_env('MILVUS_DATABASE')
251
+
252
+ # weaviate settings
253
+ self.WEAVIATE_ENDPOINT = get_env('WEAVIATE_ENDPOINT')
254
+ self.WEAVIATE_API_KEY = get_env('WEAVIATE_API_KEY')
255
+ self.WEAVIATE_GRPC_ENABLED = get_bool_env('WEAVIATE_GRPC_ENABLED')
256
+ self.WEAVIATE_BATCH_SIZE = int(get_env('WEAVIATE_BATCH_SIZE'))
257
+
258
+ # relyt settings
259
+ self.RELYT_HOST = get_env('RELYT_HOST')
260
+ self.RELYT_PORT = get_env('RELYT_PORT')
261
+ self.RELYT_USER = get_env('RELYT_USER')
262
+ self.RELYT_PASSWORD = get_env('RELYT_PASSWORD')
263
+ self.RELYT_DATABASE = get_env('RELYT_DATABASE')
264
+
265
+ # pgvecto rs settings
266
+ self.PGVECTO_RS_HOST = get_env('PGVECTO_RS_HOST')
267
+ self.PGVECTO_RS_PORT = get_env('PGVECTO_RS_PORT')
268
+ self.PGVECTO_RS_USER = get_env('PGVECTO_RS_USER')
269
+ self.PGVECTO_RS_PASSWORD = get_env('PGVECTO_RS_PASSWORD')
270
+ self.PGVECTO_RS_DATABASE = get_env('PGVECTO_RS_DATABASE')
271
+
272
+ # pgvector settings
273
+ self.PGVECTOR_HOST = get_env('PGVECTOR_HOST')
274
+ self.PGVECTOR_PORT = get_env('PGVECTOR_PORT')
275
+ self.PGVECTOR_USER = get_env('PGVECTOR_USER')
276
+ self.PGVECTOR_PASSWORD = get_env('PGVECTOR_PASSWORD')
277
+ self.PGVECTOR_DATABASE = get_env('PGVECTOR_DATABASE')
278
+
279
+ # ------------------------
280
+ # Mail Configurations.
281
+ # ------------------------
282
+ self.MAIL_TYPE = get_env('MAIL_TYPE')
283
+ self.MAIL_DEFAULT_SEND_FROM = get_env('MAIL_DEFAULT_SEND_FROM')
284
+ self.RESEND_API_KEY = get_env('RESEND_API_KEY')
285
+ self.RESEND_API_URL = get_env('RESEND_API_URL')
286
+ # SMTP settings
287
+ self.SMTP_SERVER = get_env('SMTP_SERVER')
288
+ self.SMTP_PORT = get_env('SMTP_PORT')
289
+ self.SMTP_USERNAME = get_env('SMTP_USERNAME')
290
+ self.SMTP_PASSWORD = get_env('SMTP_PASSWORD')
291
+ self.SMTP_USE_TLS = get_bool_env('SMTP_USE_TLS')
292
+
293
+ # ------------------------
294
+ # Workspace Configurations.
295
+ # ------------------------
296
+ self.INVITE_EXPIRY_HOURS = int(get_env('INVITE_EXPIRY_HOURS'))
297
+
298
+ # ------------------------
299
+ # Sentry Configurations.
300
+ # ------------------------
301
+ self.SENTRY_DSN = get_env('SENTRY_DSN')
302
+ self.SENTRY_TRACES_SAMPLE_RATE = float(get_env('SENTRY_TRACES_SAMPLE_RATE'))
303
+ self.SENTRY_PROFILES_SAMPLE_RATE = float(get_env('SENTRY_PROFILES_SAMPLE_RATE'))
304
+
305
+ # ------------------------
306
+ # Business Configurations.
307
+ # ------------------------
308
+
309
+ # multi model send image format, support base64, url, default is base64
310
+ self.MULTIMODAL_SEND_IMAGE_FORMAT = get_env('MULTIMODAL_SEND_IMAGE_FORMAT')
311
+
312
+ # Dataset Configurations.
313
+ self.CLEAN_DAY_SETTING = get_env('CLEAN_DAY_SETTING')
314
+
315
+ # File upload Configurations.
316
+ self.UPLOAD_FILE_SIZE_LIMIT = int(get_env('UPLOAD_FILE_SIZE_LIMIT'))
317
+ self.UPLOAD_FILE_BATCH_LIMIT = int(get_env('UPLOAD_FILE_BATCH_LIMIT'))
318
+ self.UPLOAD_IMAGE_FILE_SIZE_LIMIT = int(get_env('UPLOAD_IMAGE_FILE_SIZE_LIMIT'))
319
+
320
+ self.WORKFLOW_MAX_EXECUTION_STEPS = int(get_env('WORKFLOW_MAX_EXECUTION_STEPS'))
321
+ self.WORKFLOW_MAX_EXECUTION_TIME = int(get_env('WORKFLOW_MAX_EXECUTION_TIME'))
322
+
323
+ # Moderation in app Configurations.
324
+ self.OUTPUT_MODERATION_BUFFER_SIZE = int(get_env('OUTPUT_MODERATION_BUFFER_SIZE'))
325
+
326
+ # Notion integration setting
327
+ self.NOTION_CLIENT_ID = get_env('NOTION_CLIENT_ID')
328
+ self.NOTION_CLIENT_SECRET = get_env('NOTION_CLIENT_SECRET')
329
+ self.NOTION_INTEGRATION_TYPE = get_env('NOTION_INTEGRATION_TYPE')
330
+ self.NOTION_INTERNAL_SECRET = get_env('NOTION_INTERNAL_SECRET')
331
+ self.NOTION_INTEGRATION_TOKEN = get_env('NOTION_INTEGRATION_TOKEN')
332
+
333
+ # ------------------------
334
+ # Platform Configurations.
335
+ # ------------------------
336
+ self.GITHUB_CLIENT_ID = get_env('GITHUB_CLIENT_ID')
337
+ self.GITHUB_CLIENT_SECRET = get_env('GITHUB_CLIENT_SECRET')
338
+ self.GOOGLE_CLIENT_ID = get_env('GOOGLE_CLIENT_ID')
339
+ self.GOOGLE_CLIENT_SECRET = get_env('GOOGLE_CLIENT_SECRET')
340
+ self.OAUTH_REDIRECT_PATH = get_env('OAUTH_REDIRECT_PATH')
341
+
342
+ self.HOSTED_OPENAI_API_KEY = get_env('HOSTED_OPENAI_API_KEY')
343
+ self.HOSTED_OPENAI_API_BASE = get_env('HOSTED_OPENAI_API_BASE')
344
+ self.HOSTED_OPENAI_API_ORGANIZATION = get_env('HOSTED_OPENAI_API_ORGANIZATION')
345
+ self.HOSTED_OPENAI_TRIAL_ENABLED = get_bool_env('HOSTED_OPENAI_TRIAL_ENABLED')
346
+ self.HOSTED_OPENAI_TRIAL_MODELS = get_env('HOSTED_OPENAI_TRIAL_MODELS')
347
+ self.HOSTED_OPENAI_QUOTA_LIMIT = int(get_env('HOSTED_OPENAI_QUOTA_LIMIT'))
348
+ self.HOSTED_OPENAI_PAID_ENABLED = get_bool_env('HOSTED_OPENAI_PAID_ENABLED')
349
+ self.HOSTED_OPENAI_PAID_MODELS = get_env('HOSTED_OPENAI_PAID_MODELS')
350
+
351
+ self.HOSTED_AZURE_OPENAI_ENABLED = get_bool_env('HOSTED_AZURE_OPENAI_ENABLED')
352
+ self.HOSTED_AZURE_OPENAI_API_KEY = get_env('HOSTED_AZURE_OPENAI_API_KEY')
353
+ self.HOSTED_AZURE_OPENAI_API_BASE = get_env('HOSTED_AZURE_OPENAI_API_BASE')
354
+ self.HOSTED_AZURE_OPENAI_QUOTA_LIMIT = int(get_env('HOSTED_AZURE_OPENAI_QUOTA_LIMIT'))
355
+
356
+ self.HOSTED_ANTHROPIC_API_BASE = get_env('HOSTED_ANTHROPIC_API_BASE')
357
+ self.HOSTED_ANTHROPIC_API_KEY = get_env('HOSTED_ANTHROPIC_API_KEY')
358
+ self.HOSTED_ANTHROPIC_TRIAL_ENABLED = get_bool_env('HOSTED_ANTHROPIC_TRIAL_ENABLED')
359
+ self.HOSTED_ANTHROPIC_QUOTA_LIMIT = int(get_env('HOSTED_ANTHROPIC_QUOTA_LIMIT'))
360
+ self.HOSTED_ANTHROPIC_PAID_ENABLED = get_bool_env('HOSTED_ANTHROPIC_PAID_ENABLED')
361
+
362
+ self.HOSTED_MINIMAX_ENABLED = get_bool_env('HOSTED_MINIMAX_ENABLED')
363
+ self.HOSTED_SPARK_ENABLED = get_bool_env('HOSTED_SPARK_ENABLED')
364
+ self.HOSTED_ZHIPUAI_ENABLED = get_bool_env('HOSTED_ZHIPUAI_ENABLED')
365
+
366
+ self.HOSTED_MODERATION_ENABLED = get_bool_env('HOSTED_MODERATION_ENABLED')
367
+ self.HOSTED_MODERATION_PROVIDERS = get_env('HOSTED_MODERATION_PROVIDERS')
368
+
369
+ # fetch app templates mode, remote, builtin, db(only for dify SaaS), default: remote
370
+ self.HOSTED_FETCH_APP_TEMPLATES_MODE = get_env('HOSTED_FETCH_APP_TEMPLATES_MODE')
371
+ self.HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN = get_env('HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN')
372
+
373
+ self.ETL_TYPE = get_env('ETL_TYPE')
374
+ self.UNSTRUCTURED_API_URL = get_env('UNSTRUCTURED_API_URL')
375
+ self.UNSTRUCTURED_API_KEY = get_env('UNSTRUCTURED_API_KEY')
376
+ self.BILLING_ENABLED = get_bool_env('BILLING_ENABLED')
377
+ self.CAN_REPLACE_LOGO = get_bool_env('CAN_REPLACE_LOGO')
378
+
379
+ self.BATCH_UPLOAD_LIMIT = get_env('BATCH_UPLOAD_LIMIT')
380
+
381
+ self.CODE_EXECUTION_ENDPOINT = get_env('CODE_EXECUTION_ENDPOINT')
382
+ self.CODE_EXECUTION_API_KEY = get_env('CODE_EXECUTION_API_KEY')
383
+
384
+ self.API_COMPRESSION_ENABLED = get_bool_env('API_COMPRESSION_ENABLED')
385
+ self.TOOL_ICON_CACHE_MAX_AGE = get_env('TOOL_ICON_CACHE_MAX_AGE')
386
+
387
+ self.KEYWORD_DATA_SOURCE_TYPE = get_env('KEYWORD_DATA_SOURCE_TYPE')
388
+ self.ENTERPRISE_ENABLED = get_bool_env('ENTERPRISE_ENABLED')
389
+
390
+ # ------------------------
391
+ # Indexing Configurations.
392
+ # ------------------------
393
+ self.INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH = get_env('INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH')
api/constants/__init__.py ADDED
File without changes
api/constants/languages.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ languages = ['en-US', 'zh-Hans', 'zh-Hant', 'pt-BR', 'es-ES', 'fr-FR', 'de-DE', 'ja-JP', 'ko-KR', 'ru-RU', 'it-IT', 'uk-UA', 'vi-VN', 'pl-PL']
4
+
5
+ language_timezone_mapping = {
6
+ 'en-US': 'America/New_York',
7
+ 'zh-Hans': 'Asia/Shanghai',
8
+ 'zh-Hant': 'Asia/Taipei',
9
+ 'pt-BR': 'America/Sao_Paulo',
10
+ 'es-ES': 'Europe/Madrid',
11
+ 'fr-FR': 'Europe/Paris',
12
+ 'de-DE': 'Europe/Berlin',
13
+ 'ja-JP': 'Asia/Tokyo',
14
+ 'ko-KR': 'Asia/Seoul',
15
+ 'ru-RU': 'Europe/Moscow',
16
+ 'it-IT': 'Europe/Rome',
17
+ 'uk-UA': 'Europe/Kyiv',
18
+ 'vi-VN': 'Asia/Ho_Chi_Minh',
19
+ 'ro-RO': 'Europe/Bucharest',
20
+ 'pl-PL': 'Europe/Warsaw',
21
+ }
22
+
23
+
24
+ def supported_language(lang):
25
+ if lang in languages:
26
+ return lang
27
+
28
+ error = ('{lang} is not a valid language.'
29
+ .format(lang=lang))
30
+ raise ValueError(error)
api/constants/model_template.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ from models.model import AppMode
4
+
5
+ default_app_templates = {
6
+ # workflow default mode
7
+ AppMode.WORKFLOW: {
8
+ 'app': {
9
+ 'mode': AppMode.WORKFLOW.value,
10
+ 'enable_site': True,
11
+ 'enable_api': True
12
+ }
13
+ },
14
+
15
+ # completion default mode
16
+ AppMode.COMPLETION: {
17
+ 'app': {
18
+ 'mode': AppMode.COMPLETION.value,
19
+ 'enable_site': True,
20
+ 'enable_api': True
21
+ },
22
+ 'model_config': {
23
+ 'model': {
24
+ "provider": "openai",
25
+ "name": "gpt-4",
26
+ "mode": "chat",
27
+ "completion_params": {}
28
+ },
29
+ 'user_input_form': json.dumps([
30
+ {
31
+ "paragraph": {
32
+ "label": "Query",
33
+ "variable": "query",
34
+ "required": True,
35
+ "default": ""
36
+ }
37
+ }
38
+ ]),
39
+ 'pre_prompt': '{{query}}'
40
+ },
41
+
42
+ },
43
+
44
+ # chat default mode
45
+ AppMode.CHAT: {
46
+ 'app': {
47
+ 'mode': AppMode.CHAT.value,
48
+ 'enable_site': True,
49
+ 'enable_api': True
50
+ },
51
+ 'model_config': {
52
+ 'model': {
53
+ "provider": "openai",
54
+ "name": "gpt-4",
55
+ "mode": "chat",
56
+ "completion_params": {}
57
+ }
58
+ }
59
+ },
60
+
61
+ # advanced-chat default mode
62
+ AppMode.ADVANCED_CHAT: {
63
+ 'app': {
64
+ 'mode': AppMode.ADVANCED_CHAT.value,
65
+ 'enable_site': True,
66
+ 'enable_api': True
67
+ }
68
+ },
69
+
70
+ # agent-chat default mode
71
+ AppMode.AGENT_CHAT: {
72
+ 'app': {
73
+ 'mode': AppMode.AGENT_CHAT.value,
74
+ 'enable_site': True,
75
+ 'enable_api': True
76
+ },
77
+ 'model_config': {
78
+ 'model': {
79
+ "provider": "openai",
80
+ "name": "gpt-4",
81
+ "mode": "chat",
82
+ "completion_params": {}
83
+ }
84
+ }
85
+ }
86
+ }
api/constants/recommended_apps.json ADDED
The diff for this file is too large to render. See raw diff