Skip to content

Commit aebda43

Browse files
authored
Merge branch 'langgenius:main' into main
2 parents 98960be + a85afe4 commit aebda43

132 files changed

Lines changed: 37006 additions & 1722 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/CODEOWNERS

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
# CODEOWNERS
2+
# This file defines code ownership for the Dify project.
3+
# Each line is a file pattern followed by one or more owners.
4+
# Owners can be @username, @org/team-name, or email addresses.
5+
# For more information, see: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
6+
7+
* @crazywoola @laipz8200 @Yeuoly
8+
9+
# Backend (default owner, more specific rules below will override)
10+
api/ @QuantumGhost
11+
12+
# Backend - Workflow - Engine (Core graph execution engine)
13+
api/core/workflow/graph_engine/ @laipz8200 @QuantumGhost
14+
api/core/workflow/runtime/ @laipz8200 @QuantumGhost
15+
api/core/workflow/graph/ @laipz8200 @QuantumGhost
16+
api/core/workflow/graph_events/ @laipz8200 @QuantumGhost
17+
api/core/workflow/node_events/ @laipz8200 @QuantumGhost
18+
api/core/model_runtime/ @laipz8200 @QuantumGhost
19+
20+
# Backend - Workflow - Nodes (Agent, Iteration, Loop, LLM)
21+
api/core/workflow/nodes/agent/ @Nov1c444
22+
api/core/workflow/nodes/iteration/ @Nov1c444
23+
api/core/workflow/nodes/loop/ @Nov1c444
24+
api/core/workflow/nodes/llm/ @Nov1c444
25+
26+
# Backend - RAG (Retrieval Augmented Generation)
27+
api/core/rag/ @JohnJyong
28+
api/services/rag_pipeline/ @JohnJyong
29+
api/services/dataset_service.py @JohnJyong
30+
api/services/knowledge_service.py @JohnJyong
31+
api/services/external_knowledge_service.py @JohnJyong
32+
api/services/hit_testing_service.py @JohnJyong
33+
api/services/metadata_service.py @JohnJyong
34+
api/services/vector_service.py @JohnJyong
35+
api/services/entities/knowledge_entities/ @JohnJyong
36+
api/services/entities/external_knowledge_entities/ @JohnJyong
37+
api/controllers/console/datasets/ @JohnJyong
38+
api/controllers/service_api/dataset/ @JohnJyong
39+
api/models/dataset.py @JohnJyong
40+
api/tasks/rag_pipeline/ @JohnJyong
41+
api/tasks/add_document_to_index_task.py @JohnJyong
42+
api/tasks/batch_clean_document_task.py @JohnJyong
43+
api/tasks/clean_document_task.py @JohnJyong
44+
api/tasks/clean_notion_document_task.py @JohnJyong
45+
api/tasks/document_indexing_task.py @JohnJyong
46+
api/tasks/document_indexing_sync_task.py @JohnJyong
47+
api/tasks/document_indexing_update_task.py @JohnJyong
48+
api/tasks/duplicate_document_indexing_task.py @JohnJyong
49+
api/tasks/recover_document_indexing_task.py @JohnJyong
50+
api/tasks/remove_document_from_index_task.py @JohnJyong
51+
api/tasks/retry_document_indexing_task.py @JohnJyong
52+
api/tasks/sync_website_document_indexing_task.py @JohnJyong
53+
api/tasks/batch_create_segment_to_index_task.py @JohnJyong
54+
api/tasks/create_segment_to_index_task.py @JohnJyong
55+
api/tasks/delete_segment_from_index_task.py @JohnJyong
56+
api/tasks/disable_segment_from_index_task.py @JohnJyong
57+
api/tasks/disable_segments_from_index_task.py @JohnJyong
58+
api/tasks/enable_segment_to_index_task.py @JohnJyong
59+
api/tasks/enable_segments_to_index_task.py @JohnJyong
60+
api/tasks/clean_dataset_task.py @JohnJyong
61+
api/tasks/deal_dataset_index_update_task.py @JohnJyong
62+
api/tasks/deal_dataset_vector_index_task.py @JohnJyong
63+
64+
# Backend - Plugins
65+
api/core/plugin/ @Mairuis @Yeuoly @Stream29
66+
api/services/plugin/ @Mairuis @Yeuoly @Stream29
67+
api/controllers/console/workspace/plugin.py @Mairuis @Yeuoly @Stream29
68+
api/controllers/inner_api/plugin/ @Mairuis @Yeuoly @Stream29
69+
api/tasks/process_tenant_plugin_autoupgrade_check_task.py @Mairuis @Yeuoly @Stream29
70+
71+
# Backend - Trigger/Schedule/Webhook
72+
api/controllers/trigger/ @Mairuis @Yeuoly
73+
api/controllers/console/app/workflow_trigger.py @Mairuis @Yeuoly
74+
api/controllers/console/workspace/trigger_providers.py @Mairuis @Yeuoly
75+
api/core/trigger/ @Mairuis @Yeuoly
76+
api/core/app/layers/trigger_post_layer.py @Mairuis @Yeuoly
77+
api/services/trigger/ @Mairuis @Yeuoly
78+
api/models/trigger.py @Mairuis @Yeuoly
79+
api/fields/workflow_trigger_fields.py @Mairuis @Yeuoly
80+
api/repositories/workflow_trigger_log_repository.py @Mairuis @Yeuoly
81+
api/repositories/sqlalchemy_workflow_trigger_log_repository.py @Mairuis @Yeuoly
82+
api/libs/schedule_utils.py @Mairuis @Yeuoly
83+
api/services/workflow/scheduler.py @Mairuis @Yeuoly
84+
api/schedule/trigger_provider_refresh_task.py @Mairuis @Yeuoly
85+
api/schedule/workflow_schedule_task.py @Mairuis @Yeuoly
86+
api/tasks/trigger_processing_tasks.py @Mairuis @Yeuoly
87+
api/tasks/trigger_subscription_refresh_tasks.py @Mairuis @Yeuoly
88+
api/tasks/workflow_schedule_tasks.py @Mairuis @Yeuoly
89+
api/tasks/workflow_cfs_scheduler/ @Mairuis @Yeuoly
90+
api/events/event_handlers/sync_plugin_trigger_when_app_created.py @Mairuis @Yeuoly
91+
api/events/event_handlers/update_app_triggers_when_app_published_workflow_updated.py @Mairuis @Yeuoly
92+
api/events/event_handlers/sync_workflow_schedule_when_app_published.py @Mairuis @Yeuoly
93+
api/events/event_handlers/sync_webhook_when_app_created.py @Mairuis @Yeuoly
94+
95+
# Backend - Async Workflow
96+
api/services/async_workflow_service.py @Mairuis @Yeuoly
97+
api/tasks/async_workflow_tasks.py @Mairuis @Yeuoly
98+
99+
# Backend - Billing
100+
api/services/billing_service.py @hj24 @zyssyz123
101+
api/controllers/console/billing/ @hj24 @zyssyz123
102+
103+
# Backend - Enterprise
104+
api/configs/enterprise/ @GarfieldDai @GareArc
105+
api/services/enterprise/ @GarfieldDai @GareArc
106+
api/services/feature_service.py @GarfieldDai @GareArc
107+
api/controllers/console/feature.py @GarfieldDai @GareArc
108+
api/controllers/web/feature.py @GarfieldDai @GareArc
109+
110+
# Backend - Database Migrations
111+
api/migrations/ @snakevash @laipz8200
112+
113+
# Frontend
114+
web/ @iamjoel
115+
116+
# Frontend - App - Orchestration
117+
web/app/components/workflow/ @iamjoel @zxhlyh
118+
web/app/components/workflow-app/ @iamjoel @zxhlyh
119+
web/app/components/app/configuration/ @iamjoel @zxhlyh
120+
web/app/components/app/app-publisher/ @iamjoel @zxhlyh
121+
122+
# Frontend - WebApp - Chat
123+
web/app/components/base/chat/ @iamjoel @zxhlyh
124+
125+
# Frontend - WebApp - Completion
126+
web/app/components/share/text-generation/ @iamjoel @zxhlyh
127+
128+
# Frontend - App - List and Creation
129+
web/app/components/apps/ @JzoNgKVO @iamjoel
130+
web/app/components/app/create-app-dialog/ @JzoNgKVO @iamjoel
131+
web/app/components/app/create-app-modal/ @JzoNgKVO @iamjoel
132+
web/app/components/app/create-from-dsl-modal/ @JzoNgKVO @iamjoel
133+
134+
# Frontend - App - API Documentation
135+
web/app/components/develop/ @JzoNgKVO @iamjoel
136+
137+
# Frontend - App - Logs and Annotations
138+
web/app/components/app/workflow-log/ @JzoNgKVO @iamjoel
139+
web/app/components/app/log/ @JzoNgKVO @iamjoel
140+
web/app/components/app/log-annotation/ @JzoNgKVO @iamjoel
141+
web/app/components/app/annotation/ @JzoNgKVO @iamjoel
142+
143+
# Frontend - App - Monitoring
144+
web/app/(commonLayout)/app/(appDetailLayout)/\[appId\]/overview/ @JzoNgKVO @iamjoel
145+
web/app/components/app/overview/ @JzoNgKVO @iamjoel
146+
147+
# Frontend - App - Settings
148+
web/app/components/app-sidebar/ @JzoNgKVO @iamjoel
149+
150+
# Frontend - RAG - Hit Testing
151+
web/app/components/datasets/hit-testing/ @JzoNgKVO @iamjoel
152+
153+
# Frontend - RAG - List and Creation
154+
web/app/components/datasets/list/ @iamjoel @WTW0313
155+
web/app/components/datasets/create/ @iamjoel @WTW0313
156+
web/app/components/datasets/create-from-pipeline/ @iamjoel @WTW0313
157+
web/app/components/datasets/external-knowledge-base/ @iamjoel @WTW0313
158+
159+
# Frontend - RAG - Orchestration (general rule first, specific rules below override)
160+
web/app/components/rag-pipeline/ @iamjoel @WTW0313
161+
web/app/components/rag-pipeline/components/rag-pipeline-main.tsx @iamjoel @zxhlyh
162+
web/app/components/rag-pipeline/store/ @iamjoel @zxhlyh
163+
164+
# Frontend - RAG - Documents List
165+
web/app/components/datasets/documents/list.tsx @iamjoel @WTW0313
166+
web/app/components/datasets/documents/create-from-pipeline/ @iamjoel @WTW0313
167+
168+
# Frontend - RAG - Segments List
169+
web/app/components/datasets/documents/detail/ @iamjoel @WTW0313
170+
171+
# Frontend - RAG - Settings
172+
web/app/components/datasets/settings/ @iamjoel @WTW0313
173+
174+
# Frontend - Ecosystem - Plugins
175+
web/app/components/plugins/ @iamjoel @zhsama
176+
177+
# Frontend - Ecosystem - Tools
178+
web/app/components/tools/ @iamjoel @Yessenia-d
179+
180+
# Frontend - Ecosystem - MarketPlace
181+
web/app/components/plugins/marketplace/ @iamjoel @Yessenia-d
182+
183+
# Frontend - Login and Registration
184+
web/app/signin/ @douxc @iamjoel
185+
web/app/signup/ @douxc @iamjoel
186+
web/app/reset-password/ @douxc @iamjoel
187+
web/app/install/ @douxc @iamjoel
188+
web/app/init/ @douxc @iamjoel
189+
web/app/forgot-password/ @douxc @iamjoel
190+
web/app/account/ @douxc @iamjoel
191+
192+
# Frontend - Service Authentication
193+
web/service/base.ts @douxc @iamjoel
194+
195+
# Frontend - WebApp Authentication and Access Control
196+
web/app/(shareLayout)/components/ @douxc @iamjoel
197+
web/app/(shareLayout)/webapp-signin/ @douxc @iamjoel
198+
web/app/(shareLayout)/webapp-reset-password/ @douxc @iamjoel
199+
web/app/components/app/app-access-control/ @douxc @iamjoel
200+
201+
# Frontend - Explore Page
202+
web/app/components/explore/ @CodingOnStar @iamjoel
203+
204+
# Frontend - Personal Settings
205+
web/app/components/header/account-setting/ @CodingOnStar @iamjoel
206+
web/app/components/header/account-dropdown/ @CodingOnStar @iamjoel
207+
208+
# Frontend - Analytics
209+
web/app/components/base/ga/ @CodingOnStar @iamjoel
210+
211+
# Frontend - Base Components
212+
web/app/components/base/ @iamjoel @zxhlyh
213+
214+
# Frontend - Utils and Hooks
215+
web/utils/classnames.ts @iamjoel @zxhlyh
216+
web/utils/time.ts @iamjoel @zxhlyh
217+
web/utils/format.ts @iamjoel @zxhlyh
218+
web/utils/clipboard.ts @iamjoel @zxhlyh
219+
web/hooks/use-document-title.ts @iamjoel @zxhlyh
220+
221+
# Frontend - Billing and Education
222+
web/app/components/billing/ @iamjoel @zxhlyh
223+
web/app/education-apply/ @iamjoel @zxhlyh
224+
225+
# Frontend - Workspace
226+
web/app/components/header/account-dropdown/workplace-selector/ @iamjoel @zxhlyh

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ jobs:
7777
uses: peter-evans/create-pull-request@v6
7878
with:
7979
token: ${{ secrets.GITHUB_TOKEN }}
80-
commit-message: Update i18n files and type definitions based on en-US changes
81-
title: 'chore: translate i18n files and update type definitions'
80+
commit-message: 'chore(i18n): update translations based on en-US changes'
81+
title: 'chore(i18n): translate i18n files and update type definitions'
8282
body: |
8383
This PR was automatically created to update i18n files and TypeScript type definitions based on changes in en-US locale.
84-
84+
85+
**Triggered by:** ${{ github.sha }}
86+
8587
**Changes included:**
8688
- Updated translation files for all locales
8789
- Regenerated TypeScript type definitions for type safety
88-
branch: chore/automated-i18n-updates
90+
branch: chore/automated-i18n-updates-${{ github.sha }}
91+
delete-branch: true

api/Dockerfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ ENV PYTHONIOENCODING=utf-8
4848

4949
WORKDIR /app/api
5050

51+
# Create non-root user
52+
ARG dify_uid=1001
53+
RUN groupadd -r -g ${dify_uid} dify && \
54+
useradd -r -u ${dify_uid} -g ${dify_uid} -s /bin/bash dify && \
55+
chown -R dify:dify /app
56+
5157
RUN \
5258
apt-get update \
5359
# Install dependencies
@@ -69,7 +75,7 @@ RUN \
6975

7076
# Copy Python environment and packages
7177
ENV VIRTUAL_ENV=/app/api/.venv
72-
COPY --from=packages ${VIRTUAL_ENV} ${VIRTUAL_ENV}
78+
COPY --from=packages --chown=dify:dify ${VIRTUAL_ENV} ${VIRTUAL_ENV}
7379
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
7480

7581
# Download nltk data
@@ -78,24 +84,20 @@ RUN mkdir -p /usr/local/share/nltk_data && NLTK_DATA=/usr/local/share/nltk_data
7884

7985
ENV TIKTOKEN_CACHE_DIR=/app/api/.tiktoken_cache
8086

81-
RUN python -c "import tiktoken; tiktoken.encoding_for_model('gpt2')"
87+
RUN python -c "import tiktoken; tiktoken.encoding_for_model('gpt2')" \
88+
&& chown -R dify:dify ${TIKTOKEN_CACHE_DIR}
8289

8390
# Copy source code
84-
COPY . /app/api/
91+
COPY --chown=dify:dify . /app/api/
8592

86-
# Copy entrypoint
87-
COPY docker/entrypoint.sh /entrypoint.sh
88-
RUN chmod +x /entrypoint.sh
93+
# Prepare entrypoint script
94+
COPY --chown=dify:dify --chmod=755 docker/entrypoint.sh /entrypoint.sh
8995

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
9596

9697
ARG COMMIT_SHA
9798
ENV COMMIT_SHA=${COMMIT_SHA}
9899
ENV NLTK_DATA=/usr/local/share/nltk_data
99-
USER 1001
100+
101+
USER dify
100102

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

api/app_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def initialize_extensions(app: DifyApp):
5151
ext_commands,
5252
ext_compress,
5353
ext_database,
54+
ext_forward_refs,
5455
ext_hosting_provider,
5556
ext_import_modules,
5657
ext_logging,
@@ -75,6 +76,7 @@ def initialize_extensions(app: DifyApp):
7576
ext_warnings,
7677
ext_import_modules,
7778
ext_orjson,
79+
ext_forward_refs,
7880
ext_set_secretkey,
7981
ext_compress,
8082
ext_code_based_extension,
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
from flask_restx import Resource, fields, reqparse
1+
from flask import request
2+
from flask_restx import Resource, fields
3+
from pydantic import BaseModel, Field
24

35
from controllers.console import console_ns
46
from controllers.console.wraps import account_initialization_required, setup_required
57
from libs.login import login_required
68
from services.advanced_prompt_template_service import AdvancedPromptTemplateService
79

8-
parser = (
9-
reqparse.RequestParser()
10-
.add_argument("app_mode", type=str, required=True, location="args", help="Application mode")
11-
.add_argument("model_mode", type=str, required=True, location="args", help="Model mode")
12-
.add_argument("has_context", type=str, required=False, default="true", location="args", help="Whether has context")
13-
.add_argument("model_name", type=str, required=True, location="args", help="Model name")
10+
11+
class AdvancedPromptTemplateQuery(BaseModel):
12+
app_mode: str = Field(..., description="Application mode")
13+
model_mode: str = Field(..., description="Model mode")
14+
has_context: str = Field(default="true", description="Whether has context")
15+
model_name: str = Field(..., description="Model name")
16+
17+
18+
console_ns.schema_model(
19+
AdvancedPromptTemplateQuery.__name__,
20+
AdvancedPromptTemplateQuery.model_json_schema(ref_template="#/definitions/{model}"),
1421
)
1522

1623

1724
@console_ns.route("/app/prompt-templates")
1825
class AdvancedPromptTemplateList(Resource):
1926
@console_ns.doc("get_advanced_prompt_templates")
2027
@console_ns.doc(description="Get advanced prompt templates based on app mode and model configuration")
21-
@console_ns.expect(parser)
28+
@console_ns.expect(console_ns.models[AdvancedPromptTemplateQuery.__name__])
2229
@console_ns.response(
2330
200, "Prompt templates retrieved successfully", fields.List(fields.Raw(description="Prompt template data"))
2431
)
@@ -27,6 +34,6 @@ class AdvancedPromptTemplateList(Resource):
2734
@login_required
2835
@account_initialization_required
2936
def get(self):
30-
args = parser.parse_args()
37+
args = AdvancedPromptTemplateQuery.model_validate(request.args.to_dict(flat=True)) # type: ignore
3138

32-
return AdvancedPromptTemplateService.get_prompt(args)
39+
return AdvancedPromptTemplateService.get_prompt(args.model_dump())

0 commit comments

Comments
 (0)