mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
fix: ts
This commit is contained in:
25
.github/workflows/fastgpt-image.yml
vendored
25
.github/workflows/fastgpt-image.yml
vendored
@@ -77,3 +77,28 @@ jobs:
|
|||||||
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
|
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
|
||||||
- name: Push image to Docker Hub
|
- name: Push image to Docker Hub
|
||||||
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
|
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
|
||||||
|
push-to-ali-hub:
|
||||||
|
needs: build-fastgpt-images
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Login to Ali Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: registry.cn-hangzhou.aliyuncs.com
|
||||||
|
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||||
|
- name: Set DOCKER_REPO_TAGGED based on branch or tag
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||||
|
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Pull image from GitHub Container Registry
|
||||||
|
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
|
||||||
|
- name: Tag image with Docker Hub repository name and version tag
|
||||||
|
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}:${{env.IMAGE_TAG}}
|
||||||
|
- name: Push image to Docker Hub
|
||||||
|
run: docker push ${{ secrets.ALI_IMAGE_NAME }}:${{env.IMAGE_TAG}}
|
||||||
|
@@ -3,10 +3,8 @@ import type { KbItemType } from '@/types/plugin';
|
|||||||
export const defaultKbDetail: KbItemType = {
|
export const defaultKbDetail: KbItemType = {
|
||||||
_id: '',
|
_id: '',
|
||||||
userId: '',
|
userId: '',
|
||||||
updateTime: new Date(),
|
|
||||||
avatar: '/icon/logo.svg',
|
avatar: '/icon/logo.svg',
|
||||||
name: '',
|
name: '',
|
||||||
tags: '',
|
tags: '',
|
||||||
totalData: 0,
|
vectorModelName: 'text-embedding-ada-002'
|
||||||
model: 'text-embedding-ada-002'
|
|
||||||
};
|
};
|
||||||
|
@@ -40,7 +40,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
|||||||
return getVector({
|
return getVector({
|
||||||
userId,
|
userId,
|
||||||
input: [q],
|
input: [q],
|
||||||
model: kb.model
|
model: kb.vectorModel
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return { vectors: [[]] };
|
return { vectors: [[]] };
|
||||||
|
@@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';
|
|||||||
import { jsonRes } from '@/service/response';
|
import { jsonRes } from '@/service/response';
|
||||||
import { connectToDatabase, KB } from '@/service/mongo';
|
import { connectToDatabase, KB } from '@/service/mongo';
|
||||||
import { authUser } from '@/service/utils/auth';
|
import { authUser } from '@/service/utils/auth';
|
||||||
import type { KbUpdateParams } from '@/api/plugins/kb';
|
import type { KbUpdateParams } from '@/api/request/kb';
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||||
try {
|
try {
|
||||||
|
@@ -56,7 +56,6 @@ const InputDataModal = ({
|
|||||||
};
|
};
|
||||||
const { insertLen } = await postKbDataFromList({
|
const { insertLen } = await postKbDataFromList({
|
||||||
kbId,
|
kbId,
|
||||||
model: vectorModelList[0].model,
|
|
||||||
mode: TrainingModeEnum.index,
|
mode: TrainingModeEnum.index,
|
||||||
data: [data]
|
data: [data]
|
||||||
});
|
});
|
||||||
|
@@ -92,9 +92,9 @@ export const sseResponse = ({
|
|||||||
/* add logger */
|
/* add logger */
|
||||||
export const addLog = {
|
export const addLog = {
|
||||||
info: (msg: string, obj?: Record<string, any>) => {
|
info: (msg: string, obj?: Record<string, any>) => {
|
||||||
global.logger.info(msg, { meta: obj });
|
global.logger?.info(msg, { meta: obj });
|
||||||
},
|
},
|
||||||
error: (msg: string, obj?: Record<string, any>) => {
|
error: (msg: string, obj?: Record<string, any>) => {
|
||||||
global.logger.error(msg, { meta: obj });
|
global.logger?.error(msg, { meta: obj });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user