perf: request quantity;perf: share page error circulation;perf: share chat toast (#3763)

* model config

* feat: normalization embedding

* perf: share page error circulation

* perf: request quantity

* perf: share chat toast

* perf: queue
This commit is contained in:
Archer
2025-02-12 11:36:29 +08:00
committed by GitHub
parent 116936ffa9
commit 58f715e878
16 changed files with 132 additions and 159 deletions

View File

@@ -10,7 +10,6 @@ import { Prompt_AgentQA } from '@fastgpt/global/core/ai/prompt/agent';
import type { PushDatasetDataChunkProps } from '@fastgpt/global/core/dataset/api.d';
import { getLLMModel } from '@fastgpt/service/core/ai/model';
import { checkTeamAiPointsAndLock } from './utils';
import { checkInvalidChunkAndLock } from '@fastgpt/service/core/dataset/training/utils';
import { addMinutes } from 'date-fns';
import {
countGptMessagesTokens,
@@ -168,13 +167,9 @@ ${replaceVariable(Prompt_AgentQA.fixedText, { text })}`;
reduceQueue();
generateQA();
} catch (err: any) {
addLog.error(`[QA Queue] Error`);
addLog.error(`[QA Queue] Error`, err);
reduceQueue();
if (await checkInvalidChunkAndLock({ err, data, errText: 'QA模型调用失败' })) {
return generateQA();
}
setTimeout(() => {
generateQA();
}, 1000);

View File

@@ -3,7 +3,6 @@ import { MongoDatasetTraining } from '@fastgpt/service/core/dataset/training/sch
import { TrainingModeEnum } from '@fastgpt/global/core/dataset/constants';
import { pushGenerateVectorUsage } from '@/service/support/wallet/usage/push';
import { checkTeamAiPointsAndLock } from './utils';
import { checkInvalidChunkAndLock } from '@fastgpt/service/core/dataset/training/utils';
import { addMinutes } from 'date-fns';
import { addLog } from '@fastgpt/service/common/system/log';
import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema';
@@ -126,10 +125,6 @@ export async function generateVector(): Promise<any> {
addLog.error(`[Vector Queue] Error`, err);
reduceQueue();
if (await checkInvalidChunkAndLock({ err, data, errText: '向量模型调用失败' })) {
return generateVector();
}
setTimeout(() => {
generateVector();
}, 1000);
@@ -193,7 +188,8 @@ const rebuildData = async ({
billId: trainingData.billId,
mode: TrainingModeEnum.chunk,
model: trainingData.model,
dataId: newRebuildingData._id
dataId: newRebuildingData._id,
retryCount: 50
}
],
{ session }

View File

@@ -63,8 +63,8 @@ export async function authChatCrud({
authType: AuthUserTypeEnum.teamDomain
};
const chat = await MongoChat.findOne({ appId, chatId, outLinkUid: uid }).lean();
if (!chat)
const chat = await MongoChat.findOne({ appId, chatId }).lean();
if (!chat) {
return {
teamId: spaceTeamId,
tmbId,
@@ -72,6 +72,9 @@ export async function authChatCrud({
...defaultResponseShow,
authType: AuthUserTypeEnum.teamDomain
};
}
if (chat.outLinkUid !== uid) return Promise.reject(ChatErrEnum.unAuthChat);
return {
teamId: spaceTeamId,
@@ -104,7 +107,8 @@ export async function authChatCrud({
};
}
const chat = await MongoChat.findOne({ appId, chatId, outLinkUid: uid }).lean();
const chat = await MongoChat.findOne({ appId, chatId }).lean();
if (!chat) {
return {
teamId: String(outLinkConfig.teamId),
@@ -116,6 +120,7 @@ export async function authChatCrud({
authType: AuthUserTypeEnum.outLink
};
}
if (chat.outLinkUid !== uid) return Promise.reject(ChatErrEnum.unAuthChat);
return {
teamId: String(outLinkConfig.teamId),
tmbId: String(outLinkConfig.tmbId),