From 498c4970e7294a773e9c96b92a631585e9d52429 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Mon, 31 Mar 2025 09:57:46 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat=EF=BC=9Adocker-compose=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.dify-plus.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/docker-compose.dify-plus.yaml b/docker/docker-compose.dify-plus.yaml index 5690169f9..a749df451 100644 --- a/docker/docker-compose.dify-plus.yaml +++ b/docker/docker-compose.dify-plus.yaml @@ -393,7 +393,7 @@ x-shared-env: &shared-api-worker-env services: # API service api: - image: famousmai/dify-plus-api:0.0.6 + image: famousmai/dify-plus-api:0.0.7 # build: # context: ../api # dockerfile: ./Dockerfile @@ -419,7 +419,7 @@ services: # worker service # The Celery worker for processing the queue. worker: - image: famousmai/dify-plus-api:0.0.6 + image: famousmai/dify-plus-api:0.0.7 # build: # context: ../api # dockerfile: ./Dockerfile @@ -444,7 +444,7 @@ services: # Frontend web application. web: - image: famousmai/dify-plus-web:0.0.6 + image: famousmai/dify-plus-web:0.0.7 # build: # context: ../web # dockerfile: ./Dockerfile @@ -608,7 +608,7 @@ services: AUTHORIZATION_ADMINLIST_USERS: ${WEAVIATE_AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai} admin-web: - image: famousmai/dify-plus-admin-web:0.0.6 + image: famousmai/dify-plus-admin-web:0.0.7 # build: # context: ../admin/web # dockerfile: ./Dockerfile @@ -622,7 +622,7 @@ services: - default admin-server: - image: famousmai/dify-plus-admin-server:0.0.6 + image: famousmai/dify-plus-admin-server:0.0.7 # build: # context: ../admin/server # dockerfile: ./Dockerfile From 746a96ef813a1fec5f2d018d2b59e48089ead016 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Mon, 31 Mar 2025 11:46:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E4=BD=BF=E7=94=A8g?= =?UTF-8?q?itlab-ci=EF=BC=8C=E5=8E=BB=E6=9E=84=E5=BB=BA=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 234 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..9b70d4b07 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,234 @@ +# .gitlab-ci.yml +# 构建并推送API、Web、Admin-Server、Admin-Web镜像到腾讯云容器镜像服务 + +stages: + - build + - manifest + +variables: + DOCKER_REGISTRY: ccr.ccs.tencentyun.com + DIFY_WEB_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/web + DIFY_API_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/api + ADMIN_WEB_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/admin-web + ADMIN_SERVER_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/admin-server + +# 只有在打tag时触发 +workflow: + rules: + - if: $CI_COMMIT_TAG + when: always + - when: never + +default: + tags: + - docker + before_script: + - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY + +# 构建API镜像 - AMD64 +build-api-amd64: + stage: build + script: + - | + platform="linux/amd64" + image_name=$DIFY_API_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-amd64" + docker build \ + --platform $platform \ + --build-arg COMMIT_SHA=$CI_COMMIT_SHA \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-amd64 \ + -f api/Dockerfile api + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-amd64 + echo $image_name:$platform_tag >> manifest_api.txt + +# 构建API镜像 - ARM64 +build-api-arm64: + stage: build + script: + - | + platform="linux/arm64" + image_name=$DIFY_API_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-arm64" + docker build \ + --platform $platform \ + --build-arg COMMIT_SHA=$CI_COMMIT_SHA \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-arm64 \ + -f api/Dockerfile api + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-arm64 + echo $image_name:$platform_tag >> manifest_api.txt + +# 构建Web镜像 - AMD64 +build-web-amd64: + stage: build + script: + - | + platform="linux/amd64" + image_name=$DIFY_WEB_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-amd64" + docker build \ + --platform $platform \ + --build-arg COMMIT_SHA=$CI_COMMIT_SHA \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-amd64 \ + -f web/Dockerfile web + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-amd64 + echo $image_name:$platform_tag >> manifest_web.txt + +# 构建Web镜像 - ARM64 +build-web-arm64: + stage: build + script: + - | + platform="linux/arm64" + image_name=$DIFY_WEB_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-arm64" + docker build \ + --platform $platform \ + --build-arg COMMIT_SHA=$CI_COMMIT_SHA \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-arm64 \ + -f web/Dockerfile web + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-arm64 + echo $image_name:$platform_tag >> manifest_web.txt + +# 构建Admin Server镜像 - AMD64 +build-admin-server-amd64: + stage: build + script: + - | + platform="linux/amd64" + image_name=$ADMIN_SERVER_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-amd64" + docker build \ + --platform $platform \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-amd64 \ + -f admin/server/Dockerfile admin/server + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-amd64 + echo $image_name:$platform_tag >> manifest_admin_server.txt + +# 构建Admin Server镜像 - ARM64 +build-admin-server-arm64: + stage: build + script: + - | + platform="linux/arm64" + image_name=$ADMIN_SERVER_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-arm64" + docker build \ + --platform $platform \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-arm64 \ + -f admin/server/Dockerfile admin/server + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-arm64 + echo $image_name:$platform_tag >> manifest_admin_server.txt + +# 构建Admin Web镜像 - AMD64 +build-admin-web-amd64: + stage: build + script: + - | + platform="linux/amd64" + image_name=$ADMIN_WEB_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-amd64" + docker build \ + --platform $platform \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-amd64 \ + -f admin/web/Dockerfile admin/web + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-amd64 + echo $image_name:$platform_tag >> manifest_admin_web.txt + +# 构建Admin Web镜像 - ARM64 +build-admin-web-arm64: + stage: build + script: + - | + platform="linux/arm64" + image_name=$ADMIN_WEB_IMAGE_NAME + tag=$CI_COMMIT_TAG + platform_tag="$tag-arm64" + docker build \ + --platform $platform \ + --tag $image_name:$platform_tag \ + --tag $image_name:$CI_COMMIT_SHA-arm64 \ + -f admin/web/Dockerfile admin/web + docker push $image_name:$platform_tag + docker push $image_name:$CI_COMMIT_SHA-arm64 + echo $image_name:$platform_tag >> manifest_admin_web.txt + +# 创建API多架构清单 +create-manifest-api: + stage: manifest + needs: + - build-api-amd64 + - build-api-arm64 + script: + - | + image_name=$DIFY_API_IMAGE_NAME + tag=$CI_COMMIT_TAG + docker manifest create $image_name:$tag $(cat manifest_api.txt) + docker manifest create $image_name:latest $(cat manifest_api.txt) + docker manifest push $image_name:$tag + docker manifest push $image_name:latest + +# 创建Web多架构清单 +create-manifest-web: + stage: manifest + needs: + - build-web-amd64 + - build-web-arm64 + script: + - | + image_name=$DIFY_WEB_IMAGE_NAME + tag=$CI_COMMIT_TAG + docker manifest create $image_name:$tag $(cat manifest_web.txt) + docker manifest create $image_name:latest $(cat manifest_web.txt) + docker manifest push $image_name:$tag + docker manifest push $image_name:latest + +# 创建Admin Server多架构清单 +create-manifest-admin-server: + stage: manifest + needs: + - build-admin-server-amd64 + - build-admin-server-arm64 + script: + - | + image_name=$ADMIN_SERVER_IMAGE_NAME + tag=$CI_COMMIT_TAG + docker manifest create $image_name:$tag $(cat manifest_admin_server.txt) + docker manifest create $image_name:latest $(cat manifest_admin_server.txt) + docker manifest push $image_name:$tag + docker manifest push $image_name:latest + +# 创建Admin Web多架构清单 +create-manifest-admin-web: + stage: manifest + needs: + - build-admin-web-amd64 + - build-admin-web-arm64 + script: + - | + image_name=$ADMIN_WEB_IMAGE_NAME + tag=$CI_COMMIT_TAG + docker manifest create $image_name:$tag $(cat manifest_admin_web.txt) + docker manifest create $image_name:latest $(cat manifest_admin_web.txt) + docker manifest push $image_name:$tag + docker manifest push $image_name:latest \ No newline at end of file From 76dafd6fd26ea0dd3a3592ff53e0a1b403b4d3c2 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Mon, 31 Mar 2025 12:00:06 +0800 Subject: [PATCH 3/9] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E4=BD=BF=E7=94=A8g?= =?UTF-8?q?itlab-ci=EF=BC=8C=E5=8E=BB=E6=9E=84=E5=BB=BA=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b70d4b07..c2883dcaa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,8 +20,6 @@ workflow: - when: never default: - tags: - - docker before_script: - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY From 1057e5a978c71804500f2329948bec3c7267aa66 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Mon, 31 Mar 2025 14:07:50 +0800 Subject: [PATCH 4/9] =?UTF-8?q?ci:=20=E6=B5=8B=E8=AF=95=E4=BD=BF=E7=94=A8g?= =?UTF-8?q?itlab-ci=EF=BC=8C=E5=8E=BB=E6=9E=84=E5=BB=BA=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2883dcaa..c2c0677ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ workflow: default: before_script: - - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY + - docker login ${DOCKER_REGISTRY} -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} # 构建API镜像 - AMD64 build-api-amd64: From 9f6e00c7c12239df784f9ea77ec5fcc936a5c8ca Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Mon, 31 Mar 2025 22:12:19 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E9=95=9C=E5=83=8F?= =?UTF-8?q?=EF=BC=8C=E8=BF=98=E6=9C=89=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/server/config.docker.yaml | 6 +++ admin/server/initialize/ensure_tables.go | 4 ++ admin/server/initialize/gorm.go | 2 +- admin/server/source/system/menu.go | 6 +-- ...f1696997b_add_system_integration_extend.py | 43 +++++++++++++++++++ docker/docker-compose.dify-plus.yaml | 10 ++--- 6 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 api/migrations/versions/2025_03_31_2136-588f1696997b_add_system_integration_extend.py diff --git a/admin/server/config.docker.yaml b/admin/server/config.docker.yaml index abd27d1d4..ea7a99496 100644 --- a/admin/server/config.docker.yaml +++ b/admin/server/config.docker.yaml @@ -131,6 +131,12 @@ qiniu: secret-key: "" use-https: false use-cdn-domains: false +dify-redis: + name: "" + addr: redis:6379 + password: difyai123456 + db: 0 + useCluster: false redis: name: "" addr: redis:6379 diff --git a/admin/server/initialize/ensure_tables.go b/admin/server/initialize/ensure_tables.go index f4f19990f..f70df220e 100644 --- a/admin/server/initialize/ensure_tables.go +++ b/admin/server/initialize/ensure_tables.go @@ -65,6 +65,8 @@ func (e *ensureTables) MigrateTable(ctx context.Context) (context.Context, error gaia.AccountDingTalkExtend{}, gaia.AppRequestTestBatch{}, gaia.AppRequestTest{}, + gaia.SystemIntegration{}, // Extend System Integration + sysModel.SysUserGlobalCode{}, // Extend Global Code // Extend gaia model } for _, t := range tables { @@ -109,6 +111,8 @@ func (e *ensureTables) TableCreated(ctx context.Context) bool { gaia.AccountDingTalkExtend{}, gaia.AppRequestTestBatch{}, gaia.AppRequestTest{}, + gaia.SystemIntegration{}, // Extend System Integration + sysModel.SysUserGlobalCode{}, // Extend Global Code // Extend gaia model } yes := true diff --git a/admin/server/initialize/gorm.go b/admin/server/initialize/gorm.go index c29c33fec..43bce835f 100644 --- a/admin/server/initialize/gorm.go +++ b/admin/server/initialize/gorm.go @@ -66,9 +66,9 @@ func RegisterTables() { gaia.AccountDingTalkExtend{}, gaia.AppRequestTestBatch{}, gaia.AppRequestTest{}, - // Extend gaia model gaia.SystemIntegration{}, // Extend System Integration system.SysUserGlobalCode{}, // Extend Global Code + // Extend gaia model ) if err != nil { global.GVA_LOG.Error("register table failed", zap.Error(err)) diff --git a/admin/server/source/system/menu.go b/admin/server/source/system/menu.go index 9876f108c..5bd29bfea 100644 --- a/admin/server/source/system/menu.go +++ b/admin/server/source/system/menu.go @@ -87,11 +87,11 @@ func (i *initMenu) InitializeData(ctx context.Context) (next context.Context, er {MenuLevel: 0, Hidden: false, ParentId: 0, Path: "UserList", Name: "UserList", Component: "view/user/index.vue", Sort: 1, Meta: Meta{Title: "用户列表", Icon: "user"}}, {MenuLevel: 0, Hidden: false, ParentId: 0, Path: "QuotaList", Name: "QuotaList", Component: "view/quota/index.vue", Sort: 2, Meta: Meta{Title: "额度管理", Icon: "wallet"}}, {MenuLevel: 0, Hidden: false, ParentId: 0, Path: "SuperTest", Name: "SuperTest", Component: "view/test/index.vue", Sort: 2, Meta: Meta{Title: "测试管理", Icon: "management"}}, - {MenuLevel: 0, Hidden: false, ParentId: 36, Path: "AppRequestTestBatch", Name: "AppRequestTestBatch", Component: "view/test/appRequest/index.vue", Sort: 1, Meta: Meta{Title: "测试批次", Icon: "list"}}, - {MenuLevel: 0, Hidden: true, ParentId: 36, Path: "AppRequestTestList", Name: "AppRequestTestList", Component: "view/test/appRequest/list.vue", Sort: 1, Meta: Meta{Title: "测试列表", Icon: "list"}}, + {MenuLevel: 0, Hidden: false, ParentId: 35, Path: "AppRequestTestBatch", Name: "AppRequestTestBatch", Component: "view/test/appRequest/index.vue", Sort: 1, Meta: Meta{Title: "测试批次", Icon: "list"}}, + {MenuLevel: 0, Hidden: true, ParentId: 35, Path: "AppRequestTestList", Name: "AppRequestTestList", Component: "view/test/appRequest/list.vue", Sort: 1, Meta: Meta{Title: "测试列表", Icon: "list"}}, // Extend Start: system integration {MenuLevel: 0, Hidden: false, ParentId: 0, Path: "SystemIntegrated", Name: "SystemIntegrated", Component: "view/systemIntegrated/index.vue", Sort: 1, Meta: Meta{Title: "系统集成", Icon: "box"}}, - {MenuLevel: 0, Hidden: false, ParentId: 39, Path: "IntegratedDingTalk", Name: "IntegratedDingTalk", Component: "view/systemIntegrated/dingTalk/index.vue", Sort: 1, Meta: Meta{Title: "钉钉", Icon: "turn-off"}}, + {MenuLevel: 0, Hidden: false, ParentId: 38, Path: "IntegratedDingTalk", Name: "IntegratedDingTalk", Component: "view/systemIntegrated/dingTalk/index.vue", Sort: 1, Meta: Meta{Title: "钉钉", Icon: "turn-off"}}, // Extend Stop: system integration // 二开部分 diff --git a/api/migrations/versions/2025_03_31_2136-588f1696997b_add_system_integration_extend.py b/api/migrations/versions/2025_03_31_2136-588f1696997b_add_system_integration_extend.py new file mode 100644 index 000000000..567493578 --- /dev/null +++ b/api/migrations/versions/2025_03_31_2136-588f1696997b_add_system_integration_extend.py @@ -0,0 +1,43 @@ +"""add_system_integration_extend + +Revision ID: 588f1696997b +Revises: 37e5bf7a1e53 +Create Date: 2025-03-31 21:36:03.818117 + +""" +from alembic import op +import models as models +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '588f1696997b' +down_revision = '37e5bf7a1e53' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('system_integration_extend', + sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False), + sa.Column('classify', sa.Integer(), server_default=sa.text('1'), nullable=False), + sa.Column('status', sa.Boolean(), server_default=sa.text('false'), nullable=False), + sa.Column('corp_id', sa.String(length=120), nullable=True), + sa.Column('agent_id', sa.String(length=120), nullable=True), + sa.Column('app_key', sa.String(length=120), nullable=True), + sa.Column('app_secret', sa.Text(), nullable=True), + sa.PrimaryKeyConstraint('id', name='system_integration_joins_pkey') + ) + with op.batch_alter_table('system_integration_extend', schema=None) as batch_op: + batch_op.create_index('system_integration_joins_classify_idx', ['classify'], unique=False) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('system_integration_extend', schema=None) as batch_op: + batch_op.drop_index('system_integration_joins_classify_idx') + + op.drop_table('system_integration_extend') + # ### end Alembic commands ### diff --git a/docker/docker-compose.dify-plus.yaml b/docker/docker-compose.dify-plus.yaml index a749df451..d8e957d29 100644 --- a/docker/docker-compose.dify-plus.yaml +++ b/docker/docker-compose.dify-plus.yaml @@ -393,7 +393,7 @@ x-shared-env: &shared-api-worker-env services: # API service api: - image: famousmai/dify-plus-api:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/api:0.0.7 # build: # context: ../api # dockerfile: ./Dockerfile @@ -419,7 +419,7 @@ services: # worker service # The Celery worker for processing the queue. worker: - image: famousmai/dify-plus-api:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/api:0.0.7 # build: # context: ../api # dockerfile: ./Dockerfile @@ -444,7 +444,7 @@ services: # Frontend web application. web: - image: famousmai/dify-plus-web:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/web:0.0.7 # build: # context: ../web # dockerfile: ./Dockerfile @@ -608,7 +608,7 @@ services: AUTHORIZATION_ADMINLIST_USERS: ${WEAVIATE_AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai} admin-web: - image: famousmai/dify-plus-admin-web:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/admin-web:0.0.7 # build: # context: ../admin/web # dockerfile: ./Dockerfile @@ -622,7 +622,7 @@ services: - default admin-server: - image: famousmai/dify-plus-admin-server:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/admin-server:0.0.7-arm64 # build: # context: ../admin/server # dockerfile: ./Dockerfile From 9b7182270e70247cf1f3d245395c6bd41b7f6ac4 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Tue, 1 Apr 2025 11:04:04 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=9B=BE=E7=89=87=E7=AD=89api=E5=9B=A0=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E9=92=A5=E8=AE=A1=E8=B4=B9=E5=AF=BC=E8=87=B4=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controllers/service_api/app/app.py | 4 ++-- api/controllers/service_api/app/audio.py | 4 ++-- api/controllers/service_api/app/conversation.py | 8 ++++---- api/controllers/service_api/app/file.py | 4 ++-- api/controllers/service_api/app/message.py | 4 ++-- api/controllers/service_api/app/workflow.py | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/api/controllers/service_api/app/app.py b/api/controllers/service_api/app/app.py index 8388e2045..716bb148b 100644 --- a/api/controllers/service_api/app/app.py +++ b/api/controllers/service_api/app/app.py @@ -5,7 +5,7 @@ from controllers.common import helpers as controller_helpers from controllers.service_api import api from controllers.service_api.app.error import AppUnavailableError from controllers.service_api.wraps import validate_app_token -from models.model import App, AppMode +from models.model import ApiToken, App, AppMode # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 from services.app_service import AppService @@ -14,7 +14,7 @@ class AppParameterApi(Resource): @validate_app_token @marshal_with(fields.parameters_fields) - def get(self, app_model: App): + def get(self, app_model: App, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 """Retrieve app parameters.""" if app_model.mode in {AppMode.ADVANCED_CHAT.value, AppMode.WORKFLOW.value}: workflow = app_model.workflow diff --git a/api/controllers/service_api/app/audio.py b/api/controllers/service_api/app/audio.py index e6bcc0bfd..26e7b106f 100644 --- a/api/controllers/service_api/app/audio.py +++ b/api/controllers/service_api/app/audio.py @@ -20,7 +20,7 @@ from controllers.service_api.app.error import ( from controllers.service_api.wraps import FetchUserArg, WhereisUserArg, validate_app_token from core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededError from core.model_runtime.errors.invoke import InvokeError -from models.model import App, AppMode, EndUser +from models.model import ApiToken, App, AppMode, EndUser # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 from services.audio_service import AudioService from services.errors.audio import ( AudioTooLargeServiceError, @@ -32,7 +32,7 @@ from services.errors.audio import ( class AudioApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.FORM)) - def post(self, app_model: App, end_user: EndUser): + def post(self, app_model: App, end_user: EndUser, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 file = request.files["file"] try: diff --git a/api/controllers/service_api/app/conversation.py b/api/controllers/service_api/app/conversation.py index 334f2c562..8ae9096e0 100644 --- a/api/controllers/service_api/app/conversation.py +++ b/api/controllers/service_api/app/conversation.py @@ -15,14 +15,14 @@ from fields.conversation_fields import ( simple_conversation_fields, ) from libs.helper import uuid_value -from models.model import App, AppMode, EndUser +from models.model import ApiToken, App, AppMode, EndUser # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 from services.conversation_service import ConversationService class ConversationApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.QUERY)) @marshal_with(conversation_infinite_scroll_pagination_fields) - def get(self, app_model: App, end_user: EndUser): + def get(self, app_model: App, end_user: EndUser, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 app_mode = AppMode.value_of(app_model.mode) if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}: raise NotChatAppError() @@ -58,7 +58,7 @@ class ConversationApi(Resource): class ConversationDetailApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON)) @marshal_with(conversation_delete_fields) - def delete(self, app_model: App, end_user: EndUser, c_id): + def delete(self, app_model: App, end_user: EndUser, c_id, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 app_mode = AppMode.value_of(app_model.mode) if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}: raise NotChatAppError() @@ -75,7 +75,7 @@ class ConversationDetailApi(Resource): class ConversationRenameApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON)) @marshal_with(simple_conversation_fields) - def post(self, app_model: App, end_user: EndUser, c_id): + def post(self, app_model: App, end_user: EndUser, c_id, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 app_mode = AppMode.value_of(app_model.mode) if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}: raise NotChatAppError() diff --git a/api/controllers/service_api/app/file.py b/api/controllers/service_api/app/file.py index 27b21b9f5..ce6a1993a 100644 --- a/api/controllers/service_api/app/file.py +++ b/api/controllers/service_api/app/file.py @@ -12,14 +12,14 @@ from controllers.service_api.app.error import ( ) from controllers.service_api.wraps import FetchUserArg, WhereisUserArg, validate_app_token from fields.file_fields import file_fields -from models.model import App, EndUser +from models.model import ApiToken, App, EndUser # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 from services.file_service import FileService class FileApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.FORM)) @marshal_with(file_fields) - def post(self, app_model: App, end_user: EndUser): + def post(self, app_model: App, end_user: EndUser, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 file = request.files["file"] # check file diff --git a/api/controllers/service_api/app/message.py b/api/controllers/service_api/app/message.py index 278a69159..117ae0aeb 100644 --- a/api/controllers/service_api/app/message.py +++ b/api/controllers/service_api/app/message.py @@ -99,7 +99,7 @@ class MessageListApi(Resource): class MessageFeedbackApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True)) - def post(self, app_model: App, end_user: EndUser, message_id): + def post(self, app_model: App, end_user: EndUser, message_id, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 message_id = str(message_id) parser = reqparse.RequestParser() @@ -123,7 +123,7 @@ class MessageFeedbackApi(Resource): class MessageSuggestedApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.QUERY, required=True)) - def get(self, app_model: App, end_user: EndUser, message_id): + def get(self, app_model: App, end_user: EndUser, message_id, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 message_id = str(message_id) app_mode = AppMode.value_of(app_model.mode) if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}: diff --git a/api/controllers/service_api/app/workflow.py b/api/controllers/service_api/app/workflow.py index c3fe75e93..7d1b18d6f 100644 --- a/api/controllers/service_api/app/workflow.py +++ b/api/controllers/service_api/app/workflow.py @@ -49,7 +49,7 @@ workflow_run_fields = { class WorkflowRunDetailApi(Resource): @validate_app_token @marshal_with(workflow_run_fields) - def get(self, app_model: App, workflow_id: str): + def get(self, app_model: App, workflow_id: str, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 """ Get a workflow task running detail """ @@ -106,7 +106,7 @@ class WorkflowRunApi(Resource): class WorkflowTaskStopApi(Resource): @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON, required=True)) - def post(self, app_model: App, end_user: EndUser, task_id: str): + def post(self, app_model: App, end_user: EndUser, task_id: str, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 """ Stop workflow task """ @@ -122,7 +122,7 @@ class WorkflowTaskStopApi(Resource): class WorkflowAppLogApi(Resource): @validate_app_token @marshal_with(workflow_app_log_pagination_fields) - def get(self, app_model: App): + def get(self, app_model: App, api_token: ApiToken): # 二开部分End - 密钥额度限制,新增api_token,否则上传文件会报错 """ Get workflow app logs """ From d4257d1a24dca644b420b2bc7a0d50506043e082 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Tue, 1 Apr 2025 11:05:26 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fix:=20=E7=AE=A1=E7=90=86=E4=B8=AD=E5=BF=83?= =?UTF-8?q?admin=EF=BC=8C=E5=88=9D=E5=A7=8B=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BC=8F=E4=BA=86=E6=96=B0=E5=8A=A0=E7=9A=84=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/server/source/system/authorities_menus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/server/source/system/authorities_menus.go b/admin/server/source/system/authorities_menus.go index 14f2ffd01..5f3d68d17 100644 --- a/admin/server/source/system/authorities_menus.go +++ b/admin/server/source/system/authorities_menus.go @@ -45,7 +45,7 @@ func (i *initMenuAuthority) InitializeData(ctx context.Context) (next context.Co } next = ctx // 888 - if err = db.Model(&authorities[0]).Association("SysBaseMenus").Replace(menus[31:38]); err != nil { + if err = db.Model(&authorities[0]).Association("SysBaseMenus").Replace(menus[31:39]); err != nil { return next, err } if err = db.Model(&authorities[0]).Association("SysBaseMenus").Append(menus[2:5]); err != nil { From 703730fc98b12b72fa5b2eda5c429be75c3e7a71 Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Tue, 1 Apr 2025 11:45:00 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix=EF=BC=9A=E6=9B=B4=E6=8D=A2=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 8 ++++---- docker/docker-compose.dify-plus.yaml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2c0677ba..fb97fdd43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,10 +7,10 @@ stages: variables: DOCKER_REGISTRY: ccr.ccs.tencentyun.com - DIFY_WEB_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/web - DIFY_API_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/api - ADMIN_WEB_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/admin-web - ADMIN_SERVER_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/admin-server + DIFY_WEB_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/dify-plus-web + DIFY_API_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/dify-plus-api + ADMIN_WEB_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/dify-plus-admin-web + ADMIN_SERVER_IMAGE_NAME: ${DOCKER_REGISTRY}/yfgaia/dify-plus-admin-server # 只有在打tag时触发 workflow: diff --git a/docker/docker-compose.dify-plus.yaml b/docker/docker-compose.dify-plus.yaml index d8e957d29..e56604190 100644 --- a/docker/docker-compose.dify-plus.yaml +++ b/docker/docker-compose.dify-plus.yaml @@ -393,7 +393,7 @@ x-shared-env: &shared-api-worker-env services: # API service api: - image: ccr.ccs.tencentyun.com/yfgaia/api:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/dify-plus-api:0.0.7 # build: # context: ../api # dockerfile: ./Dockerfile @@ -419,7 +419,7 @@ services: # worker service # The Celery worker for processing the queue. worker: - image: ccr.ccs.tencentyun.com/yfgaia/api:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/dify-plus-api:0.0.7 # build: # context: ../api # dockerfile: ./Dockerfile @@ -444,7 +444,7 @@ services: # Frontend web application. web: - image: ccr.ccs.tencentyun.com/yfgaia/web:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/dify-plus-web:0.0.7 # build: # context: ../web # dockerfile: ./Dockerfile @@ -608,7 +608,7 @@ services: AUTHORIZATION_ADMINLIST_USERS: ${WEAVIATE_AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai} admin-web: - image: ccr.ccs.tencentyun.com/yfgaia/admin-web:0.0.7 + image: ccr.ccs.tencentyun.com/yfgaia/dify-plus-admin-web:0.0.7 # build: # context: ../admin/web # dockerfile: ./Dockerfile @@ -622,7 +622,7 @@ services: - default admin-server: - image: ccr.ccs.tencentyun.com/yfgaia/admin-server:0.0.7-arm64 + image: ccr.ccs.tencentyun.com/yfgaia/dify-plus-admin-server:0.0.7 # build: # context: ../admin/server # dockerfile: ./Dockerfile From 4e0356769da50e93433b483d67830cb27d41355e Mon Sep 17 00:00:00 2001 From: FamousMai <906631095@qq.com> Date: Tue, 1 Apr 2025 15:34:28 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix=EF=BC=9Adocker=20compose=E5=8A=A0?= =?UTF-8?q?=E4=B8=8Asandbox-full=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.dify-plus.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docker/docker-compose.dify-plus.yaml b/docker/docker-compose.dify-plus.yaml index e56604190..121839b6a 100644 --- a/docker/docker-compose.dify-plus.yaml +++ b/docker/docker-compose.dify-plus.yaml @@ -406,6 +406,7 @@ services: SENTRY_DSN: ${API_SENTRY_DSN:-} SENTRY_TRACES_SAMPLE_RATE: ${API_SENTRY_TRACES_SAMPLE_RATE:-1.0} SENTRY_PROFILES_SAMPLE_RATE: ${API_SENTRY_PROFILES_SAMPLE_RATE:-1.0} + FULL_CODE_EXECUTION_ENDPOINT: ${FULL_CODE_EXECUTION_ENDPOINT:-http://sandbox-full:8194} depends_on: - db - redis @@ -522,6 +523,28 @@ services: networks: - ssrf_proxy_network + # The Dify-plus SandboxFull + sandbox-full: + image: ccr.ccs.tencentyun.com/yfgaia/dify-plus-sandbox-full:0.0.7-arm64 + restart: always + environment: + # The DifySandbox configurations + # Make sure you are changing this key for your deployment with a strong key. + # You can generate a strong key using `openssl rand -base64 42`. + API_KEY: ${SANDBOX_API_KEY:-dify-sandbox} + GIN_MODE: ${SANDBOX_GIN_MODE:-release} + WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15} + ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true} + HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128} + HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128} + SANDBOX_PORT: ${SANDBOX_PORT:-8194} + volumes: + - ./volumes/sandbox/dependencies:/dependencies + healthcheck: + test: ['CMD', 'curl', '-f', 'http://localhost:8194/health'] + networks: + - ssrf_proxy_network + # ssrf_proxy server # for more information, please refer to # https://docs.dify.ai/learn-more/faq/install-faq#id-18.-why-is-ssrf_proxy-needed