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

@@ -88,7 +88,7 @@ try {
ChatSchema.index({ appId: 1, chatId: 1 });
// get chat logs;
ChatSchema.index({ teamId: 1, appId: 1, updateTime: -1 });
ChatSchema.index({ teamId: 1, appId: 1, updateTime: -1, sources: 1 });
// get share chat history
ChatSchema.index({ shareId: 1, outLinkUid: 1, updateTime: -1 });

View File

@@ -1,45 +1,5 @@
import { DatasetTrainingSchemaType } from '@fastgpt/global/core/dataset/type';
import { addLog } from '../../../common/system/log';
import { getErrText } from '@fastgpt/global/common/error/utils';
import { MongoDatasetTraining } from './schema';
import Papa from 'papaparse';
export const checkInvalidChunkAndLock = async ({
err,
errText,
data
}: {
err: any;
errText: string;
data: DatasetTrainingSchemaType;
}) => {
if (err?.response) {
addLog.error(`openai error: ${errText}`, {
status: err.response?.status,
statusText: err.response?.statusText,
data: err.response?.data
});
} else {
addLog.error(getErrText(err, errText), err);
}
if (
err?.message === 'invalid message format' ||
err?.type === 'invalid_request_error' ||
err?.code === 500
) {
addLog.error('Lock training data', err);
try {
await MongoDatasetTraining.findByIdAndUpdate(data._id, {
lockTime: new Date('2998/5/5')
});
} catch (error) {}
return true;
}
return false;
};
export const parseCsvTable2Chunks = (rawText: string) => {
const csvArr = Papa.parse(rawText).data as string[][];

View File

@@ -53,7 +53,7 @@ export function usePagination<DataT, ResT = {}>(
const isEmpty = total === 0 && !isLoading;
const noMore = data.length >= totalDataLength;
const fetchData = useLockFn(
const fetchData = useMemoizedFn(
async (num: number = pageNum, ScrollContainerRef?: RefObject<HTMLDivElement>) => {
if (noMore && num !== 1) return;
setTrue();
@@ -99,11 +99,12 @@ export function usePagination<DataT, ResT = {}>(
onChange?.(num);
} catch (error: any) {
toast({
title: getErrText(error, t('common:core.chat.error.data_error')),
status: 'error'
});
console.log(error);
if (error.code !== 'ERR_CANCELED') {
toast({
title: getErrText(error, t('common:core.chat.error.data_error')),
status: 'error'
});
}
}
setFalse();
@@ -246,7 +247,6 @@ export function usePagination<DataT, ResT = {}>(
// Reload data
const { runAsync: refresh } = useRequest(
async () => {
setData([]);
defaultRequest && fetchData(1);
},
{