4.8-preview fix (#1324)

* feishu app release (#85)

* Revert "lafAccount add pat & re request when token invalid (#76)" (#77)

This reverts commit 83d85dfe37adcaef4833385ea52ee79fd84720be.

* perf: workflow ux

* system config

* feat: feishu app release

* chore: sovle the conflicts files; fix the feishu entry

* fix: rename Feishu interface to FeishuType

* fix: fix type problem in app.ts

* fix: type problem

* fix: style problem

---------

Co-authored-by: Archer <545436317@qq.com>

* perf: publish channel code

* change system variable position (#94)

* perf: workflow context

* perf: variable select

* hide publish

* perf: simple edit auto refresh

* perf: simple edit data refresh

* fix: target handle

---------

Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-04-29 11:13:10 +08:00
committed by GitHub
parent 5ca4049757
commit a0c1320d47
89 changed files with 1794 additions and 1047 deletions

View File

@@ -704,7 +704,7 @@ export function form2AppWorkflow(data: AppSimpleEditFormType): WorkflowType {
...pluginTool.map((tool) => tool.edges).flat()
]
};
console.log(config);
return config;
}
@@ -724,23 +724,28 @@ export const getSystemVariables = (t: TFunction): EditorVariablePickerType[] =>
return [
{
key: 'appId',
label: t('core.module.http.AppId')
label: t('core.module.http.AppId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'chatId',
label: t('core.module.http.ChatId')
label: t('core.module.http.ChatId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'responseChatItemId',
label: t('core.module.http.ResponseChatItemId')
label: t('core.module.http.ResponseChatItemId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'histories',
label: t('core.module.http.Histories')
label: t('core.module.http.Histories'),
valueType: WorkflowIOValueTypeEnum.chatHistory
},
{
key: 'cTime',
label: t('core.module.http.Current time')
label: t('core.module.http.Current time'),
valueType: WorkflowIOValueTypeEnum.string
}
];
};

View File

@@ -16,7 +16,7 @@ import {
StoreNodeItemType
} from '@fastgpt/global/core/workflow/type';
import { VARIABLE_NODE_ID } from '@fastgpt/global/core/workflow/constants';
import { getHandleId, splitGuideModule } from '@fastgpt/global/core/workflow/utils';
import { getHandleId } from '@fastgpt/global/core/workflow/utils';
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
import { LLMModelTypeEnum } from '@fastgpt/global/core/ai/constants';
import {
@@ -24,8 +24,10 @@ import {
FlowNodeOutputItemType
} from '@fastgpt/global/core/workflow/type/io';
import { PluginTypeEnum } from '@fastgpt/global/core/plugin/constants';
import { getWorkflowGlobalVariables } from './utils';
import { TFunction } from 'next-i18next';
export const systemConfigNode2VariableNode = (node: FlowNodeItemType) => {
export const getGlobalVariableNode = (nodes: FlowNodeItemType[], t: TFunction) => {
const template: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.globalVariable,
templateType: FlowNodeTemplateTypeEnum.other,
@@ -41,17 +43,17 @@ export const systemConfigNode2VariableNode = (node: FlowNodeItemType) => {
outputs: []
};
const { variableModules } = splitGuideModule(node);
const globalVariables = getWorkflowGlobalVariables(nodes, t);
const variableNode: FlowNodeItemType = {
nodeId: VARIABLE_NODE_ID,
...template,
outputs: variableModules.map((item) => ({
outputs: globalVariables.map((item) => ({
id: item.key,
type: FlowNodeOutputTypeEnum.dynamic,
type: FlowNodeOutputTypeEnum.static,
label: item.label,
key: item.key,
valueType: WorkflowIOValueTypeEnum.any
valueType: item.valueType || WorkflowIOValueTypeEnum.any
}))
};

View File

@@ -13,9 +13,17 @@ import {
import { EmptyNode } from '@fastgpt/global/core/workflow/template/system/emptyNode';
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
import { getNanoid } from '@fastgpt/global/common/string/tools';
import { systemConfigNode2VariableNode } from './adapt';
import { getGlobalVariableNode } from './adapt';
import { VARIABLE_NODE_ID } from '@fastgpt/global/core/workflow/constants';
import { NodeInputKeyEnum, NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants';
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
import {
formatEditorVariablePickerIcon,
getGuideModule,
splitGuideModule
} from '@fastgpt/global/core/workflow/utils';
import { getSystemVariables } from '../app/utils';
import { TFunction } from 'next-i18next';
export const nodeTemplate2FlowNode = ({
template,
@@ -97,11 +105,13 @@ export const storeEdgesRenderEdge = ({ edge }: { edge: StoreEdgeItemType }) => {
export const computedNodeInputReference = ({
nodeId,
nodes,
edges
edges,
t
}: {
nodeId: string;
nodes: FlowNodeItemType[];
edges: Edge[];
t: TFunction;
}) => {
// get current node
const node = nodes.find((item) => item.nodeId === nodeId);
@@ -126,14 +136,7 @@ export const computedNodeInputReference = ({
};
findSourceNode(nodeId);
// add system config node
const systemConfigNode = nodes.find(
(item) => item.flowNodeType === FlowNodeTypeEnum.systemConfig
);
if (systemConfigNode) {
sourceNodes.unshift(systemConfigNode2VariableNode(systemConfigNode));
}
sourceNodes.unshift(getGlobalVariableNode(nodes, t));
return sourceNodes;
};
@@ -232,3 +235,17 @@ export const filterSensitiveNodesData = (nodes: StoreNodeItemType[]) => {
});
return cloneNodes;
};
/* get workflowStart output to global variables */
export const getWorkflowGlobalVariables = (
nodes: FlowNodeItemType[],
t: TFunction
): EditorVariablePickerType[] => {
const globalVariables = formatEditorVariablePickerIcon(
splitGuideModule(getGuideModule(nodes))?.variableModules || []
);
const systemVariables = getSystemVariables(t);
return [...globalVariables, ...systemVariables];
};