diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh
index e80f9d30aadc02..d879876d8adadc 100755
--- a/.devcontainer/post_create_command.sh
+++ b/.devcontainer/post_create_command.sh
@@ -1,11 +1,12 @@
#!/bin/bash
-cd web && npm install
+npm add -g pnpm@9.12.2
+cd web && pnpm install
pipx install poetry
echo 'alias start-api="cd /workspaces/dify/api && poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug"' >> ~/.bashrc
echo 'alias start-worker="cd /workspaces/dify/api && poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion"' >> ~/.bashrc
-echo 'alias start-web="cd /workspaces/dify/web && npm run dev"' >> ~/.bashrc
+echo 'alias start-web="cd /workspaces/dify/web && pnpm dev"' >> ~/.bashrc
echo 'alias start-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify up -d"' >> ~/.bashrc
echo 'alias stop-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify down"' >> ~/.bashrc
diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml
index 98075c97cd19fd..b9547b645260d0 100644
--- a/.github/workflows/api-tests.yml
+++ b/.github/workflows/api-tests.yml
@@ -26,6 +26,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Setup Poetry and Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-poetry
@@ -47,15 +50,9 @@ jobs:
- name: Run Unit tests
run: poetry run -P api bash dev/pytest/pytest_unit_tests.sh
- - name: Run ModelRuntime
- run: poetry run -P api bash dev/pytest/pytest_model_runtime.sh
-
- name: Run dify config tests
run: poetry run -P api python dev/pytest/pytest_config_tests.py
- - name: Run Tool
- run: poetry run -P api bash dev/pytest/pytest_tools.sh
-
- name: Run mypy
run: |
poetry run -C api python -m mypy --install-types --non-interactive .
diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml
index 8e5279fb67659b..49ab983778253d 100644
--- a/.github/workflows/build-push.yml
+++ b/.github/workflows/build-push.yml
@@ -79,10 +79,12 @@ jobs:
cache-to: type=gha,mode=max,scope=${{ matrix.service_name }}
- name: Export digest
+ env:
+ DIGEST: ${{ steps.build.outputs.digest }}
run: |
mkdir -p /tmp/digests
- digest="${{ steps.build.outputs.digest }}"
- touch "/tmp/digests/${digest#sha256:}"
+ sanitized_digest=${DIGEST#sha256:}
+ touch "/tmp/digests/${sanitized_digest}"
- name: Upload digest
uses: actions/upload-artifact@v4
@@ -132,10 +134,15 @@ jobs:
- name: Create manifest list and push
working-directory: /tmp/digests
+ env:
+ IMAGE_NAME: ${{ env[matrix.image_name_env] }}
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
- $(printf '${{ env[matrix.image_name_env] }}@sha256:%s ' *)
+ $(printf "$IMAGE_NAME@sha256:%s " *)
- name: Inspect image
+ env:
+ IMAGE_NAME: ${{ env[matrix.image_name_env] }}
+ IMAGE_VERSION: ${{ steps.meta.outputs.version }}
run: |
- docker buildx imagetools inspect ${{ env[matrix.image_name_env] }}:${{ steps.meta.outputs.version }}
+ docker buildx imagetools inspect "$IMAGE_NAME:$IMAGE_VERSION"
diff --git a/.github/workflows/db-migration-test.yml b/.github/workflows/db-migration-test.yml
index 3d881c4c3dd7ca..69bff839a6f1a7 100644
--- a/.github/workflows/db-migration-test.yml
+++ b/.github/workflows/db-migration-test.yml
@@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
+ - plugins/beta
paths:
- api/migrations/**
- .github/workflows/db-migration-test.yml
@@ -19,6 +20,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Setup Poetry and Python
uses: ./.github/actions/setup-poetry
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml
new file mode 100644
index 00000000000000..cf7e77b4b829ea
--- /dev/null
+++ b/.github/workflows/docker-build.yml
@@ -0,0 +1,47 @@
+name: Build docker image
+
+on:
+ pull_request:
+ branches:
+ - "main"
+ paths:
+ - api/Dockerfile
+ - web/Dockerfile
+
+concurrency:
+ group: docker-build-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ build-docker:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ include:
+ - service_name: "api-amd64"
+ platform: linux/amd64
+ context: "api"
+ - service_name: "api-arm64"
+ platform: linux/arm64
+ context: "api"
+ - service_name: "web-amd64"
+ platform: linux/amd64
+ context: "web"
+ - service_name: "web-arm64"
+ platform: linux/arm64
+ context: "web"
+ steps:
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Build Docker Image
+ uses: docker/build-push-action@v6
+ with:
+ push: false
+ context: "{{defaultContext}}:${{ matrix.context }}"
+ platforms: ${{ matrix.platform }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/.github/workflows/expose_service_ports.sh b/.github/workflows/expose_service_ports.sh
index d3146cd90dc02b..16f24439e6e826 100755
--- a/.github/workflows/expose_service_ports.sh
+++ b/.github/workflows/expose_service_ports.sh
@@ -9,6 +9,6 @@ yq eval '.services["pgvecto-rs"].ports += ["5431:5432"]' -i docker/docker-compos
yq eval '.services["elasticsearch"].ports += ["9200:9200"]' -i docker/docker-compose.yaml
yq eval '.services.couchbase-server.ports += ["8091-8096:8091-8096"]' -i docker/docker-compose.yaml
yq eval '.services.couchbase-server.ports += ["11210:11210"]' -i docker/docker-compose.yaml
-yq eval '.services.tidb.ports += ["4000:4000"]' -i docker/docker-compose.yaml
+yq eval '.services.tidb.ports += ["4000:4000"]' -i docker/tidb/docker-compose.yaml
echo "Ports exposed for sandbox, weaviate, tidb, qdrant, chroma, milvus, pgvector, pgvecto-rs, elasticsearch, couchbase"
diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml
index c80037195a4c97..d73a782c935f80 100644
--- a/.github/workflows/style.yml
+++ b/.github/workflows/style.yml
@@ -17,6 +17,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Check changed files
id: changed-files
@@ -59,6 +62,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Check changed files
id: changed-files
@@ -66,21 +72,27 @@ jobs:
with:
files: web/**
+ - name: Install pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ version: 10
+ run_install: false
+
- name: Setup NodeJS
uses: actions/setup-node@v4
if: steps.changed-files.outputs.any_changed == 'true'
with:
node-version: 20
- cache: yarn
+ cache: pnpm
cache-dependency-path: ./web/package.json
- name: Web dependencies
if: steps.changed-files.outputs.any_changed == 'true'
- run: yarn install --frozen-lockfile
+ run: pnpm install --frozen-lockfile
- name: Web style check
if: steps.changed-files.outputs.any_changed == 'true'
- run: yarn run lint
+ run: pnpm run lint
docker-compose-template:
name: Docker Compose Template
@@ -89,6 +101,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Check changed files
id: changed-files
@@ -117,6 +132,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Check changed files
id: changed-files
diff --git a/.github/workflows/tool-test-sdks.yaml b/.github/workflows/tool-test-sdks.yaml
index fb4bcb9d66fa08..93edb2737a7d3a 100644
--- a/.github/workflows/tool-test-sdks.yaml
+++ b/.github/workflows/tool-test-sdks.yaml
@@ -26,16 +26,19 @@ jobs:
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: ''
- cache-dependency-path: 'yarn.lock'
+ cache-dependency-path: 'pnpm-lock.yaml'
- name: Install Dependencies
- run: yarn install
+ run: pnpm install --frozen-lockfile
- name: Test
- run: yarn test
+ run: pnpm test
diff --git a/.github/workflows/translate-i18n-base-on-english.yml b/.github/workflows/translate-i18n-base-on-english.yml
index 3f51b3b2c79946..80b78a13119bcf 100644
--- a/.github/workflows/translate-i18n-base-on-english.yml
+++ b/.github/workflows/translate-i18n-base-on-english.yml
@@ -16,6 +16,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # last 2 commits
+ persist-credentials: false
- name: Check for file changes in i18n/en-US
id: check_files
@@ -38,11 +39,11 @@ jobs:
- name: Install dependencies
if: env.FILES_CHANGED == 'true'
- run: yarn install --frozen-lockfile
+ run: pnpm install --frozen-lockfile
- name: Run npm script
if: env.FILES_CHANGED == 'true'
- run: npm run auto-gen-i18n
+ run: pnpm run auto-gen-i18n
- name: Create Pull Request
if: env.FILES_CHANGED == 'true'
diff --git a/.github/workflows/vdb-tests.yml b/.github/workflows/vdb-tests.yml
index fab0b8c426a94e..5e3f7a557aa6db 100644
--- a/.github/workflows/vdb-tests.yml
+++ b/.github/workflows/vdb-tests.yml
@@ -28,6 +28,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Setup Poetry and Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-poetry
@@ -51,7 +54,15 @@ jobs:
- name: Expose Service Ports
run: sh .github/workflows/expose_service_ports.sh
- - name: Set up Vector Stores (TiDB, Weaviate, Qdrant, PGVector, Milvus, PgVecto-RS, Chroma, MyScale, ElasticSearch, Couchbase)
+ - name: Set up Vector Store (TiDB)
+ uses: hoverkraft-tech/compose-action@v2.0.2
+ with:
+ compose-file: docker/tidb/docker-compose.yaml
+ services: |
+ tidb
+ tiflash
+
+ - name: Set up Vector Stores (Weaviate, Qdrant, PGVector, Milvus, PgVecto-RS, Chroma, MyScale, ElasticSearch, Couchbase)
uses: hoverkraft-tech/compose-action@v2.0.2
with:
compose-file: |
@@ -67,7 +78,9 @@ jobs:
pgvector
chroma
elasticsearch
- tidb
+
+ - name: Check TiDB Ready
+ run: poetry run -P api python api/tests/integration_tests/vdb/tidb_vector/check_tiflash_ready.py
- name: Test Vector Stores
run: poetry run -P api bash dev/pytest/pytest_vdb.sh
diff --git a/.github/workflows/web-tests.yml b/.github/workflows/web-tests.yml
index 5aee64b8e6da02..e32db548a4b164 100644
--- a/.github/workflows/web-tests.yml
+++ b/.github/workflows/web-tests.yml
@@ -22,25 +22,34 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ persist-credentials: false
- name: Check changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: web/**
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- if: steps.changed-files.outputs.any_changed == 'true'
- with:
- node-version: 20
- cache: yarn
- cache-dependency-path: ./web/package.json
-
- - name: Install dependencies
- if: steps.changed-files.outputs.any_changed == 'true'
- run: yarn install --frozen-lockfile
-
- - name: Run tests
- if: steps.changed-files.outputs.any_changed == 'true'
- run: yarn test
+ # to run pnpm, should install package canvas, but it always install failed on amd64 under ubuntu-latest
+ # - name: Install pnpm
+ # uses: pnpm/action-setup@v4
+ # with:
+ # version: 10
+ # run_install: false
+
+ # - name: Setup Node.js
+ # uses: actions/setup-node@v4
+ # if: steps.changed-files.outputs.any_changed == 'true'
+ # with:
+ # node-version: 20
+ # cache: pnpm
+ # cache-dependency-path: ./web/package.json
+
+ # - name: Install dependencies
+ # if: steps.changed-files.outputs.any_changed == 'true'
+ # run: pnpm install --frozen-lockfile
+
+ # - name: Run tests
+ # if: steps.changed-files.outputs.any_changed == 'true'
+ # run: pnpm test
diff --git a/.gitignore b/.gitignore
index 1423bfee56e922..296aeee873406a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -163,6 +163,7 @@ docker/volumes/db/data/*
docker/volumes/redis/data/*
docker/volumes/weaviate/*
docker/volumes/qdrant/*
+docker/tidb/volumes/*
docker/volumes/etcd/*
docker/volumes/minio/*
docker/volumes/milvus/*
@@ -175,6 +176,7 @@ docker/volumes/pgvector/data/*
docker/volumes/pgvecto_rs/data/*
docker/volumes/couchbase/*
docker/volumes/oceanbase/*
+docker/volumes/plugin_daemon/*
!docker/volumes/oceanbase/init.d
docker/nginx/conf.d/default.conf
@@ -193,3 +195,9 @@ api/.vscode
.idea/
.vscode
+
+# pnpm
+/.pnpm-store
+
+# plugin migrate
+plugins.jsonl
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 22261804fc4bb7..3ba493e2cd046f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -73,7 +73,7 @@ Dify requires the following dependencies to build, make sure they're installed o
* [Docker](https://www.docker.com/)
* [Docker Compose](https://docs.docker.com/compose/install/)
* [Node.js v18.x (LTS)](http://nodejs.org)
-* [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
+* [pnpm](https://pnpm.io/)
* [Python](https://www.python.org/) version 3.11.x or 3.12.x
### 4. Installations
diff --git a/CONTRIBUTING_CN.md b/CONTRIBUTING_CN.md
index 4fa43b24eefafd..52606c78965a6d 100644
--- a/CONTRIBUTING_CN.md
+++ b/CONTRIBUTING_CN.md
@@ -70,7 +70,7 @@ Dify 依赖以下工具和库:
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Node.js v18.x (LTS)](http://nodejs.org)
-- [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
+- [pnpm](https://pnpm.io/)
- [Python](https://www.python.org/) version 3.11.x or 3.12.x
### 4. 安装
diff --git a/CONTRIBUTING_JA.md b/CONTRIBUTING_JA.md
index 22e30e9c031220..b1285a24e7c9a0 100644
--- a/CONTRIBUTING_JA.md
+++ b/CONTRIBUTING_JA.md
@@ -73,7 +73,7 @@ Dify を構築するには次の依存関係が必要です。それらがシス
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Node.js v18.x (LTS)](http://nodejs.org)
-- [npm](https://www.npmjs.com/) version 8.x.x or [Yarn](https://yarnpkg.com/)
+- [pnpm](https://pnpm.io/)
- [Python](https://www.python.org/) version 3.11.x or 3.12.x
### 4. インストール
diff --git a/CONTRIBUTING_VI.md b/CONTRIBUTING_VI.md
index ad41f51aeb1300..07c4afe3f28eb5 100644
--- a/CONTRIBUTING_VI.md
+++ b/CONTRIBUTING_VI.md
@@ -72,7 +72,7 @@ Dify yêu cầu các phụ thuộc sau để build, hãy đảm bảo chúng đ
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- [Node.js v18.x (LTS)](http://nodejs.org)
-- [npm](https://www.npmjs.com/) phiên bản 8.x.x hoặc [Yarn](https://yarnpkg.com/)
+- [pnpm](https://pnpm.io/)
- [Python](https://www.python.org/) phiên bản 3.11.x hoặc 3.12.x
### 4. Cài đặt
diff --git a/LICENSE b/LICENSE
index d7b8373839e1e6..e26bae0cac50b1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,12 +1,12 @@
# Open Source License
-Dify is licensed under the Apache License 2.0, with the following additional conditions:
+Dify is licensed under a modified version of the Apache License 2.0, with the following additional conditions:
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:
-a. Multi-tenant service: Unless explicitly authorized by Dify in writing, you may not use the Dify source code to operate a multi-tenant environment.
+a. Multi-tenant service: Unless explicitly authorized by Dify in writing, you may not use the Dify source code to operate a multi-tenant environment.
- 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.
-
+
b. LOGO and copyright information: In the process of using Dify's frontend, you may not remove or modify the LOGO or copyright information in the Dify console or applications. This restriction is inapplicable to uses of Dify that do not involve its frontend.
- Frontend Definition: For the purposes of this license, the "frontend" of Dify includes all components located in the `web/` directory when running Dify from the raw source code, or the "web" image when running Dify with Docker.
@@ -21,19 +21,4 @@ Apart from the specific conditions mentioned above, all other rights and restric
The interactive design of this product is protected by appearance patent.
-© 2024 LangGenius, Inc.
-
-
-----------
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+© 2025 LangGenius, Inc.
diff --git a/README.md b/README.md
index df6c481e78df64..2378cffe9be88b 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,9 @@
+
+
@@ -105,6 +108,72 @@ Please refer to our [FAQ](https://docs.dify.ai/getting-started/install-self-host
**7. Backend-as-a-Service**:
All of Dify's offerings come with corresponding APIs, so you could effortlessly integrate Dify into your own business logic.
+## Feature Comparison
+
Feature | +Dify.AI | +LangChain | +Flowise | +OpenAI Assistants API | +
---|---|---|---|---|
Programming Approach | +API + App-oriented | +Python Code | +App-oriented | +API-oriented | +
Supported LLMs | +Rich Variety | +Rich Variety | +Rich Variety | +OpenAI-only | +
RAG Engine | +✅ | +✅ | +✅ | +✅ | +
Agent | +✅ | +✅ | +❌ | +✅ | +
Workflow | +✅ | +❌ | +✅ | +❌ | +
Observability | +✅ | +✅ | +❌ | +❌ | +
Enterprise Feature (SSO/Access control) | +✅ | +❌ | +❌ | +❌ | +
Local Deployment | +✅ | +✅ | +✅ | +❌ | +