Skip to content

Commit 98960be

Browse files
authored
Merge branch 'langgenius:main' into main
2 parents 974b326 + 8b76131 commit 98960be

644 files changed

Lines changed: 38792 additions & 7463 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.

.cursorrules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Cursor Rules for Dify Project
2+
3+
## Automated Test Generation
4+
5+
- Use `web/testing/testing.md` as the canonical instruction set for generating frontend automated tests.
6+
- When proposing or saving tests, re-read that document and follow every requirement.

.github/copilot-instructions.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copilot Instructions
2+
3+
GitHub Copilot must follow the unified frontend testing requirements documented in `web/testing/testing.md`.
4+
5+
Key reminders:
6+
7+
- Generate tests using the mandated tech stack, naming, and code style (AAA pattern, `fireEvent`, descriptive test names, cleans up mocks).
8+
- Cover rendering, prop combinations, and edge cases by default; extend coverage for hooks, routing, async flows, and domain-specific components when applicable.
9+
- Target >95% line and branch coverage and 100% function/statement coverage.
10+
- Apply the project's mocking conventions for i18n, toast notifications, and Next.js utilities.
11+
12+
Any suggestions from Copilot that conflict with `web/testing/testing.md` should be revised before acceptance.

.github/workflows/translate-i18n-base-on-english.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222
with:
23-
fetch-depth: 2
23+
fetch-depth: 0
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525

2626
- name: Check for file changes in i18n/en-US
2727
id: check_files
2828
run: |
29-
recent_commit_sha=$(git rev-parse HEAD)
30-
second_recent_commit_sha=$(git rev-parse HEAD~1)
31-
changed_files=$(git diff --name-only $recent_commit_sha $second_recent_commit_sha -- 'i18n/en-US/*.ts')
29+
git fetch origin "${{ github.event.before }}" || true
30+
git fetch origin "${{ github.sha }}" || true
31+
changed_files=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- 'i18n/en-US/*.ts')
3232
echo "Changed files: $changed_files"
3333
if [ -n "$changed_files" ]; then
3434
echo "FILES_CHANGED=true" >> $GITHUB_ENV
3535
file_args=""
3636
for file in $changed_files; do
3737
filename=$(basename "$file" .ts)
38-
file_args="$file_args --file=$filename"
38+
file_args="$file_args --file $filename"
3939
done
4040
echo "FILE_ARGS=$file_args" >> $GITHUB_ENV
4141
echo "File arguments: $file_args"

.windsurf/rules/testing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Windsurf Testing Rules
2+
3+
- Use `web/testing/testing.md` as the single source of truth for frontend automated testing.
4+
- Honor every requirement in that document when generating or accepting tests.
5+
- When proposing or saving tests, re-read that document and follow every requirement.

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ How we prioritize:
7777

7878
For setting up the frontend service, please refer to our comprehensive [guide](https://github.com/langgenius/dify/blob/main/web/README.md) in the `web/README.md` file. This document provides detailed instructions to help you set up the frontend environment properly.
7979

80+
**Testing**: All React components must have comprehensive test coverage. See [web/testing/testing.md](https://github.com/langgenius/dify/blob/main/web/testing/testing.md) for the canonical frontend testing guidelines and follow every requirement described there.
81+
8082
#### Backend
8183

8284
For setting up the backend service, kindly refer to our detailed [instructions](https://github.com/langgenius/dify/blob/main/api/README.md) in the `api/README.md` file. This document contains step-by-step guidance to help you get the backend up and running smoothly.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
<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>
3737
<a href="https://github.com/langgenius/dify/discussions/" target="_blank">
3838
<img alt="Discussion posts" src="https://img.shields.io/github/discussions/langgenius/dify?labelColor=%20%239b8afb&color=%20%237a5af8"></a>
39+
<a href="https://insights.linuxfoundation.org/project/langgenius-dify" target="_blank">
40+
<img alt="LFX Health Score" src="https://insights.linuxfoundation.org/api/badge/health-score?project=langgenius-dify"></a>
41+
<a href="https://insights.linuxfoundation.org/project/langgenius-dify" target="_blank">
42+
<img alt="LFX Contributors" src="https://insights.linuxfoundation.org/api/badge/contributors?project=langgenius-dify"></a>
43+
<a href="https://insights.linuxfoundation.org/project/langgenius-dify" target="_blank">
44+
<img alt="LFX Active Contributors" src="https://insights.linuxfoundation.org/api/badge/active-contributors?project=langgenius-dify"></a>
3945
</p>
4046

4147
<p align="center">

api/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ WEAVIATE_ENDPOINT=http://localhost:8080
176176
WEAVIATE_API_KEY=WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
177177
WEAVIATE_GRPC_ENABLED=false
178178
WEAVIATE_BATCH_SIZE=100
179+
WEAVIATE_TOKENIZATION=word
179180

180181
# OceanBase Vector configuration
181182
OCEANBASE_VECTOR_HOST=127.0.0.1
@@ -539,6 +540,7 @@ WORKFLOW_LOG_CLEANUP_BATCH_SIZE=100
539540

540541
# App configuration
541542
APP_MAX_EXECUTION_TIME=1200
543+
APP_DEFAULT_ACTIVE_REQUESTS=0
542544
APP_MAX_ACTIVE_REQUESTS=0
543545

544546
# Celery beat configuration

api/.importlinter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ layers =
1616
graph
1717
nodes
1818
node_events
19+
runtime
1920
entities
2021
containers =
2122
core.workflow

api/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ RUN \
5757
# for gmpy2 \
5858
libgmp-dev libmpfr-dev libmpc-dev \
5959
# For Security
60-
expat libldap-2.5-0 perl libsqlite3-0 zlib1g \
60+
expat libldap-2.5-0=2.5.13+dfsg-5 perl libsqlite3-0=3.40.1-2+deb12u2 zlib1g=1:1.2.13.dfsg-1 \
6161
# install fonts to support the use of tools like pypdfium2
6262
fonts-noto-cjk \
6363
# install a package to improve the accuracy of guessing mime type and file extension
@@ -73,7 +73,8 @@ COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV}
7373
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
7474

7575
# Download nltk data
76-
RUN python -c "import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')"
76+
RUN mkdir -p /usr/local/share/nltk_data && NLTK_DATA=/usr/local/share/nltk_data python -c "import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger'); nltk.download('stopwords')" \
77+
&& chmod -R 755 /usr/local/share/nltk_data
7778

7879
ENV TIKTOKEN_CACHE_DIR=/app/api/.tiktoken_cache
7980

@@ -86,7 +87,15 @@ COPY . /app/api/
8687
COPY docker/entrypoint.sh /entrypoint.sh
8788
RUN chmod +x /entrypoint.sh
8889

90+
# Create non-root user and set permissions
91+
RUN groupadd -r -g 1001 dify && \
92+
useradd -r -u 1001 -g 1001 -s /bin/bash dify && \
93+
mkdir -p /home/dify && \
94+
chown -R 1001:1001 /app /home/dify ${TIKTOKEN_CACHE_DIR} /entrypoint.sh
95+
8996
ARG COMMIT_SHA
9097
ENV COMMIT_SHA=${COMMIT_SHA}
98+
ENV NLTK_DATA=/usr/local/share/nltk_data
99+
USER 1001
91100

92101
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]

api/configs/feature/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class AppExecutionConfig(BaseSettings):
7373
description="Maximum allowed execution time for the application in seconds",
7474
default=1200,
7575
)
76+
APP_DEFAULT_ACTIVE_REQUESTS: NonNegativeInt = Field(
77+
description="Default number of concurrent active requests per app (0 for unlimited)",
78+
default=0,
79+
)
7680
APP_MAX_ACTIVE_REQUESTS: NonNegativeInt = Field(
7781
description="Maximum number of concurrent active requests per app (0 for unlimited)",
7882
default=0,

0 commit comments

Comments
 (0)