perf: flow value type
This commit is contained in:
@@ -4,7 +4,8 @@ import {
|
||||
FlowModuleTypeEnum,
|
||||
FlowInputItemTypeEnum,
|
||||
FlowOutputItemTypeEnum,
|
||||
SpecialInputKeyEnum
|
||||
SpecialInputKeyEnum,
|
||||
FlowValueTypeEnum
|
||||
} from './index';
|
||||
import type { AppItemType } from '@/types/app';
|
||||
import type { FlowModuleTemplateType } from '@/types/flow';
|
||||
@@ -56,7 +57,7 @@ export const UserGuideModule: FlowModuleTemplateType = {
|
||||
};
|
||||
export const UserInputModule: FlowModuleTemplateType = {
|
||||
logo: '/imgs/module/userChatInput.png',
|
||||
name: '用户问题',
|
||||
name: '用户问题(对话入口)',
|
||||
intro: '用户输入的内容。该模块通常作为应用的入口,用户在发送消息后会首先执行该模块。',
|
||||
flowType: FlowModuleTypeEnum.questionInput,
|
||||
url: '/app/modules/init/userChatInput',
|
||||
@@ -72,6 +73,7 @@ export const UserInputModule: FlowModuleTemplateType = {
|
||||
key: SystemInputEnum.userChatInput,
|
||||
label: '用户问题',
|
||||
type: FlowOutputItemTypeEnum.source,
|
||||
valueType: FlowValueTypeEnum.string,
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
@@ -101,6 +103,7 @@ export const HistoryModule: FlowModuleTemplateType = {
|
||||
{
|
||||
key: SystemInputEnum.history,
|
||||
label: '聊天记录',
|
||||
valueType: FlowValueTypeEnum.chatHistory,
|
||||
type: FlowOutputItemTypeEnum.source,
|
||||
targets: []
|
||||
}
|
||||
@@ -155,6 +158,7 @@ export const ChatModule: FlowModuleTemplateType = {
|
||||
key: 'systemPrompt',
|
||||
type: FlowInputItemTypeEnum.textarea,
|
||||
label: '系统提示词',
|
||||
valueType: FlowValueTypeEnum.string,
|
||||
description: ChatModelSystemTip,
|
||||
placeholder: ChatModelSystemTip,
|
||||
value: ''
|
||||
@@ -162,6 +166,7 @@ export const ChatModule: FlowModuleTemplateType = {
|
||||
{
|
||||
key: 'limitPrompt',
|
||||
type: FlowInputItemTypeEnum.textarea,
|
||||
valueType: FlowValueTypeEnum.string,
|
||||
label: '限定词',
|
||||
description: ChatModelLimitTip,
|
||||
placeholder: ChatModelLimitTip,
|
||||
@@ -171,7 +176,8 @@ export const ChatModule: FlowModuleTemplateType = {
|
||||
{
|
||||
key: 'quoteQA',
|
||||
type: FlowInputItemTypeEnum.target,
|
||||
label: '引用内容'
|
||||
label: '引用内容',
|
||||
valueType: FlowValueTypeEnum.kbQuote
|
||||
},
|
||||
Input_Template_History,
|
||||
Input_Template_UserChatInput
|
||||
@@ -183,6 +189,14 @@ export const ChatModule: FlowModuleTemplateType = {
|
||||
description: '直接响应,无需配置',
|
||||
type: FlowOutputItemTypeEnum.hidden,
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'finish',
|
||||
label: '回复结束',
|
||||
description: 'AI 回复完成后触发',
|
||||
valueType: FlowValueTypeEnum.boolean,
|
||||
type: FlowOutputItemTypeEnum.source,
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -236,12 +250,14 @@ export const KBSearchModule: FlowModuleTemplateType = {
|
||||
key: 'isEmpty',
|
||||
label: '搜索结果为空',
|
||||
type: FlowOutputItemTypeEnum.source,
|
||||
valueType: FlowValueTypeEnum.boolean,
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'unEmpty',
|
||||
label: '搜索结果不为空',
|
||||
type: FlowOutputItemTypeEnum.source,
|
||||
valueType: FlowValueTypeEnum.boolean,
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
@@ -249,6 +265,7 @@ export const KBSearchModule: FlowModuleTemplateType = {
|
||||
label: '引用内容',
|
||||
description: '搜索结果为空时不返回',
|
||||
type: FlowOutputItemTypeEnum.source,
|
||||
valueType: FlowValueTypeEnum.kbQuote,
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
@@ -257,7 +274,8 @@ export const KBSearchModule: FlowModuleTemplateType = {
|
||||
export const AnswerModule: FlowModuleTemplateType = {
|
||||
logo: '/imgs/module/reply.png',
|
||||
name: '指定回复',
|
||||
intro: '该模块可以直接回复一段指定的内容。常用于引导、提示。',
|
||||
intro: '该模块可以直接回复一段指定的内容。常用于引导、提示',
|
||||
description: '该模块可以直接回复一段指定的内容。常用于引导、提示',
|
||||
flowType: FlowModuleTypeEnum.answerNode,
|
||||
inputs: [
|
||||
Input_Template_TFSwitch,
|
||||
@@ -265,7 +283,8 @@ export const AnswerModule: FlowModuleTemplateType = {
|
||||
key: SpecialInputKeyEnum.answerText,
|
||||
value: '',
|
||||
type: FlowInputItemTypeEnum.textarea,
|
||||
label: '回复的内容'
|
||||
label: '回复的内容',
|
||||
description: '可以使用 \\n 来实现换行'
|
||||
}
|
||||
],
|
||||
outputs: []
|
||||
@@ -309,6 +328,7 @@ export const ClassifyQuestionModule: FlowModuleTemplateType = {
|
||||
{
|
||||
key: 'systemPrompt',
|
||||
type: FlowInputItemTypeEnum.textarea,
|
||||
valueType: FlowValueTypeEnum.string,
|
||||
label: '系统提示词',
|
||||
description:
|
||||
'你可以添加一些特定内容的介绍,从而更好的识别用户的问题类型。这个内容通常是给模型介绍一个它不知道的内容。',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
|
||||
export enum FlowInputItemTypeEnum {
|
||||
systemInput = 'systemInput', // history, userChatInput, variableInput
|
||||
input = 'input',
|
||||
@@ -35,6 +37,36 @@ export enum SpecialInputKeyEnum {
|
||||
'answerText' = 'text'
|
||||
}
|
||||
|
||||
export enum FlowValueTypeEnum {
|
||||
'string' = 'string',
|
||||
'number' = 'number',
|
||||
'boolean' = 'boolean',
|
||||
'chatHistory' = 'chatHistory',
|
||||
'kbQuote' = 'kbQuote',
|
||||
'other' = 'other'
|
||||
}
|
||||
|
||||
export const FlowValueTypeStyle: Record<`${FlowValueTypeEnum}`, BoxProps> = {
|
||||
[FlowValueTypeEnum.string]: {
|
||||
background: '#36ADEF'
|
||||
},
|
||||
[FlowValueTypeEnum.number]: {
|
||||
background: '#FB7C3C'
|
||||
},
|
||||
[FlowValueTypeEnum.boolean]: {
|
||||
background: '#E7D118'
|
||||
},
|
||||
[FlowValueTypeEnum.chatHistory]: {
|
||||
background: '#00A9A6'
|
||||
},
|
||||
[FlowValueTypeEnum.kbQuote]: {
|
||||
background: '#A558C9'
|
||||
},
|
||||
[FlowValueTypeEnum.other]: {
|
||||
background: '#9CA2A8'
|
||||
}
|
||||
};
|
||||
|
||||
export const initModuleType: Record<string, boolean> = {
|
||||
[FlowModuleTypeEnum.historyNode]: true,
|
||||
[FlowModuleTypeEnum.questionInput]: true
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
import { FlowInputItemType } from '@/types/flow';
|
||||
import { SystemInputEnum } from '../app';
|
||||
import { FlowInputItemTypeEnum } from './index';
|
||||
import { FlowInputItemTypeEnum, FlowValueTypeEnum } from './index';
|
||||
|
||||
export const Input_Template_TFSwitch: FlowInputItemType = {
|
||||
key: SystemInputEnum.switch,
|
||||
type: FlowInputItemTypeEnum.target,
|
||||
label: '触发器'
|
||||
label: '触发器',
|
||||
valueType: FlowValueTypeEnum.boolean
|
||||
};
|
||||
|
||||
export const Input_Template_History: FlowInputItemType = {
|
||||
key: SystemInputEnum.history,
|
||||
type: FlowInputItemTypeEnum.target,
|
||||
label: '聊天记录'
|
||||
label: '聊天记录',
|
||||
valueType: FlowValueTypeEnum.chatHistory
|
||||
};
|
||||
|
||||
export const Input_Template_UserChatInput: FlowInputItemType = {
|
||||
key: SystemInputEnum.userChatInput,
|
||||
type: FlowInputItemTypeEnum.target,
|
||||
label: '用户问题',
|
||||
required: true
|
||||
required: true,
|
||||
valueType: FlowValueTypeEnum.string
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user