4.8.12 dev (#2928)

* perf: optimize global variables (#2863)

* feat: add global variable types

* add global variables to debug

* fix select dnd

* unify InputTypeConfig params

* feat: http node url support variables (#2891)

* feat: http node url support variables

* change to prompt editor

* fix: global variables (#2892)

* fix global variables

* fix type

* perf: global variables

* perf: workflow delete node error (#2905)

* update lock

* update 4812 doc

* feat: add node course url config (#2897)

* feat: add node course url config

* change plugin course url

* change default doc url

* change url store

* delete unused code

* fix: global variable (#2915)

* fix: global variable

* add comment

* fix: interactive check

* locj

* perf: debug switch to global tab when click run & global var default reset (#2925)

* fix: tool course url

* fix: global var default value & wrap variable form (#2926)

* fix: add dataset tags not update render (#2927)

* feat: tool will save histories

* perf: global variables code

* perf: FE_DOMAIN config

---------

Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
Archer
2024-10-15 20:23:18 +08:00
committed by GitHub
parent 00638d6ee7
commit d4e0a43771
58 changed files with 955 additions and 669 deletions

View File

@@ -13,6 +13,7 @@ import { StoreEdgeItemType } from '../workflow/type/edge';
import { PermissionSchemaType, PermissionValueType } from '../../support/permission/type';
import { AppPermission } from '../../support/permission/app/controller';
import { ParentIdType } from '../../common/parentFolder/type';
import { FlowNodeInputTypeEnum } from 'core/workflow/node/constant';
export type AppSchema = {
_id: string;
@@ -114,11 +115,19 @@ export type VariableItemType = {
id: string;
key: string;
label: string;
type: `${VariableInputEnum}`;
type: VariableInputEnum;
required: boolean;
maxLen: number;
enums: { value: string }[];
valueType: WorkflowIOValueTypeEnum;
description: string;
valueType?: WorkflowIOValueTypeEnum;
defaultValue?: any;
// input
maxLength?: number;
// numberInput
max?: number;
min?: number;
// select
enums?: { value: string; label: string }[];
};
// tts
export type AppTTSConfigType = {

View File

@@ -122,6 +122,9 @@ export const chats2GPTMessages = ({
value.type === ChatItemValueTypeEnum.text &&
typeof value.text?.content === 'string'
) {
if (!value.text.content && item.value.length > 1) {
return;
}
// Concat text
const lastValue = item.value[i - 1];
const lastResult = aiResults[aiResults.length - 1];

View File

@@ -267,29 +267,51 @@ export enum NodeOutputKeyEnum {
export enum VariableInputEnum {
input = 'input',
textarea = 'textarea',
numberInput = 'numberInput',
select = 'select',
custom = 'custom'
}
export const variableMap = {
export const variableMap: Record<
VariableInputEnum,
{
icon: string;
label: string;
value: VariableInputEnum;
defaultValueType: WorkflowIOValueTypeEnum;
description?: string;
}
> = {
[VariableInputEnum.input]: {
icon: 'core/app/variable/input',
title: i18nT('common:core.module.variable.input type'),
desc: ''
icon: 'core/workflow/inputType/input',
label: i18nT('common:core.workflow.inputType.input'),
value: VariableInputEnum.input,
defaultValueType: WorkflowIOValueTypeEnum.string
},
[VariableInputEnum.textarea]: {
icon: 'core/app/variable/textarea',
title: i18nT('common:core.module.variable.textarea type'),
desc: i18nT('app:variable.textarea_type_desc')
icon: 'core/workflow/inputType/textarea',
label: i18nT('common:core.workflow.inputType.textarea'),
value: VariableInputEnum.textarea,
defaultValueType: WorkflowIOValueTypeEnum.string,
description: i18nT('app:variable.textarea_type_desc')
},
[VariableInputEnum.numberInput]: {
icon: 'core/workflow/inputType/numberInput',
label: i18nT('common:core.workflow.inputType.number input'),
value: VariableInputEnum.numberInput,
defaultValueType: WorkflowIOValueTypeEnum.number
},
[VariableInputEnum.select]: {
icon: 'core/app/variable/select',
title: i18nT('common:core.module.variable.select type'),
desc: ''
icon: 'core/workflow/inputType/option',
label: i18nT('common:core.workflow.inputType.select'),
value: VariableInputEnum.select,
defaultValueType: WorkflowIOValueTypeEnum.string
},
[VariableInputEnum.custom]: {
icon: 'core/app/variable/external',
title: i18nT('common:core.module.variable.Custom type'),
desc: i18nT('app:variable.select type_desc')
icon: 'core/workflow/inputType/customVariable',
label: i18nT('common:core.workflow.inputType.custom'),
value: VariableInputEnum.custom,
defaultValueType: WorkflowIOValueTypeEnum.string,
description: i18nT('app:variable.select type_desc')
}
};

View File

@@ -54,6 +54,7 @@ export const AiChatModule: FlowNodeTemplateType = {
intro: i18nT('workflow:template.ai_chat_intro'),
showStatus: true,
isTool: true,
courseUrl: '/docs/workflow/modules/ai_chat/',
version: '481',
inputs: [
Input_Template_SettingAiModel,

View File

@@ -17,7 +17,7 @@ export const AssignedAnswerModule: FlowNodeTemplateType = {
avatar: 'core/workflow/template/reply',
name: i18nT('workflow:assigned_reply'),
intro: i18nT('workflow:intro_assigned_reply'),
courseUrl: '/docs/workflow/modules/reply/',
version: '481',
isTool: true,
inputs: [

View File

@@ -31,6 +31,7 @@ export const ClassifyQuestionModule: FlowNodeTemplateType = {
intro: i18nT('workflow:intro_question_classification'),
showStatus: true,
version: '481',
courseUrl: '/docs/workflow/modules/question_classify/',
inputs: [
{
...Input_Template_SelectAIModel,

View File

@@ -26,6 +26,7 @@ export const ContextExtractModule: FlowNodeTemplateType = {
intro: i18nT('workflow:intro_text_content_extraction'),
showStatus: true,
isTool: true,
courseUrl: '/docs/workflow/modules/content_extract/',
version: '481',
inputs: [
{

View File

@@ -17,6 +17,7 @@ export const CustomFeedbackNode: FlowNodeTemplateType = {
avatar: 'core/workflow/template/customFeedback',
name: i18nT('workflow:custom_feedback'),
intro: i18nT('workflow:intro_custom_feedback'),
courseUrl: '/docs/workflow/modules/custom_feedback/',
version: '486',
inputs: [
{

View File

@@ -29,6 +29,7 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
intro: Dataset_SEARCH_DESC,
showStatus: true,
isTool: true,
courseUrl: '/docs/workflow/modules/dataset_search/',
version: '481',
inputs: [
{

View File

@@ -27,6 +27,7 @@ export const HttpNode468: FlowNodeTemplateType = {
intro: i18nT('workflow:intro_http_request'),
showStatus: true,
isTool: true,
courseUrl: '/docs/workflow/modules/http/',
version: '481',
inputs: [
{

View File

@@ -23,6 +23,7 @@ export const IfElseNode: FlowNodeTemplateType = {
name: i18nT('workflow:condition_checker'),
intro: i18nT('workflow:execute_different_branches_based_on_conditions'),
showStatus: true,
courseUrl: '/docs/workflow/modules/tfswitch/',
version: '481',
inputs: [
{

View File

@@ -32,6 +32,7 @@ export const LafModule: FlowNodeTemplateType = {
intro: i18nT('workflow:intro_laf_function_call'),
showStatus: true,
isTool: true,
courseUrl: '/docs/workflow/modules/laf/',
version: '481',
inputs: [
{

View File

@@ -26,6 +26,7 @@ export const CodeNode: FlowNodeTemplateType = {
name: i18nT('workflow:code_execution'),
intro: i18nT('workflow:execute_a_simple_script_code_usually_for_complex_data_processing'),
showStatus: true,
courseUrl: '/docs/workflow/modules/sandbox/',
version: '482',
inputs: [
{

View File

@@ -23,6 +23,7 @@ export const TextEditorNode: FlowNodeTemplateType = {
avatar: 'core/workflow/template/textConcat',
name: i18nT('workflow:text_concatenation'),
intro: i18nT('workflow:intro_text_concatenation'),
courseUrl: '/docs/workflow/modules/text_editor/',
version: '486',
inputs: [
{

View File

@@ -31,6 +31,7 @@ export const ToolModule: FlowNodeTemplateType = {
name: i18nT('workflow:template.tool_call'),
intro: i18nT('workflow:template.tool_call_intro'),
showStatus: true,
courseUrl: '/docs/workflow/modules/tool/',
version: '481',
inputs: [
{

View File

@@ -30,6 +30,7 @@ export const WorkflowStart: FlowNodeTemplateType = {
intro: '',
forbidDelete: true,
unique: true,
courseUrl: '/docs/workflow/modules/input/',
version: '481',
inputs: [{ ...Input_Template_UserChatInput, toolDescription: i18nT('workflow:user_question') }],
outputs: [

View File

@@ -35,7 +35,7 @@ export type WorkflowTemplateType = {
avatar: string;
intro?: string;
author?: string;
inputExplanationUrl?: string;
courseUrl?: string;
version: string;
showStatus?: boolean;

View File

@@ -32,7 +32,6 @@ export type FlowNodeCommonType = {
avatar?: string;
name: string;
intro?: string; // template list intro
inputExplanationUrl?: string;
showStatus?: boolean; // chatting response step status
version: string;
@@ -69,6 +68,7 @@ export type FlowNodeTemplateType = FlowNodeCommonType & {
unique?: boolean;
diagram?: string; // diagram url
courseUrl?: string; // course url
};
export type NodeTemplateListItemType = {

View File

@@ -230,6 +230,7 @@ export const appData2FlowNodeIO = ({
FlowNodeInputTypeEnum.textarea,
FlowNodeInputTypeEnum.reference
],
[VariableInputEnum.numberInput]: [FlowNodeInputTypeEnum.numberInput],
[VariableInputEnum.select]: [FlowNodeInputTypeEnum.select],
[VariableInputEnum.custom]: [
FlowNodeInputTypeEnum.input,
@@ -246,7 +247,7 @@ export const appData2FlowNodeIO = ({
description: '',
valueType: WorkflowIOValueTypeEnum.any,
required: item.required,
list: item.enums.map((enumItem) => ({
list: item.enums?.map((enumItem) => ({
label: enumItem.value,
value: enumItem.value
}))
@@ -391,7 +392,13 @@ export function replaceEditorVariable({
}
];
}
return [];
return [
{
id: item.key,
value: item.value,
nodeId: runningNode.nodeId
}
];
});
const allVariables = [...globalVariables, ...nodeVariables, ...customInputs];