mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-05 01:02:59 +08:00
feat: workflow presentation ui (#6156)
* icon & gradient * line & header ui * basic presentation mode * ui & icon * node * fix * source color schema * delete code * fix build * fix * fix * fix icon * function position
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { NodeGradients, NodeBorderColors } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { AppToolSourceEnum } from '@fastgpt/global/core/app/tool/constants';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
|
||||
const getColorSchemaBySource = (source: AppToolSourceEnum) => {
|
||||
if (source === AppToolSourceEnum.http || source === AppToolSourceEnum.mcp) {
|
||||
return 'salmon';
|
||||
}
|
||||
if (
|
||||
source === AppToolSourceEnum.commercial ||
|
||||
source === AppToolSourceEnum.community ||
|
||||
source === AppToolSourceEnum.systemTool
|
||||
) {
|
||||
return 'gray';
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const getGradientByColorSchema = ({
|
||||
colorSchema,
|
||||
source
|
||||
}: {
|
||||
colorSchema?: keyof typeof NodeGradients;
|
||||
source: AppToolSourceEnum;
|
||||
}): string | undefined => {
|
||||
const sourceColor = getColorSchemaBySource(source);
|
||||
if (sourceColor) {
|
||||
return NodeGradients[sourceColor];
|
||||
}
|
||||
if (!colorSchema) return undefined;
|
||||
return NodeGradients[colorSchema];
|
||||
};
|
||||
|
||||
export const getBorderColorByColorSchema = ({
|
||||
colorSchema,
|
||||
source
|
||||
}: {
|
||||
colorSchema?: keyof typeof NodeBorderColors;
|
||||
source: AppToolSourceEnum;
|
||||
}): string | undefined => {
|
||||
const sourceColor = getColorSchemaBySource(source);
|
||||
if (sourceColor) {
|
||||
return NodeBorderColors[sourceColor];
|
||||
}
|
||||
if (!colorSchema) return undefined;
|
||||
return NodeBorderColors[colorSchema];
|
||||
};
|
||||
|
||||
export const getColorSchemaByFlowNodeType = (
|
||||
flowNodeType: FlowNodeTypeEnum
|
||||
): keyof typeof NodeGradients | undefined => {
|
||||
if (flowNodeType === FlowNodeTypeEnum.toolSet || flowNodeType === FlowNodeTypeEnum.pluginModule) {
|
||||
return 'salmon';
|
||||
}
|
||||
if (flowNodeType === FlowNodeTypeEnum.appModule) {
|
||||
return 'skyBlue';
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
Reference in New Issue
Block a user