mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
4.8 preview (#1288)
* Revert "lafAccount add pat & re request when token invalid (#76)" (#77) This reverts commit 83d85dfe37adcaef4833385ea52ee79fd84720be. * perf: workflow ux * system config * Newflow (#89) * docs: Add doc for Xinference (#1266) Signed-off-by: Carson Yang <yangchuansheng33@gmail.com> * Revert "lafAccount add pat & re request when token invalid (#76)" (#77) This reverts commit 83d85dfe37adcaef4833385ea52ee79fd84720be. * perf: workflow ux * system config * Revert "lafAccount add pat & re request when token invalid (#76)" (#77) This reverts commit 83d85dfe37adcaef4833385ea52ee79fd84720be. * Revert "lafAccount add pat & re request when token invalid (#76)" (#77) This reverts commit 83d85dfe37adcaef4833385ea52ee79fd84720be. * Revert "lafAccount add pat & re request when token invalid (#76)" (#77) This reverts commit 83d85dfe37adcaef4833385ea52ee79fd84720be. * rename code * move code * update flow * input type selector * perf: workflow runtime * feat: node adapt newflow * feat: adapt plugin * feat: 360 connection * check workflow * perf: flow 性能 * change plugin input type (#81) * change plugin input type * plugin label mode * perf: nodecard * debug * perf: debug ui * connection ui * change workflow ui (#82) * feat: workflow debug * adapt openAPI for new workflow (#83) * adapt openAPI for new workflow * i18n * perf: plugin debug * plugin input ui * delete * perf: global variable select * fix rebase * perf: workflow performance * feat: input render type icon * input icon * adapt flow (#84) * adapt newflow * temp * temp * fix * feat: app schedule trigger * feat: app schedule trigger * perf: schedule ui * feat: ioslatevm run js code * perf: workflow varialbe table ui * feat: adapt simple mode * feat: adapt input params * output * feat: adapt tamplate * fix: ts * add if-else module (#86) * perf: worker * if else node * perf: tiktoken worker * fix: ts * perf: tiktoken * fix if-else node (#87) * fix if-else node * type * fix * perf: audio render * perf: Parallel worker * log * perf: if else node * adapt plugin * prompt * perf: reference ui * reference ui * handle ux * template ui and plugin tool * adapt v1 workflow * adapt v1 workflow completions * perf: time variables * feat: workflow keyboard shortcuts * adapt v1 workflow * update workflow example doc (#88) * fix: simple mode select tool --------- Signed-off-by: Carson Yang <yangchuansheng33@gmail.com> Co-authored-by: Carson Yang <yangchuansheng33@gmail.com> Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com> * doc * perf: extract node * extra node field * update plugin version * doc * variable * change doc & fix prompt editor (#90) * fold workflow code * value type label --------- Signed-off-by: Carson Yang <yangchuansheng33@gmail.com> Co-authored-by: Carson Yang <yangchuansheng33@gmail.com> Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -1,31 +1,4 @@
|
||||
import { ModuleItemType } from '../module/type';
|
||||
|
||||
export const defaultModules: ModuleItemType[] = [
|
||||
{
|
||||
moduleId: 'custom-output',
|
||||
name: '自定义输出',
|
||||
flowType: 'pluginOutput',
|
||||
showStatus: false,
|
||||
position: {
|
||||
x: 994.1266684738011,
|
||||
y: -45.87689365278443
|
||||
},
|
||||
inputs: [],
|
||||
outputs: []
|
||||
},
|
||||
{
|
||||
moduleId: 'custom-input',
|
||||
name: '自定义输入',
|
||||
flowType: 'pluginInput',
|
||||
showStatus: false,
|
||||
position: {
|
||||
x: 457.57860319995154,
|
||||
y: -44.25099042468186
|
||||
},
|
||||
inputs: [],
|
||||
outputs: []
|
||||
}
|
||||
];
|
||||
import { StoreNodeItemType } from '../workflow/type';
|
||||
|
||||
export enum PluginTypeEnum {
|
||||
folder = 'folder',
|
||||
|
8
packages/global/core/plugin/controller.d.ts
vendored
8
packages/global/core/plugin/controller.d.ts
vendored
@@ -1,4 +1,5 @@
|
||||
import type { ModuleItemType } from '../module/type.d';
|
||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||
import type { StoreNodeItemType } from '../workflow/type';
|
||||
import { PluginTypeEnum } from './constants';
|
||||
import { HttpAuthMethodType } from './httpPlugin/type';
|
||||
|
||||
@@ -6,7 +7,7 @@ export type CreateOnePluginParams = {
|
||||
name: string;
|
||||
avatar: string;
|
||||
intro: string;
|
||||
modules: ModuleItemType[];
|
||||
modules: StoreNodeItemType[];
|
||||
parentId: string | null;
|
||||
type: `${PluginTypeEnum}`;
|
||||
metadata?: {
|
||||
@@ -20,7 +21,8 @@ export type UpdatePluginParams = {
|
||||
name?: string;
|
||||
avatar?: string;
|
||||
intro?: string;
|
||||
modules?: ModuleItemType[];
|
||||
modules?: StoreNodeItemType[];
|
||||
edges?: StoreEdgeItemType[];
|
||||
metadata?: {
|
||||
apiSchemaStr?: string;
|
||||
customHeaders?: string;
|
||||
|
@@ -3,15 +3,15 @@ import { OpenApiJsonSchema } from './type';
|
||||
import yaml from 'js-yaml';
|
||||
import { OpenAPIV3 } from 'openapi-types';
|
||||
import { PluginTypeEnum } from '../constants';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../module/node/type';
|
||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../module/node/constant';
|
||||
import { ModuleIOValueTypeEnum } from '../../module/constants';
|
||||
import { PluginInputModule } from '../../module/template/system/pluginInput';
|
||||
import { PluginOutputModule } from '../../module/template/system/pluginOutput';
|
||||
import { HttpModule468 } from '../../module/template/system/http468';
|
||||
import { HttpParamAndHeaderItemType } from '../../module/api';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io.d';
|
||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
||||
import { NodeInputKeyEnum, WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
||||
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
||||
import { HttpModule468 } from '../../workflow/template/system/http468';
|
||||
import { HttpParamAndHeaderItemType } from '../../workflow/api';
|
||||
import { CreateOnePluginParams } from '../controller';
|
||||
import { ModuleItemType } from '../../module/type';
|
||||
import { StoreNodeItemType } from '../../workflow/type';
|
||||
import { HttpImgUrl } from '../../../common/file/image/constants';
|
||||
import SwaggerParser from '@apidevtools/swagger-parser';
|
||||
|
||||
@@ -74,6 +74,9 @@ export const httpApiSchema2Plugins = async ({
|
||||
return jsonSchema.pathData.map((item) => {
|
||||
const pluginOutputId = getNanoid();
|
||||
const httpId = getNanoid();
|
||||
const pluginInputId = getNanoid();
|
||||
const inputIdMap = new Map();
|
||||
|
||||
const pluginOutputKey = 'result';
|
||||
|
||||
const properties = item.request?.content?.['application/json']?.schema?.properties;
|
||||
@@ -83,12 +86,13 @@ export const httpApiSchema2Plugins = async ({
|
||||
...(item.params?.map((param: any) => {
|
||||
return {
|
||||
key: param.name,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
valueType: param.schema.type,
|
||||
label: param.name,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
required: param.required,
|
||||
description: param.description,
|
||||
edit: true,
|
||||
toolDescription: param.description,
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
name: true,
|
||||
@@ -97,21 +101,20 @@ export const httpApiSchema2Plugins = async ({
|
||||
dataType: true,
|
||||
inputType: true,
|
||||
isToolInput: true
|
||||
},
|
||||
connected: true,
|
||||
toolDescription: param.description
|
||||
}
|
||||
};
|
||||
}) || []),
|
||||
...(propsKeys?.map((key) => {
|
||||
const prop = properties[key];
|
||||
return {
|
||||
key,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
valueType: prop.type,
|
||||
label: key,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
required: false,
|
||||
description: prop.description,
|
||||
edit: true,
|
||||
toolDescription: prop.description,
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
name: true,
|
||||
@@ -120,42 +123,33 @@ export const httpApiSchema2Plugins = async ({
|
||||
dataType: true,
|
||||
inputType: true,
|
||||
isToolInput: true
|
||||
},
|
||||
connected: true,
|
||||
toolDescription: prop.description
|
||||
}
|
||||
};
|
||||
}) || [])
|
||||
];
|
||||
|
||||
const pluginOutputs: FlowNodeOutputItemType[] = [
|
||||
...(item.params?.map((param: any) => {
|
||||
const id = getNanoid();
|
||||
inputIdMap.set(param.name, id);
|
||||
return {
|
||||
id,
|
||||
key: param.name,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
valueType: param.schema.type,
|
||||
label: param.name,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: [
|
||||
{
|
||||
moduleId: httpId,
|
||||
key: param.name
|
||||
}
|
||||
]
|
||||
type: FlowNodeOutputTypeEnum.source
|
||||
};
|
||||
}) || []),
|
||||
...(propsKeys?.map((key) => {
|
||||
const id = getNanoid();
|
||||
inputIdMap.set(key, id);
|
||||
return {
|
||||
id,
|
||||
key,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
valueType: properties[key].type,
|
||||
label: key,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: [
|
||||
{
|
||||
moduleId: httpId,
|
||||
key
|
||||
}
|
||||
]
|
||||
edit: true
|
||||
};
|
||||
}) || [])
|
||||
];
|
||||
@@ -164,34 +158,29 @@ export const httpApiSchema2Plugins = async ({
|
||||
...(item.params?.map((param: any) => {
|
||||
return {
|
||||
key: param.name,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
valueType: param.schema.type,
|
||||
label: param.name,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
description: param.description,
|
||||
edit: true,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
description: true,
|
||||
dataType: true
|
||||
valueType: true
|
||||
},
|
||||
connected: true
|
||||
value: [pluginInputId, inputIdMap.get(param.name)]
|
||||
};
|
||||
}) || []),
|
||||
...(propsKeys?.map((key) => {
|
||||
const prop = properties[key];
|
||||
return {
|
||||
key,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
valueType: properties[key].type,
|
||||
label: key,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
description: prop.description,
|
||||
edit: true,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
description: true,
|
||||
dataType: true
|
||||
valueType: true
|
||||
},
|
||||
connected: true
|
||||
value: [pluginInputId, inputIdMap.get(key)]
|
||||
};
|
||||
}) || [])
|
||||
];
|
||||
@@ -207,7 +196,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
if (param.in === 'header') {
|
||||
httpNodeHeaders.push({
|
||||
key: param.name,
|
||||
type: param.schema?.type || ModuleIOValueTypeEnum.string,
|
||||
type: param.schema?.type || WorkflowIOValueTypeEnum.string,
|
||||
value: `{{${param.name}}}`
|
||||
});
|
||||
} else if (param.in === 'body') {
|
||||
@@ -219,7 +208,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
} else if (param.in === 'query') {
|
||||
httpNodeParams.push({
|
||||
key: param.name,
|
||||
type: param.schema?.type || ModuleIOValueTypeEnum.string,
|
||||
type: param.schema?.type || WorkflowIOValueTypeEnum.string,
|
||||
value: `{{${param.name}}}`
|
||||
});
|
||||
}
|
||||
@@ -250,7 +239,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
for (const key in headersObj) {
|
||||
httpNodeHeaders.push({
|
||||
key,
|
||||
type: 'string',
|
||||
type: WorkflowIOValueTypeEnum.string,
|
||||
// @ts-ignore
|
||||
value: headersObj[key]
|
||||
});
|
||||
@@ -258,57 +247,27 @@ export const httpApiSchema2Plugins = async ({
|
||||
}
|
||||
|
||||
/* Combine complete modules */
|
||||
const modules: ModuleItemType[] = [
|
||||
const modules: StoreNodeItemType[] = [
|
||||
{
|
||||
moduleId: getNanoid(),
|
||||
nodeId: pluginInputId,
|
||||
name: PluginInputModule.name,
|
||||
intro: PluginInputModule.intro,
|
||||
avatar: PluginInputModule.avatar,
|
||||
flowType: PluginInputModule.flowType,
|
||||
flowNodeType: PluginInputModule.flowNodeType,
|
||||
showStatus: PluginInputModule.showStatus,
|
||||
position: {
|
||||
x: 616.4226348688949,
|
||||
y: -165.05298493910115
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'pluginStart',
|
||||
type: 'hidden',
|
||||
valueType: 'boolean',
|
||||
label: '插件开始运行',
|
||||
description:
|
||||
'插件开始运行时,会输出一个 True 的标识。有时候,插件不会有额外的的输入,为了顺利的进入下一个阶段,你可以将该值连接到下一个节点的触发器中。',
|
||||
showTargetInApp: true,
|
||||
showTargetInPlugin: true,
|
||||
connected: true
|
||||
},
|
||||
...pluginInputs
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'pluginStart',
|
||||
label: '插件开始运行',
|
||||
type: 'source',
|
||||
valueType: 'boolean',
|
||||
targets:
|
||||
pluginOutputs.length === 0
|
||||
? [
|
||||
{
|
||||
moduleId: httpId,
|
||||
key: 'switch'
|
||||
}
|
||||
]
|
||||
: []
|
||||
},
|
||||
...pluginOutputs
|
||||
]
|
||||
inputs: pluginInputs,
|
||||
outputs: pluginOutputs
|
||||
},
|
||||
{
|
||||
moduleId: pluginOutputId,
|
||||
nodeId: pluginOutputId,
|
||||
name: PluginOutputModule.name,
|
||||
intro: PluginOutputModule.intro,
|
||||
avatar: PluginOutputModule.avatar,
|
||||
flowType: PluginOutputModule.flowType,
|
||||
flowNodeType: PluginOutputModule.flowNodeType,
|
||||
showStatus: PluginOutputModule.showStatus,
|
||||
position: {
|
||||
x: 1607.7142331269126,
|
||||
@@ -317,40 +276,36 @@ export const httpApiSchema2Plugins = async ({
|
||||
inputs: [
|
||||
{
|
||||
key: pluginOutputKey,
|
||||
valueType: 'string',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: pluginOutputKey,
|
||||
type: 'target',
|
||||
required: true,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
required: false,
|
||||
description: '',
|
||||
edit: true,
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
name: true,
|
||||
description: true,
|
||||
required: false,
|
||||
dataType: true,
|
||||
inputType: false
|
||||
valueType: true
|
||||
},
|
||||
connected: true
|
||||
value: [httpId, 'httpRawResponse']
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: pluginOutputId,
|
||||
key: pluginOutputKey,
|
||||
valueType: 'string',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: pluginOutputKey,
|
||||
type: 'source',
|
||||
edit: true,
|
||||
targets: []
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: httpId,
|
||||
nodeId: httpId,
|
||||
name: HttpModule468.name,
|
||||
intro: HttpModule468.intro,
|
||||
avatar: HttpModule468.avatar,
|
||||
flowType: HttpModule468.flowType,
|
||||
flowNodeType: HttpModule468.flowNodeType,
|
||||
showStatus: true,
|
||||
position: {
|
||||
x: 1042.549746602742,
|
||||
@@ -358,153 +313,79 @@ export const httpApiSchema2Plugins = async ({
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'switch',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.switch',
|
||||
description: 'core.module.input.description.Trigger',
|
||||
valueType: 'any',
|
||||
showTargetInApp: true,
|
||||
showTargetInPlugin: true,
|
||||
connected: false
|
||||
key: NodeInputKeyEnum.addInputParam,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.addInputParam],
|
||||
valueType: WorkflowIOValueTypeEnum.dynamic,
|
||||
label: '',
|
||||
required: false,
|
||||
description: 'core.module.input.description.HTTP Dynamic Input',
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
}
|
||||
},
|
||||
...httpInputs,
|
||||
{
|
||||
key: 'system_httpMethod',
|
||||
type: 'custom',
|
||||
valueType: 'string',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '',
|
||||
value: item.method.toUpperCase(),
|
||||
required: true,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
connected: false
|
||||
required: true
|
||||
},
|
||||
{
|
||||
key: 'system_httpReqUrl',
|
||||
type: 'hidden',
|
||||
valueType: 'string',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '',
|
||||
description: 'core.module.input.description.Http Request Url',
|
||||
placeholder: 'https://api.ai.com/getInventory',
|
||||
required: false,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
value: requestUrl,
|
||||
connected: false
|
||||
value: requestUrl
|
||||
},
|
||||
{
|
||||
key: 'system_httpHeader',
|
||||
type: 'custom',
|
||||
valueType: 'any',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
value: httpNodeHeaders,
|
||||
label: '',
|
||||
description: 'core.module.input.description.Http Request Header',
|
||||
placeholder: 'core.module.input.description.Http Request Header',
|
||||
required: false,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
connected: false
|
||||
required: false
|
||||
},
|
||||
{
|
||||
key: 'system_httpParams',
|
||||
type: 'hidden',
|
||||
valueType: 'any',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
value: httpNodeParams,
|
||||
label: '',
|
||||
required: false,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
connected: false
|
||||
required: false
|
||||
},
|
||||
{
|
||||
key: 'system_httpJsonBody',
|
||||
type: 'hidden',
|
||||
valueType: 'any',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
value: httpNodeBody,
|
||||
label: '',
|
||||
required: false,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'DYNAMIC_INPUT_KEY',
|
||||
type: 'target',
|
||||
valueType: 'any',
|
||||
label: 'core.module.inputType.dynamicTargetInput',
|
||||
description: 'core.module.input.description.dynamic input',
|
||||
required: false,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: true,
|
||||
hideInApp: true,
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'system_addInputParam',
|
||||
type: 'addInputParam',
|
||||
valueType: 'any',
|
||||
label: '',
|
||||
required: false,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false,
|
||||
editField: {
|
||||
key: true,
|
||||
description: true,
|
||||
dataType: true
|
||||
},
|
||||
defaultEditField: {
|
||||
label: '',
|
||||
key: '',
|
||||
description: '',
|
||||
inputType: 'target',
|
||||
valueType: 'string'
|
||||
},
|
||||
connected: false
|
||||
},
|
||||
...httpInputs
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'finish',
|
||||
label: 'core.module.output.label.running done',
|
||||
description: 'core.module.output.description.running done',
|
||||
valueType: 'boolean',
|
||||
type: 'source',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'httpRawResponse',
|
||||
label: '原始响应',
|
||||
description: 'HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。',
|
||||
valueType: 'any',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: pluginOutputId,
|
||||
key: pluginOutputKey
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'system_addOutputParam',
|
||||
type: 'addOutputParam',
|
||||
valueType: 'any',
|
||||
label: '',
|
||||
targets: [],
|
||||
editField: {
|
||||
key: true,
|
||||
description: true,
|
||||
dataType: true,
|
||||
defaultValue: true
|
||||
},
|
||||
defaultEditField: {
|
||||
label: '',
|
||||
key: '',
|
||||
description: '',
|
||||
outputType: 'source',
|
||||
valueType: 'string'
|
||||
}
|
||||
required: false
|
||||
}
|
||||
]
|
||||
],
|
||||
outputs: HttpModule468.outputs
|
||||
}
|
||||
];
|
||||
|
||||
const edges = [
|
||||
{
|
||||
source: pluginInputId,
|
||||
target: httpId,
|
||||
sourcePort: `${pluginInputId}-source-right`,
|
||||
targetPort: `${httpId}-target-left`
|
||||
},
|
||||
{
|
||||
source: httpId,
|
||||
target: pluginOutputId,
|
||||
sourcePort: `${httpId}-source-right`,
|
||||
targetPort: `${pluginOutputId}-target-left`
|
||||
}
|
||||
];
|
||||
|
||||
@@ -514,7 +395,8 @@ export const httpApiSchema2Plugins = async ({
|
||||
intro: item.description,
|
||||
parentId,
|
||||
type: PluginTypeEnum.http,
|
||||
modules
|
||||
modules,
|
||||
edges
|
||||
};
|
||||
});
|
||||
};
|
||||
|
13
packages/global/core/plugin/type.d.ts
vendored
13
packages/global/core/plugin/type.d.ts
vendored
@@ -1,5 +1,6 @@
|
||||
import { ModuleTemplateTypeEnum } from 'core/module/constants';
|
||||
import type { FlowModuleTemplateType, ModuleItemType } from '../module/type.d';
|
||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
||||
import type { FlowModuleTemplateType, StoreNodeItemType } from '../workflow/type';
|
||||
import { PluginSourceEnum, PluginTypeEnum } from './constants';
|
||||
import { MethodType } from './controller';
|
||||
|
||||
@@ -12,7 +13,8 @@ export type PluginItemSchema = {
|
||||
avatar: string;
|
||||
intro: string;
|
||||
updateTime: Date;
|
||||
modules: ModuleItemType[];
|
||||
modules: StoreNodeItemType[];
|
||||
edges: StoreEdgeItemType[];
|
||||
parentId: string;
|
||||
type: `${PluginTypeEnum}`;
|
||||
metadata?: {
|
||||
@@ -20,6 +22,7 @@ export type PluginItemSchema = {
|
||||
apiSchemaStr?: string;
|
||||
customHeaders?: string;
|
||||
};
|
||||
version?: 'v1' | 'v2';
|
||||
};
|
||||
|
||||
/* plugin template */
|
||||
@@ -29,7 +32,6 @@ export type PluginTemplateType = PluginRuntimeType & {
|
||||
source: `${PluginSourceEnum}`;
|
||||
templateType: FlowNodeTemplateType['templateType'];
|
||||
intro: string;
|
||||
modules: ModuleItemType[];
|
||||
};
|
||||
|
||||
export type PluginRuntimeType = {
|
||||
@@ -38,5 +40,6 @@ export type PluginRuntimeType = {
|
||||
avatar: string;
|
||||
showStatus?: boolean;
|
||||
isTool?: boolean;
|
||||
modules: ModuleItemType[];
|
||||
nodes: StoreNodeItemType[];
|
||||
edges: StoreEdgeItemType[];
|
||||
};
|
||||
|
Reference in New Issue
Block a user