mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
4.8.11 perf (#2832)
* save toast * perf: surya ocr * perf: remove same model name * fix: indexes * perf: ip check * feat: Fixed the version number of the subapplication * feat: simple app get latest child version * perf: update child dispatch variables * feat: variables update doc
This commit is contained in:
@@ -24,9 +24,6 @@ const I18nLngSelector = () => {
|
||||
|
||||
return (
|
||||
<MySelect
|
||||
_hover={{
|
||||
bg: 'myGray.200'
|
||||
}}
|
||||
value={i18n.language}
|
||||
list={list}
|
||||
onchange={(val: any) => {
|
||||
|
@@ -2,7 +2,7 @@ import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/nex
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { authApp } from '@fastgpt/service/support/permission/app/auth';
|
||||
import { WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
|
||||
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
|
||||
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
|
||||
import { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
|
@@ -21,7 +21,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>): Promise<
|
||||
versionName
|
||||
} = req.body as PostPublishAppProps;
|
||||
|
||||
const { app, tmbId } = await authApp({ appId, req, per: WritePermissionVal, authToken: true });
|
||||
const { tmbId } = await authApp({ appId, req, per: WritePermissionVal, authToken: true });
|
||||
|
||||
const { nodes: formatNodes } = beforeUpdateAppFormat({ nodes });
|
||||
|
||||
|
@@ -6,7 +6,7 @@ import { getChatModelNameListByModules } from '@/service/core/app/workflow';
|
||||
import type { InitChatProps, InitChatResponse } from '@/global/core/chat/api.d';
|
||||
import { MongoChat } from '@fastgpt/service/core/chat/chatSchema';
|
||||
import { ChatErrEnum } from '@fastgpt/global/common/error/code/chat';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
@@ -15,7 +15,7 @@ async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
): Promise<InitChatResponse | void> {
|
||||
let { appId, chatId, loadCustomFeedbacks } = req.query as InitChatProps;
|
||||
let { appId, chatId } = req.query as InitChatProps;
|
||||
|
||||
if (!appId) {
|
||||
return jsonRes(res, {
|
||||
|
@@ -9,7 +9,7 @@ import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
import { AppErrEnum } from '@fastgpt/global/common/error/code/app';
|
||||
import { MongoChat } from '@fastgpt/service/core/chat/chatSchema';
|
||||
import { ChatErrEnum } from '@fastgpt/global/common/error/code/chat';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
|
||||
|
@@ -9,7 +9,7 @@ import { AppErrEnum } from '@fastgpt/global/common/error/code/app';
|
||||
import { authTeamSpaceToken } from '@/service/support/permission/auth/team';
|
||||
import { MongoTeam } from '@fastgpt/service/support/user/team/teamSchema';
|
||||
import { ChatErrEnum } from '@fastgpt/global/common/error/code/chat';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
|
||||
|
@@ -46,7 +46,7 @@ import { AIChatItemType, UserChatItemType } from '@fastgpt/global/core/chat/type
|
||||
import { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
||||
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/controller';
|
||||
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import {
|
||||
|
@@ -72,7 +72,8 @@ const SaveButton = ({
|
||||
toast({
|
||||
status: 'success',
|
||||
title: t('app:saved_success'),
|
||||
position: 'top-right'
|
||||
position: 'top-right',
|
||||
isClosable: true
|
||||
});
|
||||
onClose();
|
||||
setIsSave(false);
|
||||
|
@@ -92,10 +92,6 @@ const NodeCard = (props: Props) => {
|
||||
return { node, parentNode };
|
||||
}, [nodeList, nodeId]);
|
||||
|
||||
const { openConfirm: onOpenConfirmSync, ConfirmModal: ConfirmSyncModal } = useConfirm({
|
||||
content: t('app:module.Confirm Sync')
|
||||
});
|
||||
|
||||
const { data: nodeTemplate, runAsync: getNodeLatestTemplate } = useRequest2(
|
||||
async () => {
|
||||
if (
|
||||
@@ -125,6 +121,10 @@ const NodeCard = (props: Props) => {
|
||||
manual: false
|
||||
}
|
||||
);
|
||||
|
||||
const { openConfirm: onOpenConfirmSync, ConfirmModal: ConfirmSyncModal } = useConfirm({
|
||||
content: t('workflow:Confirm_sync_node')
|
||||
});
|
||||
const hasNewVersion = nodeTemplate && nodeTemplate.version !== node?.version;
|
||||
|
||||
const { runAsync: onClickSyncVersion } = useRequest2(
|
||||
@@ -264,7 +264,6 @@ const NodeCard = (props: Props) => {
|
||||
<MenuRender nodeId={nodeId} menuForbid={menuForbid} nodeList={nodeList} />
|
||||
<NodeIntro nodeId={nodeId} intro={intro} />
|
||||
</Box>
|
||||
<ConfirmSyncModal />
|
||||
</Box>
|
||||
);
|
||||
}, [
|
||||
@@ -282,11 +281,11 @@ const NodeCard = (props: Props) => {
|
||||
menuForbid,
|
||||
nodeList,
|
||||
intro,
|
||||
ConfirmSyncModal,
|
||||
onChangeNode,
|
||||
onOpenCustomTitleModal,
|
||||
toast
|
||||
]);
|
||||
|
||||
const RenderHandle = useMemo(() => {
|
||||
return (
|
||||
<>
|
||||
@@ -342,6 +341,7 @@ const NodeCard = (props: Props) => {
|
||||
{RenderHandle}
|
||||
{RenderToolHandle}
|
||||
|
||||
<ConfirmSyncModal />
|
||||
<EditTitleModal maxLength={20} />
|
||||
</Flex>
|
||||
);
|
||||
@@ -384,7 +384,12 @@ const MenuRender = React.memo(function MenuRender({
|
||||
pluginId: node.data.pluginId,
|
||||
version: node.data.version
|
||||
};
|
||||
return state.concat(
|
||||
|
||||
return [
|
||||
...state.map((item) => ({
|
||||
...item,
|
||||
selected: false
|
||||
})),
|
||||
storeNode2FlowNode({
|
||||
item: {
|
||||
flowNodeType: template.flowNodeType,
|
||||
@@ -403,7 +408,7 @@ const MenuRender = React.memo(function MenuRender({
|
||||
parentNodeId: undefined,
|
||||
t
|
||||
})
|
||||
);
|
||||
];
|
||||
});
|
||||
},
|
||||
[computedNewNodeName, setNodes, t]
|
||||
|
@@ -55,17 +55,6 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => {
|
||||
defaultValue: true
|
||||
});
|
||||
|
||||
const checkIpInChina = useCallback(
|
||||
() =>
|
||||
GET(ipDetectURL).then((res: any) => {
|
||||
const country = res?.country;
|
||||
if (country && country === '中国' && res.city !== '中国香港') {
|
||||
onOpenRedirect();
|
||||
}
|
||||
}),
|
||||
[onOpenRedirect]
|
||||
);
|
||||
|
||||
const loginSuccess = useCallback(
|
||||
(res: ResLogin) => {
|
||||
// init store
|
||||
@@ -101,10 +90,27 @@ const Login = ({ ChineseRedirectUrl }: { ChineseRedirectUrl: string }) => {
|
||||
);
|
||||
}, [feConfigs.oauth]);
|
||||
|
||||
const checkIpInChina = useCallback(async () => {
|
||||
try {
|
||||
const res = await GET<any>(ipDetectURL);
|
||||
const country = res?.country;
|
||||
if (
|
||||
country &&
|
||||
country === '中国' &&
|
||||
res.prov !== '中国香港' &&
|
||||
res.prov !== '中国澳门' &&
|
||||
res.prov !== '中国台湾'
|
||||
) {
|
||||
onOpenRedirect();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}, [onOpenRedirect]);
|
||||
useMount(() => {
|
||||
clearToken();
|
||||
ChineseRedirectUrl && showRedirect && checkIpInChina();
|
||||
router.prefetch('/app/list');
|
||||
ChineseRedirectUrl && showRedirect && checkIpInChina();
|
||||
});
|
||||
|
||||
return (
|
||||
|
@@ -2,10 +2,12 @@ import { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import type { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node.d';
|
||||
|
||||
export const getChatModelNameListByModules = (nodes: StoreNodeItemType[]): string[] => {
|
||||
return nodes
|
||||
const modelList = nodes
|
||||
.map((item) => {
|
||||
const model = item.inputs.find((input) => input.key === NodeInputKeyEnum.aiModel)?.value;
|
||||
return global.llmModels.find((item) => item.model === model)?.name || '';
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
return Array.from(new Set(modelList));
|
||||
};
|
||||
|
2
projects/app/src/types/index.d.ts
vendored
2
projects/app/src/types/index.d.ts
vendored
@@ -22,7 +22,7 @@ export type RequestPaging = { pageNum: number; pageSize: number; [key]: any };
|
||||
declare global {
|
||||
var qaQueueLen: number;
|
||||
var vectorQueueLen: number;
|
||||
var geoip2: any;
|
||||
|
||||
interface Window {
|
||||
grecaptcha: any;
|
||||
QRCode: any;
|
||||
|
@@ -7,6 +7,7 @@ import {
|
||||
import { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node.d';
|
||||
import {
|
||||
chatHistoryValueDesc,
|
||||
defaultNodeVersion,
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '@fastgpt/global/core/workflow/node/constant';
|
||||
@@ -195,7 +196,7 @@ export function form2AppWorkflow(
|
||||
x: 918.5901682164496,
|
||||
y: -227.11542247619582
|
||||
},
|
||||
version: '481',
|
||||
version: DatasetSearchModule.version,
|
||||
inputs: [
|
||||
{
|
||||
key: 'datasets',
|
||||
@@ -377,7 +378,8 @@ export function form2AppWorkflow(
|
||||
x: 500 + 500 * (i + 1),
|
||||
y: 545
|
||||
},
|
||||
version: tool.version,
|
||||
// 这里不需要固定版本,给一个不存在的版本,每次都会用最新版
|
||||
version: defaultNodeVersion,
|
||||
inputs: tool.inputs.map((input) => {
|
||||
// Special key value
|
||||
if (input.key === NodeInputKeyEnum.forbidStream) {
|
||||
|
Reference in New Issue
Block a user