mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
4.8.12 test fix (#2988)
* perf: qps limit * perf: http response data * perf: json path check * fix: ts * loop support reference parent variable
This commit is contained in:
@@ -37,5 +37,6 @@ FE_DOMAIN=http://localhost:3000
|
||||
LOG_LEVEL=debug
|
||||
STORE_LOG_LEVEL=warn
|
||||
|
||||
# 安全配置
|
||||
# 工作流最大运行次数,避免极端的死循环情况
|
||||
WORKFLOW_MAX_RUN_TIMES=500
|
@@ -33,79 +33,6 @@ enum CronJobTypeEnum {
|
||||
}
|
||||
type CronType = 'month' | 'week' | 'day' | 'interval';
|
||||
|
||||
const get24HoursOptions = () => {
|
||||
return Array.from({ length: 24 }, (_, i) => ({
|
||||
label: `${i < 10 ? '0' : ''}${i}:00`,
|
||||
value: i
|
||||
}));
|
||||
};
|
||||
|
||||
const getRoute = (i: number) => {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return 'app:week.Sunday';
|
||||
case 1:
|
||||
return 'app:week.Monday';
|
||||
case 2:
|
||||
return 'app:week.Tuesday';
|
||||
case 3:
|
||||
return 'app:week.Wednesday';
|
||||
case 4:
|
||||
return 'app:week.Thursday';
|
||||
case 5:
|
||||
return 'app:week.Friday';
|
||||
case 6:
|
||||
return 'app:week.Saturday';
|
||||
default:
|
||||
return 'app:week.Sunday';
|
||||
}
|
||||
};
|
||||
|
||||
const getWeekOptions = () => {
|
||||
return Array.from({ length: 7 }, (_, i) => {
|
||||
return {
|
||||
label: i18nT(getRoute(i)),
|
||||
value: i,
|
||||
children: get24HoursOptions()
|
||||
};
|
||||
});
|
||||
};
|
||||
const getMonthOptions = () => {
|
||||
return Array.from({ length: 28 }, (_, i) => ({
|
||||
label: `${i + 1}` + i18nT('app:month.unit'),
|
||||
value: i,
|
||||
children: get24HoursOptions()
|
||||
}));
|
||||
};
|
||||
const getInterValOptions = () => {
|
||||
// 每n小时
|
||||
return [
|
||||
{
|
||||
label: i18nT('app:interval.per_hour'),
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: i18nT('app:interval.2_hours'),
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: i18nT('app:interval.3_hours'),
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: i18nT('app:interval.4_hours'),
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: i18nT('app:interval.6_hours'),
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: i18nT('app:interval.12_hours'),
|
||||
value: 12
|
||||
}
|
||||
];
|
||||
};
|
||||
const defaultValue = ['day', 0, 0];
|
||||
const defaultCronString = '0 0 * * *';
|
||||
|
||||
@@ -125,6 +52,81 @@ const ScheduledTriggerConfig = ({
|
||||
const cronString = value?.cronString;
|
||||
const defaultPrompt = value?.defaultPrompt;
|
||||
|
||||
const get24HoursOptions = () => {
|
||||
return Array.from({ length: 24 }, (_, i) => ({
|
||||
label: `${i < 10 ? '0' : ''}${i}:00`,
|
||||
value: i
|
||||
}));
|
||||
};
|
||||
|
||||
const getRoute = (i: number) => {
|
||||
const { t } = useTranslation();
|
||||
switch (i) {
|
||||
case 0:
|
||||
return t('app:week.Sunday');
|
||||
case 1:
|
||||
return t('app:week.Monday');
|
||||
case 2:
|
||||
return t('app:week.Tuesday');
|
||||
case 3:
|
||||
return t('app:week.Wednesday');
|
||||
case 4:
|
||||
return t('app:week.Thursday');
|
||||
case 5:
|
||||
return t('app:week.Friday');
|
||||
case 6:
|
||||
return t('app:week.Saturday');
|
||||
default:
|
||||
return t('app:week.Sunday');
|
||||
}
|
||||
};
|
||||
|
||||
const getWeekOptions = () => {
|
||||
return Array.from({ length: 7 }, (_, i) => {
|
||||
return {
|
||||
label: getRoute(i),
|
||||
value: i,
|
||||
children: get24HoursOptions()
|
||||
};
|
||||
});
|
||||
};
|
||||
const getMonthOptions = () => {
|
||||
return Array.from({ length: 28 }, (_, i) => ({
|
||||
label: `${i + 1}` + t('app:month.unit'),
|
||||
value: i,
|
||||
children: get24HoursOptions()
|
||||
}));
|
||||
};
|
||||
const getInterValOptions = () => {
|
||||
// 每n小时
|
||||
return [
|
||||
{
|
||||
label: t('app:interval.per_hour'),
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: t('app:interval.2_hours'),
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: t('app:interval.3_hours'),
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: t('app:interval.4_hours'),
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
label: t('app:interval.6_hours'),
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
label: t('app:interval.12_hours'),
|
||||
value: 12
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
const cronSelectList = useRef<MultipleSelectProps['list']>([
|
||||
{
|
||||
label: t('app:cron.every_day'),
|
||||
|
@@ -14,6 +14,7 @@ import {
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
|
||||
import { useReqFrequencyLimit } from '@fastgpt/service/common/middle/reqFrequencyLimit';
|
||||
|
||||
async function handler(req: NextApiRequest) {
|
||||
const {
|
||||
@@ -98,4 +99,4 @@ async function handler(req: NextApiRequest) {
|
||||
};
|
||||
}
|
||||
|
||||
export default NextAPI(handler);
|
||||
export default NextAPI(useReqFrequencyLimit(1, 2), handler);
|
||||
|
@@ -3,6 +3,7 @@ export const getDocPath = (path: string) => {
|
||||
const feConfigs = useSystemStore.getState().feConfigs;
|
||||
|
||||
if (!feConfigs?.docUrl) return '';
|
||||
if (!path.startsWith('/')) return path;
|
||||
if (feConfigs.docUrl.endsWith('/')) return feConfigs.docUrl.slice(0, -1);
|
||||
return feConfigs.docUrl + path;
|
||||
};
|
||||
|
@@ -193,10 +193,11 @@ export const computedNodeInputReference = ({
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
const parentId = node.parentNodeId;
|
||||
let sourceNodes: FlowNodeItemType[] = [];
|
||||
// 根据 edge 获取所有的 source 节点(source节点会继续向前递归获取)
|
||||
const findSourceNode = (nodeId: string) => {
|
||||
const targetEdges = edges.filter((item) => item.target === nodeId);
|
||||
const targetEdges = edges.filter((item) => item.target === nodeId || item.target === parentId);
|
||||
targetEdges.forEach((edge) => {
|
||||
const sourceNode = nodes.find((item) => item.nodeId === edge.source);
|
||||
if (!sourceNode) return;
|
||||
|
Reference in New Issue
Block a user