4.8.10 test (#2601)

* perf: workflow children run params

* feat: workflow userId

* fix: ui size

* perf: Markdown whitespace and ai images split

* fix: openai sdk ts
This commit is contained in:
Archer
2024-09-03 13:43:56 +08:00
committed by GitHub
parent 761e35c226
commit 9a57e94b79
43 changed files with 318 additions and 288 deletions

View File

@@ -6,6 +6,7 @@ import {
} from '@fastgpt/global/core/app/type';
import { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node.d';
import {
chatHistoryValueDesc,
FlowNodeInputTypeEnum,
FlowNodeTypeEnum
} from '@fastgpt/global/core/workflow/node/constant';
@@ -14,7 +15,6 @@ import { NodeInputKeyEnum, WorkflowIOValueTypeEnum } from '@fastgpt/global/core/
import { getNanoid } from '@fastgpt/global/common/string/tools';
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
import { TFunction } from 'next-i18next';
import { ToolModule } from '@fastgpt/global/core/workflow/template/system/tools';
import { useDatasetStore } from '../dataset/store/dataset';
import {
@@ -25,6 +25,7 @@ import { SystemConfigNode } from '@fastgpt/global/core/workflow/template/system/
import { AiChatModule } from '@fastgpt/global/core/workflow/template/system/aiChat';
import { DatasetSearchModule } from '@fastgpt/global/core/workflow/template/system/datasetSearch';
import { ReadFilesNodes } from '@fastgpt/global/core/workflow/template/system/readFiles';
import { i18nT } from '@fastgpt/web/i18n/utils';
type WorkflowType = {
nodes: StoreNodeItemType[];
@@ -519,38 +520,43 @@ export function form2AppWorkflow(
};
}
export const getSystemVariables = (t: TFunction): EditorVariablePickerType[] => {
return [
{
key: 'appId',
label: t('common:core.module.http.AppId'),
required: true,
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'chatId',
label: t('common:core.module.http.ChatId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'responseChatItemId',
label: t('common:core.module.http.ResponseChatItemId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'histories',
label: t('common:core.module.http.Histories'),
required: true,
valueType: WorkflowIOValueTypeEnum.chatHistory
},
{
key: 'cTime',
label: t('common:core.module.http.Current time'),
required: true,
valueType: WorkflowIOValueTypeEnum.string
}
];
};
export const workflowSystemVariables: EditorVariablePickerType[] = [
{
key: 'userId',
label: i18nT('workflow:use_user_id'),
required: true,
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'appId',
label: i18nT('common:core.module.http.AppId'),
required: true,
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'chatId',
label: i18nT('common:core.module.http.ChatId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'responseChatItemId',
label: i18nT('common:core.module.http.ResponseChatItemId'),
valueType: WorkflowIOValueTypeEnum.string
},
{
key: 'histories',
label: i18nT('common:core.module.http.Histories'),
required: true,
valueType: WorkflowIOValueTypeEnum.chatHistory,
valueDesc: chatHistoryValueDesc
},
{
key: 'cTime',
label: i18nT('common:core.module.http.Current time'),
required: true,
valueType: WorkflowIOValueTypeEnum.string
}
];
export const getAppQGuideCustomURL = (appDetail: AppDetailType | AppSchema): string => {
return (

View File

@@ -50,7 +50,7 @@ export const getGlobalVariableNode = ({
outputs: []
};
const globalVariables = getWorkflowGlobalVariables({ nodes, chatConfig, t });
const globalVariables = getWorkflowGlobalVariables({ nodes, chatConfig });
const variableNode: FlowNodeItemType = {
nodeId: VARIABLE_NODE_ID,

View File

@@ -24,7 +24,6 @@ import {
getAppChatConfig,
getGuideModule
} from '@fastgpt/global/core/workflow/utils';
import { getSystemVariables } from '../app/utils';
import { TFunction } from 'next-i18next';
import {
FlowNodeInputItemType,
@@ -36,6 +35,7 @@ import { VariableConditionEnum } from '@fastgpt/global/core/workflow/template/sy
import { AppChatConfigType } from '@fastgpt/global/core/app/type';
import { cloneDeep, isEqual } from 'lodash';
import { getInputComponentProps } from '@fastgpt/global/core/workflow/node/io/utils';
import { workflowSystemVariables } from '../app/utils';
export const nodeTemplate2FlowNode = ({
template,
@@ -203,13 +203,11 @@ export const computedNodeInputReference = ({
export const getRefData = ({
variable,
nodeList,
chatConfig,
t
chatConfig
}: {
variable?: ReferenceValueProps;
nodeList: FlowNodeItemType[];
chatConfig: AppChatConfigType;
t: TFunction;
}) => {
if (!variable)
return {
@@ -218,7 +216,7 @@ export const getRefData = ({
};
const node = nodeList.find((node) => node.nodeId === variable[0]);
const systemVariables = getWorkflowGlobalVariables({ nodes: nodeList, chatConfig, t });
const systemVariables = getWorkflowGlobalVariables({ nodes: nodeList, chatConfig });
if (!node) {
const globalVariable = systemVariables.find((item) => item.key === variable?.[1]);
@@ -362,12 +360,10 @@ export const filterSensitiveNodesData = (nodes: StoreNodeItemType[]) => {
/* get workflowStart output to global variables */
export const getWorkflowGlobalVariables = ({
nodes,
chatConfig,
t
chatConfig
}: {
nodes: FlowNodeItemType[];
chatConfig: AppChatConfigType;
t: TFunction;
}): EditorVariablePickerType[] => {
const globalVariables = formatEditorVariablePickerIcon(
getAppChatConfig({
@@ -377,9 +373,7 @@ export const getWorkflowGlobalVariables = ({
})?.variables || []
);
const systemVariables = getSystemVariables(t);
return [...globalVariables, ...systemVariables];
return [...globalVariables, ...workflowSystemVariables];
};
export type CombinedItemType = Partial<FlowNodeInputItemType> & Partial<FlowNodeOutputItemType>;