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:
@@ -4,10 +4,12 @@ import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import { TrackEventName } from '@/web/common/system/constants';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
|
||||
function Error() {
|
||||
const router = useRouter();
|
||||
const { lastRoute } = useSystemStore();
|
||||
const { toast } = useToast();
|
||||
const { lastRoute, llmModelList, embeddingModelList } = useSystemStore();
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
@@ -20,8 +22,34 @@ function Error() {
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
let modelError = false;
|
||||
if (llmModelList.length === 0) {
|
||||
modelError = true;
|
||||
toast({
|
||||
title: '未配置语言模型',
|
||||
status: 'error'
|
||||
});
|
||||
} else if (!llmModelList.some((item) => item.datasetProcess)) {
|
||||
modelError = true;
|
||||
toast({
|
||||
title: '未配置知识库文件处理模型',
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
if (embeddingModelList.length === 0) {
|
||||
modelError = true;
|
||||
toast({
|
||||
title: '未配置索引模型',
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
router.back();
|
||||
if (modelError) {
|
||||
router.push('/account/model');
|
||||
} else {
|
||||
router.push('/app/list');
|
||||
}
|
||||
}, 2000);
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -227,12 +227,7 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
|
||||
});
|
||||
}
|
||||
);
|
||||
let chatDetailsStr = '';
|
||||
try {
|
||||
chatDetailsStr = JSON.stringify(chatDetails).replace(/"/g, '""').replace(/\n/g, '\\n');
|
||||
} catch (e) {
|
||||
addLog.error(`export chat logs error`, e);
|
||||
}
|
||||
let chatDetailsStr = JSON.stringify(chatDetails).replace(/"/g, '""').replace(/\n/g, '\\n');
|
||||
|
||||
const res = `\n"${time}","${source}","${tmb}","${title}","${messageCount}","${userFeedbackCount}","${customFeedbacksCount}","${markCount}","${chatDetailsStr}"`;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import type { InitChatResponse, InitOutLinkChatProps } from '@/global/core/chat/api.d';
|
||||
import type { InitOutLinkChatProps } from '@/global/core/chat/api.d';
|
||||
import { getGuideModule, getAppChatConfig } from '@fastgpt/global/core/workflow/utils';
|
||||
import { authOutLink } from '@/service/support/permission/auth/outLink';
|
||||
import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
@@ -39,29 +38,27 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
nodes?.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput)?.inputs ??
|
||||
[];
|
||||
|
||||
jsonRes<InitChatResponse>(res, {
|
||||
data: {
|
||||
chatId,
|
||||
appId: app._id,
|
||||
title: chat?.title,
|
||||
userAvatar: getRandomUserAvatar(),
|
||||
variables: chat?.variables,
|
||||
app: {
|
||||
chatConfig: getAppChatConfig({
|
||||
chatConfig,
|
||||
systemConfigNode: getGuideModule(nodes),
|
||||
storeVariables: chat?.variableList,
|
||||
storeWelcomeText: chat?.welcomeText,
|
||||
isPublicFetch: false
|
||||
}),
|
||||
name: app.name,
|
||||
avatar: app.avatar,
|
||||
intro: app.intro,
|
||||
type: app.type,
|
||||
pluginInputs
|
||||
}
|
||||
return {
|
||||
chatId,
|
||||
appId: app._id,
|
||||
title: chat?.title,
|
||||
userAvatar: getRandomUserAvatar(),
|
||||
variables: chat?.variables,
|
||||
app: {
|
||||
chatConfig: getAppChatConfig({
|
||||
chatConfig,
|
||||
systemConfigNode: getGuideModule(nodes),
|
||||
storeVariables: chat?.variableList,
|
||||
storeWelcomeText: chat?.welcomeText,
|
||||
isPublicFetch: false
|
||||
}),
|
||||
name: app.name,
|
||||
avatar: app.avatar,
|
||||
intro: app.intro,
|
||||
type: app.type,
|
||||
pluginInputs
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export default NextAPI(handler);
|
||||
|
||||
@@ -117,7 +117,8 @@ async function handler(req: ApiRequestProps<rebuildEmbeddingBody>): Promise<Resp
|
||||
billId,
|
||||
mode: TrainingModeEnum.chunk,
|
||||
model: vectorModel,
|
||||
dataId: data._id
|
||||
dataId: data._id,
|
||||
retryCount: 50
|
||||
}
|
||||
],
|
||||
{
|
||||
|
||||
@@ -111,11 +111,6 @@ const OutLink = (props: Props) => {
|
||||
{
|
||||
manual: false,
|
||||
refreshDeps: [shareId, outLinkAuthData, chatId],
|
||||
onError(e: any) {
|
||||
if (chatId) {
|
||||
onChangeChatId('');
|
||||
}
|
||||
},
|
||||
onFinally() {
|
||||
forbidLoadChat.current = false;
|
||||
}
|
||||
@@ -333,11 +328,11 @@ const Render = (props: Props) => {
|
||||
return () => {
|
||||
setOutLinkAuthData({});
|
||||
};
|
||||
}, [chatHistoryProviderParams.outLinkUid, setOutLinkAuthData, shareId]);
|
||||
}, [chatHistoryProviderParams.outLinkUid, shareId]);
|
||||
// Watch appId
|
||||
useEffect(() => {
|
||||
setAppId(appId);
|
||||
}, [appId, setAppId]);
|
||||
}, [appId]);
|
||||
|
||||
return source === ChatSourceEnum.share ? (
|
||||
<ChatContextProvider params={chatHistoryProviderParams}>
|
||||
|
||||
Reference in New Issue
Block a user