Commit 21b3f854 by Finley Ge Committed by GitHub

refactor: merge standardConstants and standard in team plan (#6549)

* refactor: merge standardConstants and standard in team plan

* Update packages/service/support/wallet/sub/utils.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: remove type assertion

* chore: type

* test: test buildStandardPlan

* fix: type

* perf: code perf

* add test code

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: archer <545436317@qq.com>
parent 007ca097
...@@ -52,8 +52,8 @@ jobs: ...@@ -52,8 +52,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Build for ${{ matrix.archs.arch }} - name: Build for ${{ matrix.archs.arch }}
id: build id: build
...@@ -65,7 +65,7 @@ jobs: ...@@ -65,7 +65,7 @@ jobs:
labels: | labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=FastGPT Sandbox Server image org.opencontainers.image.description=FastGPT Sandbox Server image
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox-server,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox-server",push-by-digest=true,push=true outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox-server,${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox-server",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
...@@ -103,8 +103,8 @@ jobs: ...@@ -103,8 +103,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Download digests - name: Download digests
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
...@@ -122,8 +122,8 @@ jobs: ...@@ -122,8 +122,8 @@ jobs:
TAGS=( TAGS=(
"ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox-server:${{ inputs.tag }}" "ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox-server:${{ inputs.tag }}"
"ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox-server:latest" "ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox-server:latest"
"${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox-server:${{ inputs.tag }}" "${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox-server:${{ inputs.tag }}"
"${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox-server:latest" "${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox-server:latest"
) )
for TAG in "${TAGS[@]}"; do for TAG in "${TAGS[@]}"; do
docker buildx imagetools create -t $TAG \ docker buildx imagetools create -t $TAG \
......
...@@ -97,7 +97,7 @@ jobs: ...@@ -97,7 +97,7 @@ jobs:
with: with:
# list of Docker images to use as base name for tags # list of Docker images to use as base name for tags
images: | images: |
${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs ${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-docs
tags: | tags: |
${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }} ${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}
flavor: latest=false flavor: latest=false
...@@ -106,8 +106,8 @@ jobs: ...@@ -106,8 +106,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Build and push Docker images (CN) - name: Build and push Docker images (CN)
if: matrix.domain_config.suffix == 'cn' if: matrix.domain_config.suffix == 'cn'
...@@ -166,8 +166,8 @@ jobs: ...@@ -166,8 +166,8 @@ jobs:
- name: Update deployment image - name: Update deployment image
run: | run: |
kubectl set image deployment/${{ matrix.domain_config.deployment }} ${{ matrix.domain_config.deployment }}=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }} kubectl set image deployment/${{ matrix.domain_config.deployment }} ${{ matrix.domain_config.deployment }}=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}
- name: Annotate deployment - name: Annotate deployment
run: | run: |
kubectl annotate deployment/${{ matrix.domain_config.deployment }} originImageName="${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}" --overwrite kubectl annotate deployment/${{ matrix.domain_config.deployment }} originImageName="${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-docs:${{ matrix.domain_config.suffix }}-${{ needs.generate-timestamp.outputs.datetime }}" --overwrite
...@@ -32,7 +32,7 @@ jobs: ...@@ -32,7 +32,7 @@ jobs:
with: with:
# list of Docker images to use as base name for tags # list of Docker images to use as base name for tags
images: | images: |
${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs ${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-docs
tags: | tags: |
${{ steps.datetime.outputs.datetime }} ${{ steps.datetime.outputs.datetime }}
flavor: latest=false flavor: latest=false
...@@ -41,8 +41,8 @@ jobs: ...@@ -41,8 +41,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Build and push Docker images - name: Build and push Docker images
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
...@@ -75,11 +75,11 @@ jobs: ...@@ -75,11 +75,11 @@ jobs:
- name: Update deployment image - name: Update deployment image
run: | run: |
kubectl set image deployment/fastgpt-docs-preview fastgpt-docs-preview=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ needs.build-images.outputs.tags }} kubectl set image deployment/fastgpt-docs-preview fastgpt-docs-preview=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-docs:${{ needs.build-images.outputs.tags }}
- name: Annotate deployment - name: Annotate deployment
run: | run: |
kubectl annotate deployment/fastgpt-docs-preview originImageName="${{ secrets.ALI_IMAGE_NAME }}/fastgpt-docs:${{ needs.build-images.outputs.tags }}" --overwrite kubectl annotate deployment/fastgpt-docs-preview originImageName="${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-docs:${{ needs.build-images.outputs.tags }}" --overwrite
- name: '@finleyge/github-tools' - name: '@finleyge/github-tools'
uses: FinleyGe/github-tools@0.0.1 uses: FinleyGe/github-tools@0.0.1
......
...@@ -4,10 +4,10 @@ on: ...@@ -4,10 +4,10 @@ on:
workflow_dispatch: workflow_dispatch:
push: push:
paths: paths:
- "projects/app/**" - 'projects/app/**'
- "packages/**" - 'packages/**'
tags: tags:
- "v*" - 'v*'
jobs: jobs:
build-fastgpt-images: build-fastgpt-images:
...@@ -20,11 +20,11 @@ jobs: ...@@ -20,11 +20,11 @@ jobs:
matrix: matrix:
sub_routes: sub_routes:
- repo: fastgpt - repo: fastgpt
base_url: "" base_url: ''
- repo: fastgpt-sub-route - repo: fastgpt-sub-route
base_url: "/fastai" base_url: '/fastai'
- repo: fastgpt-sub-route-gchat - repo: fastgpt-sub-route-gchat
base_url: "/gchat" base_url: '/gchat'
archs: archs:
- arch: amd64 - arch: amd64
- arch: arm64 - arch: arm64
...@@ -61,8 +61,8 @@ jobs: ...@@ -61,8 +61,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
...@@ -81,7 +81,7 @@ jobs: ...@@ -81,7 +81,7 @@ jobs:
labels: | labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=${{ matrix.sub_routes.repo }} image org.opencontainers.image.description=${{ matrix.sub_routes.repo }} image
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }},${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }},${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }},${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/${{ matrix.sub_routes.repo }},${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
...@@ -124,8 +124,8 @@ jobs: ...@@ -124,8 +124,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
...@@ -147,15 +147,15 @@ jobs: ...@@ -147,15 +147,15 @@ jobs:
if [[ "${{ github.ref_name }}" == "main" ]]; then if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
else else
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/${{ matrix.sub_routes.repo }}:latest" >> $GITHUB_ENV
fi fi
......
...@@ -45,8 +45,8 @@ jobs: ...@@ -45,8 +45,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Set image config - name: Set image config
id: config id: config
...@@ -54,15 +54,15 @@ jobs: ...@@ -54,15 +54,15 @@ jobs:
if [[ "${{ matrix.image }}" == "fastgpt" ]]; then if [[ "${{ matrix.image }}" == "fastgpt" ]]; then
echo "DOCKERFILE=projects/app/Dockerfile" >> $GITHUB_OUTPUT echo "DOCKERFILE=projects/app/Dockerfile" >> $GITHUB_OUTPUT
echo "DESCRIPTION=fastgpt-pr image" >> $GITHUB_OUTPUT echo "DESCRIPTION=fastgpt-pr image" >> $GITHUB_OUTPUT
echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT echo "DOCKER_REPO_TAGGED=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:fatsgpt_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.image }}" == "sandbox" ]]; then elif [[ "${{ matrix.image }}" == "sandbox" ]]; then
echo "DOCKERFILE=projects/sandbox/Dockerfile" >> $GITHUB_OUTPUT echo "DOCKERFILE=projects/sandbox/Dockerfile" >> $GITHUB_OUTPUT
echo "DESCRIPTION=fastgpt-sandbox-pr image" >> $GITHUB_OUTPUT echo "DESCRIPTION=fastgpt-sandbox-pr image" >> $GITHUB_OUTPUT
echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_sandbox_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT echo "DOCKER_REPO_TAGGED=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:fatsgpt_sandbox_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.image }}" == "mcp_server" ]]; then elif [[ "${{ matrix.image }}" == "mcp_server" ]]; then
echo "DOCKERFILE=projects/mcp_server/Dockerfile" >> $GITHUB_OUTPUT echo "DOCKERFILE=projects/mcp_server/Dockerfile" >> $GITHUB_OUTPUT
echo "DESCRIPTION=fastgpt-mcp_server-pr image" >> $GITHUB_OUTPUT echo "DESCRIPTION=fastgpt-mcp_server-pr image" >> $GITHUB_OUTPUT
echo "DOCKER_REPO_TAGGED=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-pr:fatsgpt_mcp_server_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT echo "DOCKER_REPO_TAGGED=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-pr:fatsgpt_mcp_server_${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
fi fi
- name: Build ${{ matrix.image }} image for PR - name: Build ${{ matrix.image }} image for PR
......
...@@ -44,8 +44,8 @@ jobs: ...@@ -44,8 +44,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Build for ${{ matrix.arch }} - name: Build for ${{ matrix.arch }}
id: build id: build
...@@ -57,7 +57,7 @@ jobs: ...@@ -57,7 +57,7 @@ jobs:
labels: | labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=fastgpt-marketplace image org.opencontainers.image.description=fastgpt-marketplace image
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-marketplace",push-by-digest=true,push=true outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace,${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-marketplace",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
...@@ -94,8 +94,8 @@ jobs: ...@@ -94,8 +94,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Download digests - name: Download digests
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
...@@ -118,7 +118,7 @@ jobs: ...@@ -118,7 +118,7 @@ jobs:
- name: Set image name and tag - name: Set image name and tag
run: | run: |
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace:${{ env.RANDOM_TAG }}" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace:${{ env.RANDOM_TAG }}" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-marketplace:${{ env.RANDOM_TAG }}" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-marketplace:${{ env.RANDOM_TAG }}" >> $GITHUB_ENV
- name: Create manifest list and push - name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests working-directory: ${{ runner.temp }}/digests
...@@ -138,7 +138,7 @@ jobs: ...@@ -138,7 +138,7 @@ jobs:
# Create manifest for Ali Cloud # Create manifest for Ali Cloud
echo "Creating manifest for Ali Cloud: ${Ali_Tag}" echo "Creating manifest for Ali Cloud: ${Ali_Tag}"
docker buildx imagetools create -t ${Ali_Tag} \ docker buildx imagetools create -t ${Ali_Tag} \
$(printf '${{ secrets.ALI_IMAGE_NAME }}/fastgpt-marketplace@sha256:%s ' *) $(printf '${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-marketplace@sha256:%s ' *)
echo "✅ Ali Cloud manifest created" echo "✅ Ali Cloud manifest created"
echo "" echo ""
......
...@@ -49,8 +49,8 @@ jobs: ...@@ -49,8 +49,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
...@@ -67,7 +67,7 @@ jobs: ...@@ -67,7 +67,7 @@ jobs:
labels: | labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=fastgpt-mcp_server image org.opencontainers.image.description=fastgpt-mcp_server image
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server",push-by-digest=true,push=true outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server,${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-mcp_server,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
...@@ -104,8 +104,8 @@ jobs: ...@@ -104,8 +104,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
...@@ -127,15 +127,15 @@ jobs: ...@@ -127,15 +127,15 @@ jobs:
if [[ "${{ github.ref_name }}" == "main" ]]; then if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
else else
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-mcp_server:latest" >> $GITHUB_ENV
fi fi
......
...@@ -49,8 +49,8 @@ jobs: ...@@ -49,8 +49,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
...@@ -67,7 +67,7 @@ jobs: ...@@ -67,7 +67,7 @@ jobs:
labels: | labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }} org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=fastgpt-sandbox image org.opencontainers.image.description=fastgpt-sandbox image
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox",push-by-digest=true,push=true outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox,${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox,${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox",push-by-digest=true,push=true
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
...@@ -104,8 +104,8 @@ jobs: ...@@ -104,8 +104,8 @@ jobs:
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: registry.cn-hangzhou.aliyuncs.com registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }} username: ${{ secrets.FASTGPT_ALI_IMAGE_USER }}
password: ${{ secrets.ALI_HUB_PASSWORD }} password: ${{ secrets.FASTGPT_ALI_IMAGE_PSW }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
...@@ -127,15 +127,15 @@ jobs: ...@@ -127,15 +127,15 @@ jobs:
if [[ "${{ github.ref_name }}" == "main" ]]; then if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
else else
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV echo "Ali_Tag=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Ali_Latest=${{ secrets.FASTGPT_ALI_IMAGE_PREFIX }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{ github.ref_name }}" >> $GITHUB_ENV
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:latest" >> $GITHUB_ENV
fi fi
......
...@@ -2,7 +2,9 @@ import z from 'zod'; ...@@ -2,7 +2,9 @@ import z from 'zod';
import { StandardSubLevelEnum, SubModeEnum, SubTypeEnum } from './constants'; import { StandardSubLevelEnum, SubModeEnum, SubTypeEnum } from './constants';
import { ObjectIdSchema } from '../../../common/type/mongo'; import { ObjectIdSchema } from '../../../common/type/mongo';
// Content of plan /**
* Static plan config, stored in global.subPlans
*/
export const TeamStandardSubPlanItemSchema = z.object({ export const TeamStandardSubPlanItemSchema = z.object({
name: z.string().optional(), name: z.string().optional(),
desc: z.string().optional(), desc: z.string().optional(),
...@@ -71,6 +73,10 @@ export const SubPlanSchema = z.object({ ...@@ -71,6 +73,10 @@ export const SubPlanSchema = z.object({
}); });
export type SubPlanType = z.infer<typeof SubPlanSchema>; export type SubPlanType = z.infer<typeof SubPlanSchema>;
/**
* TeamSub Schema in DB.
* Configs are optional
*/
export const TeamSubSchema = z.object({ export const TeamSubSchema = z.object({
_id: ObjectIdSchema, _id: ObjectIdSchema,
teamId: ObjectIdSchema, teamId: ObjectIdSchema,
...@@ -105,9 +111,30 @@ export const TeamSubSchema = z.object({ ...@@ -105,9 +111,30 @@ export const TeamSubSchema = z.object({
}); });
export type TeamSubSchemaType = z.infer<typeof TeamSubSchema>; export type TeamSubSchemaType = z.infer<typeof TeamSubSchema>;
/**
* Merged plan type: combines DB subscription record metadata with effective plan limits
*
* Omits:
* - maxApp/maxDataset from TeamSubSchema: 这些字段在 DB 中存储,但在合并后的类型中使用 maxAppAmount/maxDatasetAmount
* - pointPrice from TeamStandardSubPlanItemSchema: 避免与 price 字段冲突
*
* Field priority: TeamStandardSubPlanItemSchema fields override TeamSubSchema fields when both exist
*/ export const TeamPlanStandardSchema = z.object({
...TeamSubSchema.omit({
maxApp: true,
maxDataset: true
}).shape,
...TeamStandardSubPlanItemSchema.omit({
pointPrice: true,
price: true
}).shape,
price: z.number().optional()
});
export type TeamPlanStandardType = z.infer<typeof TeamPlanStandardSchema>;
export const TeamPlanStatusSchema = z.object({ export const TeamPlanStatusSchema = z.object({
[SubTypeEnum.standard]: TeamSubSchema.optional(), [SubTypeEnum.standard]: TeamPlanStandardSchema.optional(),
standardConstants: TeamStandardSubPlanItemSchema.optional(),
totalPoints: z.int(), totalPoints: z.int(),
usedPoints: z.int(), usedPoints: z.int(),
datasetMaxSize: z.int() datasetMaxSize: z.int()
......
...@@ -25,7 +25,7 @@ export const checkTeamAIPoints = async (teamId: string) => { ...@@ -25,7 +25,7 @@ export const checkTeamAIPoints = async (teamId: string) => {
}; };
export const checkTeamMemberLimit = async (teamId: string, newCount: number) => { export const checkTeamMemberLimit = async (teamId: string, newCount: number) => {
const [{ standardConstants }, memberCount] = await Promise.all([ const [{ standard }, memberCount] = await Promise.all([
getTeamStandPlan({ getTeamStandPlan({
teamId teamId
}), }),
...@@ -35,7 +35,7 @@ export const checkTeamMemberLimit = async (teamId: string, newCount: number) => ...@@ -35,7 +35,7 @@ export const checkTeamMemberLimit = async (teamId: string, newCount: number) =>
}) })
]); ]);
if (standardConstants && newCount + memberCount > standardConstants.maxTeamMember) { if (standard?.maxTeamMember && newCount + memberCount > standard.maxTeamMember) {
return Promise.reject(TeamErrEnum.teamOverSize); return Promise.reject(TeamErrEnum.teamOverSize);
} }
}; };
...@@ -50,7 +50,7 @@ export const checkTeamAppTypeLimit = async ({ ...@@ -50,7 +50,7 @@ export const checkTeamAppTypeLimit = async ({
amount?: number; amount?: number;
}) => { }) => {
if (appCheckType === 'app') { if (appCheckType === 'app') {
const [{ standardConstants }, appCount] = await Promise.all([ const [{ standard }, appCount] = await Promise.all([
getTeamStandPlan({ teamId }), getTeamStandPlan({ teamId }),
MongoApp.countDocuments({ MongoApp.countDocuments({
teamId, teamId,
...@@ -60,7 +60,7 @@ export const checkTeamAppTypeLimit = async ({ ...@@ -60,7 +60,7 @@ export const checkTeamAppTypeLimit = async ({
}) })
]); ]);
if (standardConstants && appCount + amount > standardConstants.maxAppAmount) { if (standard?.maxAppAmount && appCount + amount > standard.maxAppAmount) {
return Promise.reject(TeamErrEnum.appAmountNotEnough); return Promise.reject(TeamErrEnum.appAmountNotEnough);
} }
...@@ -107,10 +107,10 @@ export const checkDatasetIndexLimit = async ({ ...@@ -107,10 +107,10 @@ export const checkDatasetIndexLimit = async ({
teamId: string; teamId: string;
insertLen?: number; insertLen?: number;
}) => { }) => {
const [{ standardConstants, totalPoints, usedPoints, datasetMaxSize }, usedDatasetIndexSize] = const [{ standard, totalPoints, usedPoints, datasetMaxSize }, usedDatasetIndexSize] =
await Promise.all([getTeamPlanStatus({ teamId }), getVectorCountByTeamId(teamId)]); await Promise.all([getTeamPlanStatus({ teamId }), getVectorCountByTeamId(teamId)]);
if (!standardConstants) return; if (!standard) return;
if (usedDatasetIndexSize + insertLen >= datasetMaxSize) { if (usedDatasetIndexSize + insertLen >= datasetMaxSize) {
return Promise.reject(TeamErrEnum.datasetSizeNotEnough); return Promise.reject(TeamErrEnum.datasetSizeNotEnough);
...@@ -123,7 +123,7 @@ export const checkDatasetIndexLimit = async ({ ...@@ -123,7 +123,7 @@ export const checkDatasetIndexLimit = async ({
}; };
export const checkTeamDatasetLimit = async (teamId: string) => { export const checkTeamDatasetLimit = async (teamId: string) => {
const [{ standardConstants }, datasetCount] = await Promise.all([ const [{ standard }, datasetCount] = await Promise.all([
getTeamStandPlan({ teamId }), getTeamStandPlan({ teamId }),
MongoDataset.countDocuments({ MongoDataset.countDocuments({
teamId, teamId,
...@@ -132,7 +132,7 @@ export const checkTeamDatasetLimit = async (teamId: string) => { ...@@ -132,7 +132,7 @@ export const checkTeamDatasetLimit = async (teamId: string) => {
]); ]);
// User check // User check
if (standardConstants && datasetCount >= standardConstants.maxDatasetAmount) { if (standard?.maxDatasetAmount && datasetCount >= standard.maxDatasetAmount) {
return Promise.reject(TeamErrEnum.datasetAmountNotEnough); return Promise.reject(TeamErrEnum.datasetAmountNotEnough);
} }
...@@ -148,11 +148,11 @@ export const checkTeamDatasetLimit = async (teamId: string) => { ...@@ -148,11 +148,11 @@ export const checkTeamDatasetLimit = async (teamId: string) => {
}; };
export const checkTeamDatasetSyncPermission = async (teamId: string) => { export const checkTeamDatasetSyncPermission = async (teamId: string) => {
const { standardConstants } = await getTeamStandPlan({ const { standard } = await getTeamStandPlan({
teamId teamId
}); });
if (standardConstants && !standardConstants?.websiteSyncPerDataset) { if (standard && !standard?.websiteSyncPerDataset) {
return Promise.reject(TeamErrEnum.websiteSyncNotEnough); return Promise.reject(TeamErrEnum.websiteSyncNotEnough);
} }
}; };
...@@ -39,14 +39,12 @@ const FileSelector = ({ ...@@ -39,14 +39,12 @@ const FileSelector = ({
// 文件大小限制(B):团队套餐 || 系统配置 || 默认值 // 文件大小限制(B):团队套餐 || 系统配置 || 默认值
const displayMaxSize = formatFileSize( const displayMaxSize = formatFileSize(
(teamPlanStatus?.standardConstants?.maxUploadFileSize || feConfigs.uploadFileMaxSize) * (teamPlanStatus?.standard?.maxUploadFileSize || feConfigs.uploadFileMaxSize) * 1024 * 1024
1024 *
1024
); );
// 文件数量限制:组件传入的maxCount || 团队套餐 || 系统配置 // 文件数量限制:组件传入的maxCount || 团队套餐 || 系统配置
const formatMaxCount = Math.min( const formatMaxCount = Math.min(
maxCount, maxCount,
teamPlanStatus?.standardConstants?.maxUploadFileCount || feConfigs.uploadFileMaxAmount teamPlanStatus?.standard?.maxUploadFileCount || feConfigs.uploadFileMaxAmount
); );
const { File, onOpen } = useSelectFile({ const { File, onOpen } = useSelectFile({
......
...@@ -44,7 +44,7 @@ const FileSelect = ({ ...@@ -44,7 +44,7 @@ const FileSelect = ({
// 文件数量限制:团队套餐 || 系统配置 || 默认值(这里是指对话中,最多上传多少文件) // 文件数量限制:团队套餐 || 系统配置 || 默认值(这里是指对话中,最多上传多少文件)
const maxSelectFiles = Math.min( const maxSelectFiles = Math.min(
teamPlanStatus?.standardConstants?.maxUploadFileCount || feConfigs.uploadFileMaxAmount, teamPlanStatus?.standard?.maxUploadFileCount || feConfigs.uploadFileMaxAmount,
50 50
); );
......
...@@ -94,12 +94,12 @@ const FileSelector = ({ ...@@ -94,12 +94,12 @@ const FileSelector = ({
// 文件数量限制:组件参数 || 团队套餐 || 系统配置 || 默认值 // 文件数量限制:组件参数 || 团队套餐 || 系统配置 || 默认值
const maxSelectFiles = const maxSelectFiles =
maxFiles || maxFiles ||
teamPlanStatus?.standardConstants?.maxUploadFileCount || teamPlanStatus?.standard?.maxUploadFileCount ||
feConfigs?.uploadFileMaxAmount || feConfigs?.uploadFileMaxAmount ||
10; 10;
// 文件大小限制(MB):团队套餐 || 系统配置 || 默认值 // 文件大小限制(MB):团队套餐 || 系统配置 || 默认值
const maxSize = const maxSize =
(teamPlanStatus?.standardConstants?.maxUploadFileSize || feConfigs?.uploadFileMaxSize || 500) * (teamPlanStatus?.standard?.maxUploadFileSize || feConfigs?.uploadFileMaxSize || 500) *
1024 * 1024 *
1024; 1024;
const canSelectFileAmount = maxSelectFiles - value.length; const canSelectFileAmount = maxSelectFiles - value.length;
......
...@@ -57,12 +57,12 @@ export const useFileUpload = (props: UseFileUploadOptions) => { ...@@ -57,12 +57,12 @@ export const useFileUpload = (props: UseFileUploadOptions) => {
// 文件数量限制:配置的maxFiles || 团队套餐 || 系统配置 || 默认值 // 文件数量限制:配置的maxFiles || 团队套餐 || 系统配置 || 默认值
const maxSelectFiles = const maxSelectFiles =
fileSelectConfig?.maxFiles || fileSelectConfig?.maxFiles ||
teamPlanStatus?.standardConstants?.maxUploadFileCount || teamPlanStatus?.standard?.maxUploadFileCount ||
feConfigs?.uploadFileMaxAmount || feConfigs?.uploadFileMaxAmount ||
10; 10;
// 文件大小限制(MB):团队套餐 || 系统配置 || 默认值 // 文件大小限制(MB):团队套餐 || 系统配置 || 默认值
const maxSize = const maxSize =
(teamPlanStatus?.standardConstants?.maxUploadFileSize || feConfigs?.uploadFileMaxSize || 500) * (teamPlanStatus?.standard?.maxUploadFileSize || feConfigs?.uploadFileMaxSize || 500) *
1024 * 1024 *
1024; 1024;
const canSelectFileAmount = maxSelectFiles - fileList.length; const canSelectFileAmount = maxSelectFiles - fileList.length;
......
...@@ -12,7 +12,7 @@ import Markdown from '@/components/Markdown'; ...@@ -12,7 +12,7 @@ import Markdown from '@/components/Markdown';
import MyPopover from '@fastgpt/web/components/common/MyPopover'; import MyPopover from '@fastgpt/web/components/common/MyPopover';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { formatFileSize } from '@fastgpt/global/common/file/tools'; import { formatFileSize } from '@fastgpt/global/common/file/tools';
import type { TeamSubSchemaType } from '@fastgpt/global/support/wallet/sub/type'; import type { TeamPlanStandardType } from '@fastgpt/global/support/wallet/sub/type';
const ModelPriceModal = dynamic(() => const ModelPriceModal = dynamic(() =>
import('@/components/core/ai/ModelTable').then((mod) => mod.ModelPriceModal) import('@/components/core/ai/ModelTable').then((mod) => mod.ModelPriceModal)
...@@ -25,7 +25,7 @@ const StandardPlanContentList = ({ ...@@ -25,7 +25,7 @@ const StandardPlanContentList = ({
}: { }: {
level: `${StandardSubLevelEnum}`; level: `${StandardSubLevelEnum}`;
mode: `${SubModeEnum}`; mode: `${SubModeEnum}`;
standplan?: TeamSubSchemaType; standplan?: TeamPlanStandardType;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
...@@ -58,8 +58,8 @@ const StandardPlanContentList = ({ ...@@ -58,8 +58,8 @@ const StandardPlanContentList = ({
: plan.totalPoints * (formatMode === SubModeEnum.month ? 1 : 12)), : plan.totalPoints * (formatMode === SubModeEnum.month ? 1 : 12)),
requestsPerMinute: standplan?.requestsPerMinute ?? plan.requestsPerMinute, requestsPerMinute: standplan?.requestsPerMinute ?? plan.requestsPerMinute,
maxTeamMember: standplan?.maxTeamMember ?? plan.maxTeamMember, maxTeamMember: standplan?.maxTeamMember ?? plan.maxTeamMember,
maxAppAmount: standplan?.maxApp ?? plan.maxAppAmount, maxAppAmount: standplan?.maxAppAmount ?? plan.maxAppAmount,
maxDatasetAmount: standplan?.maxDataset ?? plan.maxDatasetAmount, maxDatasetAmount: standplan?.maxDatasetAmount ?? plan.maxDatasetAmount,
maxDatasetSize: standplan?.maxDatasetSize ?? plan.maxDatasetSize, maxDatasetSize: standplan?.maxDatasetSize ?? plan.maxDatasetSize,
websiteSyncPerDataset: standplan?.websiteSyncPerDataset ?? plan.websiteSyncPerDataset, websiteSyncPerDataset: standplan?.websiteSyncPerDataset ?? plan.websiteSyncPerDataset,
chatHistoryStoreDuration: chatHistoryStoreDuration:
...@@ -84,8 +84,8 @@ const StandardPlanContentList = ({ ...@@ -84,8 +84,8 @@ const StandardPlanContentList = ({
standplan?.annualBonusPoints, standplan?.annualBonusPoints,
standplan?.requestsPerMinute, standplan?.requestsPerMinute,
standplan?.maxTeamMember, standplan?.maxTeamMember,
standplan?.maxApp, standplan?.maxAppAmount,
standplan?.maxDataset, standplan?.maxDatasetAmount,
standplan?.maxDatasetSize, standplan?.maxDatasetSize,
standplan?.websiteSyncPerDataset, standplan?.websiteSyncPerDataset,
standplan?.chatHistoryStoreDuration, standplan?.chatHistoryStoreDuration,
......
...@@ -124,7 +124,7 @@ const InputTypeConfig = ({ ...@@ -124,7 +124,7 @@ const InputTypeConfig = ({
const maxFiles = watch('maxFiles') ?? 5; const maxFiles = watch('maxFiles') ?? 5;
// 文件数量限制:团队套餐 || 系统配置 || 默认值 // 文件数量限制:团队套餐 || 系统配置 || 默认值
const maxSelectFiles = Math.min( const maxSelectFiles = Math.min(
teamPlanStatus?.standardConstants?.maxUploadFileCount || feConfigs.uploadFileMaxAmount, teamPlanStatus?.standard?.maxUploadFileCount || feConfigs.uploadFileMaxAmount,
50 50
); );
const canSelectFile = watch('canSelectFile') ?? true; const canSelectFile = watch('canSelectFile') ?? true;
......
...@@ -90,7 +90,7 @@ const TeamPlanStatusCard = () => { ...@@ -90,7 +90,7 @@ const TeamPlanStatusCard = () => {
setHiddenUntil(hideUntilTime); setHiddenUntil(hideUntilTime);
}, [setHiddenUntil, operationalAd]); }, [setHiddenUntil, operationalAd]);
if (!teamPlanStatus?.standardConstants) return null; if (!teamPlanStatus?.standard) return null;
return ( return (
<Box <Box
......
...@@ -35,10 +35,10 @@ const FileSelector = ({ ...@@ -35,10 +35,10 @@ const FileSelector = ({
// 文件数量限制:团队套餐 || 系统配置 || 默认值 // 文件数量限制:团队套餐 || 系统配置 || 默认值
const maxCount = const maxCount =
teamPlanStatus?.standardConstants?.maxUploadFileCount || feConfigs?.uploadFileMaxAmount || 1000; teamPlanStatus?.standard?.maxUploadFileCount || feConfigs?.uploadFileMaxAmount || 1000;
// 文件大小限制(bytes):优先级为 套餐限制 > 系统配置 > 默认值(500MB) // 文件大小限制(bytes):优先级为 套餐限制 > 系统配置 > 默认值(500MB)
const maxSize = const maxSize =
(teamPlanStatus?.standardConstants?.maxUploadFileSize ?? feConfigs?.uploadFileMaxSize ?? 500) * (teamPlanStatus?.standard?.maxUploadFileSize ?? feConfigs?.uploadFileMaxSize ?? 500) *
1024 * 1024 *
1024; 1024;
......
...@@ -6,7 +6,8 @@ import { StandardSubLevelEnum, SubModeEnum } from '@fastgpt/global/support/walle ...@@ -6,7 +6,8 @@ import { StandardSubLevelEnum, SubModeEnum } from '@fastgpt/global/support/walle
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { standardSubLevelMap } from '@fastgpt/global/support/wallet/sub/constants'; import { standardSubLevelMap } from '@fastgpt/global/support/wallet/sub/constants';
import { useRequest } from '@fastgpt/web/hooks/useRequest'; import { useRequest } from '@fastgpt/web/hooks/useRequest';
import { type TeamSubSchemaType } from '@fastgpt/global/support/wallet/sub/type'; import type { TeamPlanStandardType } from '@fastgpt/global/support/wallet/sub/type';
import QRCodePayModal, { type QRPayProps } from '@/components/support/wallet/QRCodePayModal'; import QRCodePayModal, { type QRPayProps } from '@/components/support/wallet/QRCodePayModal';
import { postCreatePayBill } from '@/web/support/wallet/bill/api'; import { postCreatePayBill } from '@/web/support/wallet/bill/api';
import { getDiscountCouponList } from '@/web/support/wallet/sub/discountCoupon/api'; import { getDiscountCouponList } from '@/web/support/wallet/sub/discountCoupon/api';
...@@ -35,7 +36,7 @@ const Standard = ({ ...@@ -35,7 +36,7 @@ const Standard = ({
standardPlan: myStandardPlan, standardPlan: myStandardPlan,
onPaySuccess onPaySuccess
}: { }: {
standardPlan?: TeamSubSchemaType; standardPlan?: TeamPlanStandardType;
onPaySuccess?: () => void; onPaySuccess?: () => void;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
...@@ -112,9 +113,9 @@ const Standard = ({ ...@@ -112,9 +113,9 @@ const Standard = ({
? value.wecom.price ? value.wecom.price
: value.price * (selectSubMode === SubModeEnum.month ? 1 : 10), : value.price * (selectSubMode === SubModeEnum.month ? 1 : 10),
level: level as `${StandardSubLevelEnum}`, level: level as `${StandardSubLevelEnum}`,
maxTeamMember: myStandardPlan?.maxTeamMember || value.maxTeamMember, maxTeamMember: myStandardPlan?.maxTeamMember ?? value.maxTeamMember,
maxAppAmount: myStandardPlan?.maxApp || value.maxAppAmount, maxAppAmount: myStandardPlan?.maxAppAmount ?? value.maxAppAmount,
maxDatasetAmount: myStandardPlan?.maxDataset || value.maxDatasetAmount, maxDatasetAmount: myStandardPlan?.maxDatasetAmount ?? value.maxDatasetAmount,
chatHistoryStoreDuration: value.chatHistoryStoreDuration, chatHistoryStoreDuration: value.chatHistoryStoreDuration,
maxDatasetSize: value.maxDatasetSize, maxDatasetSize: value.maxDatasetSize,
annualBonusPoints: selectSubMode === SubModeEnum.month ? 0 : value.annualBonusPoints, annualBonusPoints: selectSubMode === SubModeEnum.month ? 0 : value.annualBonusPoints,
...@@ -135,8 +136,8 @@ const Standard = ({ ...@@ -135,8 +136,8 @@ const Standard = ({
isWecomTeam, isWecomTeam,
selectSubMode, selectSubMode,
myStandardPlan?.maxTeamMember, myStandardPlan?.maxTeamMember,
myStandardPlan?.maxApp, myStandardPlan?.maxAppAmount,
myStandardPlan?.maxDataset myStandardPlan?.maxDatasetAmount
]); ]);
// Pay code // Pay code
......
...@@ -91,7 +91,7 @@ const CustomDomain = () => { ...@@ -91,7 +91,7 @@ const CustomDomain = () => {
<Box fontSize="20px" fontWeight="500"> <Box fontSize="20px" fontWeight="500">
{t('account:custom_domain')} {t('account:custom_domain')}
{customDomainList?.length ? ( {customDomainList?.length ? (
`: (${customDomainList.length}/${teamPlanStatus?.standardConstants?.customDomain})` `: (${customDomainList.length}/${teamPlanStatus?.standard?.customDomain})`
) : ( ) : (
<></> <></>
)} )}
......
...@@ -70,7 +70,7 @@ const ModelPriceModal = dynamic(() => ...@@ -70,7 +70,7 @@ const ModelPriceModal = dynamic(() =>
const Info = () => { const Info = () => {
const { isPc } = useSystem(); const { isPc } = useSystem();
const { teamPlanStatus, initUserInfo } = useUserStore(); const { teamPlanStatus, initUserInfo } = useUserStore();
const standardPlan = teamPlanStatus?.standardConstants; const standardPlan = teamPlanStatus?.standard;
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure(); const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
useMount(() => { useMount(() => {
...@@ -125,7 +125,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => { ...@@ -125,7 +125,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
const { reset } = useForm<UserUpdateParams>({ const { reset } = useForm<UserUpdateParams>({
defaultValues: userInfo as UserType defaultValues: userInfo as UserType
}); });
const standardPlan = teamPlanStatus?.standardConstants; const standardPlan = teamPlanStatus?.standard;
const { isPc } = useSystem(); const { isPc } = useSystem();
const { toast } = useToast(); const { toast } = useToast();
...@@ -389,11 +389,10 @@ const PlanUsage = () => { ...@@ -389,11 +389,10 @@ const PlanUsage = () => {
const standardPlan = teamPlanStatus?.standard; const standardPlan = teamPlanStatus?.standard;
const isFreeTeam = useMemo(() => { const isFreeTeam = useMemo(() => {
if (!teamPlanStatus || !teamPlanStatus?.standardConstants) return false; if (!teamPlanStatus || !teamPlanStatus?.standard) return false;
const hasExtraDatasetSize = const hasExtraDatasetSize =
teamPlanStatus.datasetMaxSize > teamPlanStatus.standardConstants.maxDatasetSize; teamPlanStatus.datasetMaxSize > teamPlanStatus.standard.maxDatasetSize;
const hasExtraPoints = const hasExtraPoints = teamPlanStatus.totalPoints > teamPlanStatus.standard.totalPoints;
teamPlanStatus.totalPoints > teamPlanStatus.standardConstants.totalPoints;
if ( if (
teamPlanStatus?.standard?.currentSubLevel === StandardSubLevelEnum.free && teamPlanStatus?.standard?.currentSubLevel === StandardSubLevelEnum.free &&
!hasExtraDatasetSize && !hasExtraDatasetSize &&
...@@ -449,38 +448,32 @@ const PlanUsage = () => { ...@@ -449,38 +448,32 @@ const PlanUsage = () => {
{ {
label: t('account_info:member_amount'), label: t('account_info:member_amount'),
value: teamPlanStatus.usedMember, value: teamPlanStatus.usedMember,
max: teamPlanStatus?.standardConstants?.maxTeamMember ?? t('account_info:unlimited'), max: teamPlanStatus?.standard?.maxTeamMember ?? t('account_info:unlimited'),
rate: rate: (teamPlanStatus.usedMember / (teamPlanStatus?.standard?.maxTeamMember || 1)) * 100
(teamPlanStatus.usedMember / (teamPlanStatus?.standardConstants?.maxTeamMember || 1)) *
100
}, },
{ {
label: t('account_info:app_amount'), label: t('account_info:app_amount'),
value: teamPlanStatus.usedAppAmount, value: teamPlanStatus.usedAppAmount,
max: teamPlanStatus?.standardConstants?.maxAppAmount ?? t('account_info:unlimited'), max: teamPlanStatus?.standard?.maxAppAmount ?? t('account_info:unlimited'),
rate: rate: (teamPlanStatus.usedAppAmount / (teamPlanStatus?.standard?.maxAppAmount || 1)) * 100
(teamPlanStatus.usedAppAmount / (teamPlanStatus?.standardConstants?.maxAppAmount || 1)) *
100
}, },
{ {
label: t('account_info:dataset_amount'), label: t('account_info:dataset_amount'),
value: teamPlanStatus.usedDatasetSize, value: teamPlanStatus.usedDatasetSize,
max: teamPlanStatus?.standardConstants?.maxDatasetAmount ?? t('account_info:unlimited'), max: teamPlanStatus?.standard?.maxDatasetAmount ?? t('account_info:unlimited'),
rate: rate:
(teamPlanStatus.usedDatasetSize / (teamPlanStatus.usedDatasetSize / (teamPlanStatus?.standard?.maxDatasetAmount || 1)) * 100
(teamPlanStatus?.standardConstants?.maxDatasetAmount || 1)) *
100
} }
]; ];
if (teamPlanStatus?.standardConstants?.appRegistrationCount) { if (teamPlanStatus?.standard?.appRegistrationCount) {
data.push({ data.push({
label: t('account_info:app_registration_count'), label: t('account_info:app_registration_count'),
value: teamPlanStatus.usedRegistrationCount || 0, value: teamPlanStatus.usedRegistrationCount || 0,
max: teamPlanStatus.standardConstants.appRegistrationCount, max: teamPlanStatus.standard.appRegistrationCount,
rate: rate:
((teamPlanStatus.usedRegistrationCount || 0) / ((teamPlanStatus.usedRegistrationCount || 0) /
teamPlanStatus.standardConstants.appRegistrationCount) * teamPlanStatus.standard.appRegistrationCount) *
100 100
}); });
} }
......
...@@ -60,7 +60,7 @@ async function handler( ...@@ -60,7 +60,7 @@ async function handler(
// 获取团队套餐信息 // 获取团队套餐信息
const teamPlanStatus = await getTeamPlanStatus({ teamId: String(app.teamId) }); const teamPlanStatus = await getTeamPlanStatus({ teamId: String(app.teamId) });
const appRegistrationLimit = teamPlanStatus?.standardConstants?.appRegistrationCount; const appRegistrationLimit = teamPlanStatus?.standard?.appRegistrationCount;
// 检查是否有配额限制 // 检查是否有配额限制
if (appRegistrationLimit && appRegistrationLimit > 0) { if (appRegistrationLimit && appRegistrationLimit > 0) {
......
...@@ -28,8 +28,7 @@ async function handler( ...@@ -28,8 +28,7 @@ async function handler(
await authFrequencyLimit({ await authFrequencyLimit({
eventId: `${tmbId}-uploadfile`, eventId: `${tmbId}-uploadfile`,
maxAmount: maxAmount: planStatus.standard?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
planStatus.standardConstants?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
expiredTime: addSeconds(new Date(), 30) // 30s expiredTime: addSeconds(new Date(), 30) // 30s
}); });
...@@ -40,8 +39,7 @@ async function handler( ...@@ -40,8 +39,7 @@ async function handler(
{ rawKey: fileKey, filename }, { rawKey: fileKey, filename },
{ {
expiredHours: 1, expiredHours: 1,
maxFileSize: maxFileSize: planStatus.standard?.maxUploadFileSize || global.feConfigs.uploadFileMaxSize
planStatus.standardConstants?.maxUploadFileSize || global.feConfigs.uploadFileMaxSize
} }
); );
} }
......
...@@ -24,8 +24,7 @@ async function handler( ...@@ -24,8 +24,7 @@ async function handler(
const planStatus = await getTeamPlanStatus({ teamId }); const planStatus = await getTeamPlanStatus({ teamId });
await authFrequencyLimit({ await authFrequencyLimit({
eventId: `${uid}-uploadfile`, eventId: `${uid}-uploadfile`,
maxAmount: maxAmount: planStatus.standard?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
planStatus.standardConstants?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
expiredTime: addSeconds(new Date(), 30) // 30s expiredTime: addSeconds(new Date(), 30) // 30s
}); });
...@@ -34,8 +33,7 @@ async function handler( ...@@ -34,8 +33,7 @@ async function handler(
chatId, chatId,
filename, filename,
uId: uid, uId: uid,
maxFileSize: maxFileSize: planStatus.standard?.maxUploadFileSize || global.feConfigs.uploadFileMaxSize
planStatus.standardConstants?.maxUploadFileSize || global.feConfigs.uploadFileMaxSize
}); });
} }
......
...@@ -42,8 +42,7 @@ async function handler( ...@@ -42,8 +42,7 @@ async function handler(
const planStatus = await getTeamPlanStatus({ teamId }); const planStatus = await getTeamPlanStatus({ teamId });
await authFrequencyLimit({ await authFrequencyLimit({
eventId: `${tmbId}-uploadfile`, eventId: `${tmbId}-uploadfile`,
maxAmount: maxAmount: planStatus.standard?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
planStatus.standardConstants?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
expiredTime: addSeconds(new Date(), 30), // 30s expiredTime: addSeconds(new Date(), 30), // 30s
num: result.fileMetadata.length num: result.fileMetadata.length
}); });
......
...@@ -49,8 +49,7 @@ async function handler( ...@@ -49,8 +49,7 @@ async function handler(
const planStatus = await getTeamPlanStatus({ teamId }); const planStatus = await getTeamPlanStatus({ teamId });
await authFrequencyLimit({ await authFrequencyLimit({
eventId: `${tmbId}-uploadfile`, eventId: `${tmbId}-uploadfile`,
maxAmount: maxAmount: planStatus.standard?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
planStatus.standardConstants?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
expiredTime: addSeconds(new Date(), 30), // 30s expiredTime: addSeconds(new Date(), 30), // 30s
num: result.fileMetadata.length num: result.fileMetadata.length
}); });
......
...@@ -25,16 +25,14 @@ async function handler( ...@@ -25,16 +25,14 @@ async function handler(
const planStatus = await getTeamPlanStatus({ teamId }); const planStatus = await getTeamPlanStatus({ teamId });
await authFrequencyLimit({ await authFrequencyLimit({
eventId: `${userId}-uploadfile`, eventId: `${userId}-uploadfile`,
maxAmount: maxAmount: planStatus.standard?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
planStatus.standardConstants?.maxUploadFileCount || global.feConfigs.uploadFileMaxAmount,
expiredTime: addSeconds(new Date(), 30) // 30s expiredTime: addSeconds(new Date(), 30) // 30s
}); });
return await getS3DatasetSource().createUploadDatasetFileURL({ return await getS3DatasetSource().createUploadDatasetFileURL({
datasetId, datasetId,
filename, filename,
maxFileSize: maxFileSize: planStatus.standard?.maxUploadFileSize || global.feConfigs.uploadFileMaxSize
planStatus.standardConstants?.maxUploadFileSize || global.feConfigs.uploadFileMaxSize
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment