Skip to content

Commit c1b2cd9

Browse files
authored
Merge branch 'langgenius:main' into main
2 parents 464ef2c + b198c94 commit c1b2cd9

1,340 files changed

Lines changed: 53878 additions & 19942 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/api-tests.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,11 @@ jobs:
3939
- name: Install dependencies
4040
run: uv sync --project api --dev
4141

42-
- name: Run Unit tests
43-
run: |
44-
uv run --project api bash dev/pytest/pytest_unit_tests.sh
45-
4642
- name: Run pyrefly check
4743
run: |
4844
cd api
4945
uv add --dev pyrefly
5046
uv run pyrefly check || true
51-
- name: Coverage Summary
52-
run: |
53-
set -x
54-
# Extract coverage percentage and create a summary
55-
TOTAL_COVERAGE=$(python -c 'import json; print(json.load(open("coverage.json"))["totals"]["percent_covered_display"])')
56-
57-
# Create a detailed coverage summary
58-
echo "### Test Coverage Summary :test_tube:" >> $GITHUB_STEP_SUMMARY
59-
echo "Total Coverage: ${TOTAL_COVERAGE}%" >> $GITHUB_STEP_SUMMARY
60-
uv run --project api coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
6147
6248
- name: Run dify config tests
6349
run: uv run --project api dev/pytest/pytest_config_tests.py
@@ -93,3 +79,19 @@ jobs:
9379

9480
- name: Run TestContainers
9581
run: uv run --project api bash dev/pytest/pytest_testcontainers.sh
82+
83+
- name: Run Unit tests
84+
run: |
85+
uv run --project api bash dev/pytest/pytest_unit_tests.sh
86+
87+
- name: Coverage Summary
88+
run: |
89+
set -x
90+
# Extract coverage percentage and create a summary
91+
TOTAL_COVERAGE=$(python -c 'import json; print(json.load(open("coverage.json"))["totals"]["percent_covered_display"])')
92+
93+
# Create a detailed coverage summary
94+
echo "### Test Coverage Summary :test_tube:" >> $GITHUB_STEP_SUMMARY
95+
echo "Total Coverage: ${TOTAL_COVERAGE}%" >> $GITHUB_STEP_SUMMARY
96+
uv run --project api coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
97+

.github/workflows/autofix.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
run: |
3131
uvx --from ast-grep-cli sg --pattern 'db.session.query($WHATEVER).filter($HERE)' --rewrite 'db.session.query($WHATEVER).where($HERE)' -l py --update-all
3232
uvx --from ast-grep-cli sg --pattern 'session.query($WHATEVER).filter($HERE)' --rewrite 'session.query($WHATEVER).where($HERE)' -l py --update-all
33+
uvx --from ast-grep-cli sg -p '$A = db.Column($$$B)' -r '$A = mapped_column($$$B)' -l py --update-all
34+
uvx --from ast-grep-cli sg -p '$A : $T = db.Column($$$B)' -r '$A : $T = mapped_column($$$B)' -l py --update-all
3335
# Convert Optional[T] to T | None (ignoring quoted types)
3436
cat > /tmp/optional-rule.yml << 'EOF'
3537
id: convert-optional-to-union

.github/workflows/build-push.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
push:
55
branches:
66
- "main"
7-
- "deploy/dev"
8-
- "deploy/enterprise"
7+
- "deploy/**"
98
- "build/**"
109
- "release/e-*"
1110
- "hotfix/**"

.github/workflows/deploy-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Deploy to server
1919
uses: appleboy/ssh-action@v0.1.8
2020
with:
21-
host: ${{ secrets.RAG_SSH_HOST }}
21+
host: ${{ secrets.SSH_HOST }}
2222
username: ${{ secrets.SSH_USER }}
2323
key: ${{ secrets.SSH_PRIVATE_KEY }}
2424
script: |
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy RAG Dev
1+
name: Deploy Trigger Dev
22

33
permissions:
44
contents: read
@@ -7,7 +7,7 @@ on:
77
workflow_run:
88
workflows: ["Build and Push API & Web"]
99
branches:
10-
- "deploy/rag-dev"
10+
- "deploy/trigger-dev"
1111
types:
1212
- completed
1313

@@ -16,12 +16,12 @@ jobs:
1616
runs-on: ubuntu-latest
1717
if: |
1818
github.event.workflow_run.conclusion == 'success' &&
19-
github.event.workflow_run.head_branch == 'deploy/rag-dev'
19+
github.event.workflow_run.head_branch == 'deploy/trigger-dev'
2020
steps:
2121
- name: Deploy to server
2222
uses: appleboy/ssh-action@v0.1.8
2323
with:
24-
host: ${{ secrets.RAG_SSH_HOST }}
24+
host: ${{ secrets.TRIGGER_SSH_HOST }}
2525
username: ${{ secrets.SSH_USER }}
2626
key: ${{ secrets.SSH_PRIVATE_KEY }}
2727
script: |

.github/workflows/expose_service_ports.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
yq eval '.services.weaviate.ports += ["8080:8080"]' -i docker/docker-compose.yaml
4+
yq eval '.services.weaviate.ports += ["50051:50051"]' -i docker/docker-compose.yaml
45
yq eval '.services.qdrant.ports += ["6333:6333"]' -i docker/docker-compose.yaml
56
yq eval '.services.chroma.ports += ["8000:8000"]' -i docker/docker-compose.yaml
67
yq eval '.services["milvus-standalone"].ports += ["19530:19530"]' -i docker/docker-compose.yaml
@@ -13,4 +14,4 @@ yq eval '.services.tidb.ports += ["4000:4000"]' -i docker/tidb/docker-compose.ya
1314
yq eval '.services.oceanbase.ports += ["2881:2881"]' -i docker/docker-compose.yaml
1415
yq eval '.services.opengauss.ports += ["6600:6600"]' -i docker/docker-compose.yaml
1516

16-
echo "Ports exposed for sandbox, weaviate, tidb, qdrant, chroma, milvus, pgvector, pgvecto-rs, elasticsearch, couchbase, opengauss"
17+
echo "Ports exposed for sandbox, weaviate (HTTP 8080, gRPC 50051), tidb, qdrant, chroma, milvus, pgvector, pgvecto-rs, elasticsearch, couchbase, opengauss"

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The codebase is split into:
1414

1515
- Run backend CLI commands through `uv run --project api <command>`.
1616

17-
- Backend QA gate requires passing `make lint`, `make type-check`, and `uv run --project api --dev dev/pytest/pytest_unit_tests.sh` before review.
17+
- Before submission, all backend modifications must pass local checks: `make lint`, `make type-check`, and `uv run --project api --dev dev/pytest/pytest_unit_tests.sh`.
1818

1919
- Use Makefile targets for linting and formatting; `make lint` and `make type-check` cover the required checks.
2020

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,18 @@ Star Dify on GitHub and be instantly notified of new releases.
129129

130130
## Advanced Setup
131131

132+
### Custom configurations
133+
132134
If you need to customize the configuration, please refer to the comments in our [.env.example](docker/.env.example) file and update the corresponding values in your `.env` file. Additionally, you might need to make adjustments to the `docker-compose.yaml` file itself, such as changing image versions, port mappings, or volume mounts, based on your specific deployment environment and requirements. After making any changes, please re-run `docker-compose up -d`. You can find the full list of available environment variables [here](https://docs.dify.ai/getting-started/install-self-hosted/environments).
133135

136+
### Metrics Monitoring with Grafana
137+
138+
Import the dashboard to Grafana, using Dify's PostgreSQL database as data source, to monitor metrics in granularity of apps, tenants, messages, and more.
139+
140+
- [Grafana Dashboard by @bowenliang123](https://github.com/bowenliang123/dify-grafana-dashboard)
141+
142+
### Deployment with Kubernetes
143+
134144
If you'd like to configure a highly-available setup, there are community-contributed [Helm Charts](https://helm.sh/) and YAML files which allow Dify to be deployed on Kubernetes.
135145

136146
- [Helm Chart by @LeoQuote](https://github.com/douban/charts/tree/master/charts/dify)

api/.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,15 @@ OCEANBASE_VECTOR_DATABASE=test
343343
OCEANBASE_MEMORY_LIMIT=6G
344344
OCEANBASE_ENABLE_HYBRID_SEARCH=false
345345

346+
# AlibabaCloud MySQL Vector configuration
347+
ALIBABACLOUD_MYSQL_HOST=127.0.0.1
348+
ALIBABACLOUD_MYSQL_PORT=3306
349+
ALIBABACLOUD_MYSQL_USER=root
350+
ALIBABACLOUD_MYSQL_PASSWORD=root
351+
ALIBABACLOUD_MYSQL_DATABASE=dify
352+
ALIBABACLOUD_MYSQL_MAX_CONNECTION=5
353+
ALIBABACLOUD_MYSQL_HNSW_M=6
354+
346355
# openGauss configuration
347356
OPENGAUSS_HOST=127.0.0.1
348357
OPENGAUSS_PORT=6600
@@ -425,6 +434,9 @@ CODE_EXECUTION_SSL_VERIFY=True
425434
CODE_EXECUTION_POOL_MAX_CONNECTIONS=100
426435
CODE_EXECUTION_POOL_MAX_KEEPALIVE_CONNECTIONS=20
427436
CODE_EXECUTION_POOL_KEEPALIVE_EXPIRY=5.0
437+
CODE_EXECUTION_CONNECT_TIMEOUT=10
438+
CODE_EXECUTION_READ_TIMEOUT=60
439+
CODE_EXECUTION_WRITE_TIMEOUT=10
428440
CODE_MAX_NUMBER=9223372036854775807
429441
CODE_MIN_NUMBER=-9223372036854775808
430442
CODE_MAX_STRING_LENGTH=400000

api/.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ ignore = [
8181
"SIM113", # enumerate-for-loop
8282
"SIM117", # multiple-with-statements
8383
"SIM210", # if-expr-with-true-false
84-
"UP038", # deprecated and not recommended by Ruff, https://docs.astral.sh/ruff/rules/non-pep604-isinstance/
8584
]
8685

8786
[lint.per-file-ignores]

0 commit comments

Comments
 (0)