From fc9e614f88bf431c70c6197bd996051f2f666232 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Thu, 27 Feb 2025 22:15:48 +0800 Subject: [PATCH] 4.8.23 dev (#3917) * fix: icon refresh * fix: aiproxy http request * fix: collection list count * fix: collection list count * fix: tts selector name * update action --- .github/workflows/fastgpt-preview-image.yml | 11 ----------- .github/workflows/helm-release.yaml | 4 ++-- packages/service/common/mongo/index.ts | 8 +++++--- packages/web/components/common/Icon/index.tsx | 6 +++--- projects/app/src/components/core/app/TTSSelect.tsx | 2 +- projects/app/src/pages/api/aiproxy/[...path].ts | 8 ++++++-- .../src/pages/api/core/dataset/collection/listV2.ts | 3 ++- 7 files changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/fastgpt-preview-image.yml b/.github/workflows/fastgpt-preview-image.yml index 03d426304..3fcaf1c1f 100644 --- a/.github/workflows/fastgpt-preview-image.yml +++ b/.github/workflows/fastgpt-preview-image.yml @@ -68,14 +68,3 @@ jobs: SEALOS_TYPE: 'pr_comment' SEALOS_FILENAME: 'report.md' SEALOS_REPLACE_TAG: 'DEFAULT_REPLACE_DEPLOY' - - helm-check: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Helm Check - run: | - helm dependency update files/helm/fastgpt - helm lint files/helm/fastgpt - helm package files/helm/fastgpt diff --git a/.github/workflows/helm-release.yaml b/.github/workflows/helm-release.yaml index 8b5897170..25f7fb771 100644 --- a/.github/workflows/helm-release.yaml +++ b/.github/workflows/helm-release.yaml @@ -24,6 +24,6 @@ jobs: export APP_VERSION=${{ steps.vars.outputs.tag }} export HELM_VERSION=${{ steps.vars.outputs.tag }} export HELM_REPO=ghcr.io/${{ github.repository_owner }} - helm dependency update files/helm/fastgpt - helm package files/helm/fastgpt --version ${HELM_VERSION}-helm --app-version ${APP_VERSION} -d bin + helm dependency update deploy/helm/fastgpt + helm package deploy/helm/fastgpt --version ${HELM_VERSION}-helm --app-version ${APP_VERSION} -d bin helm push bin/fastgpt-${HELM_VERSION}-helm.tgz oci://${HELM_REPO} diff --git a/packages/service/common/mongo/index.ts b/packages/service/common/mongo/index.ts index 09235bb16..02b4213e6 100644 --- a/packages/service/common/mongo/index.ts +++ b/packages/service/common/mongo/index.ts @@ -38,10 +38,12 @@ const addCommonMiddleware = (schema: mongoose.Schema) => { schema.post(op, function (this: any, result: any, next) { if (this._startTime) { const duration = Date.now() - this._startTime; - const warnLogData = { - query: this._query, - op, + collectionName: this.collection?.name, + op: this.op, + ...(this._query && { query: this._query }), + ...(this._update && { update: this._update }), + ...(this._delete && { delete: this._delete }), duration }; diff --git a/packages/web/components/common/Icon/index.tsx b/packages/web/components/common/Icon/index.tsx index aedc7ef14..663826591 100644 --- a/packages/web/components/common/Icon/index.tsx +++ b/packages/web/components/common/Icon/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import type { IconProps } from '@chakra-ui/react'; import { Box, Icon } from '@chakra-ui/react'; import { iconPaths } from './constants'; @@ -8,7 +8,7 @@ import { useRefresh } from '../../../hooks/useRefresh'; const iconCache: Record = {}; const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType } & IconProps) => { - const { refresh } = useRefresh(); + const [, setUpdate] = useState(0); useEffect(() => { if (iconCache[name]) { @@ -20,7 +20,7 @@ const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType const component = { as: icon.default }; // Store in cache iconCache[name] = component; - refresh(); + setUpdate((prev) => prev + 1); // force update }) .catch((error) => console.log(error)); }, [name]); diff --git a/projects/app/src/components/core/app/TTSSelect.tsx b/projects/app/src/components/core/app/TTSSelect.tsx index 8b6fecd02..50c26c66a 100644 --- a/projects/app/src/components/core/app/TTSSelect.tsx +++ b/projects/app/src/components/core/app/TTSSelect.tsx @@ -42,7 +42,7 @@ const TTSSelect = ({ label: ( - {t(providerData.name)} + {t(model.name as any)} ), value: model.model, diff --git a/projects/app/src/pages/api/aiproxy/[...path].ts b/projects/app/src/pages/api/aiproxy/[...path].ts index 127044ad2..f63d7500c 100644 --- a/projects/app/src/pages/api/aiproxy/[...path].ts +++ b/projects/app/src/pages/api/aiproxy/[...path].ts @@ -1,6 +1,7 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { jsonRes } from '@fastgpt/service/common/response'; -import { request } from 'https'; +import { request as httpsRequest } from 'https'; +import { request as httpRequest } from 'http'; import { authSystemAdmin } from '@fastgpt/service/support/permission/user/auth'; const baseUrl = process.env.AIPROXY_API_ENDPOINT; @@ -30,7 +31,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) delete req.headers?.host; delete req.headers?.origin; - const requestResult = request({ + // Select request function based on protocol + const requestFn = parsedUrl.protocol === 'https:' ? httpsRequest : httpRequest; + + const requestResult = requestFn({ protocol: parsedUrl.protocol, hostname: parsedUrl.hostname, port: parsedUrl.port, diff --git a/projects/app/src/pages/api/core/dataset/collection/listV2.ts b/projects/app/src/pages/api/core/dataset/collection/listV2.ts index 535af97aa..b92e02d56 100644 --- a/projects/app/src/pages/api/core/dataset/collection/listV2.ts +++ b/projects/app/src/pages/api/core/dataset/collection/listV2.ts @@ -14,6 +14,7 @@ import { PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { parsePaginationRequest } from '@fastgpt/service/common/api/pagination'; import { DatasetCollectionSchemaType } from '@fastgpt/global/core/dataset/type'; import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema'; +import { MongoDatasetTraining } from '@fastgpt/service/core/dataset/training/schema'; async function handler( req: NextApiRequest @@ -115,7 +116,7 @@ async function handler( { _id: string; count: number }[], { _id: string; count: number }[] ] = await Promise.all([ - MongoDatasetCollection.aggregate( + MongoDatasetTraining.aggregate( [ { $match: {