mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 01:40:51 +00:00
4.7-alpha2 (#1027)
* feat: stop toolCall and rename some field. (#46) * perf: node delete tip;pay tip * fix: toolCall cannot save child answer * feat: stop tool * fix: team modal * fix feckbackMoal auth bug (#47) * 简单的支持提示词运行tool。优化workflow模板 (#49) * remove templates * fix: request body undefined * feat: prompt tool run * feat: workflow tamplates modal * perf: plugin start * 4.7 (#50) * fix docker-compose download url (#994) original code is a bad url with '404 NOT FOUND' return. fix docker-compose download url, add 'v' before docker-compose version * Update ai_settings.md (#1000) * Update configuration.md * Update configuration.md * Fix history in classifyQuestion and extract modules (#1012) * Fix history in classifyQuestion and extract modules * Add chatValue2RuntimePrompt import and update text formatting * flow controller to packages * fix: rerank select * modal ui * perf: modal code path * point not sufficient * feat: http url support variable * fix http key * perf: prompt * perf: ai setting modal * simple edit ui --------- Co-authored-by: entorick <entorick11@qq.com> Co-authored-by: liujianglc <liujianglc@163.com> Co-authored-by: Fengrui Liu <liufengrui.work@bytedance.com> * fix team share redirect to login (#51) * feat: support openapi import plugins (#48) * feat: support openapi import plugins * feat: import from url * fix: add body params parse * fix build * fix * fix * fix * tool box ui (#52) * fix: training queue * feat: simple edit tool select * perf: simple edit dataset prompt * fix: chatbox tool ux * feat: quote prompt module * perf: plugin tools sign * perf: model avatar * tool selector ui * feat: max histories * perf: http plugin import (#53) * perf: plugin http import * chatBox ui * perf: name * fix: Node template card (#54) * fix: ts * setting modal * package * package * feat: add plugins search (#57) * feat: add plugins search * perf: change http plugin header input * Yjl (#56) * perf: prompt tool call * perf: chat box ux * doc * doc * price tip * perf: tool selector * ui' * fix: vector queue * fix: empty tool and empty response * fix: empty msg * perf: pg index * perf: ui tip * doc * tool tip --------- Co-authored-by: yst <77910600+yu-and-liu@users.noreply.github.com> Co-authored-by: entorick <entorick11@qq.com> Co-authored-by: liujianglc <liujianglc@163.com> Co-authored-by: Fengrui Liu <liufengrui.work@bytedance.com> Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
7
packages/global/core/module/api.d.ts
vendored
7
packages/global/core/module/api.d.ts
vendored
@@ -13,3 +13,10 @@ export type HttpQueryType = {
|
||||
variables: Record<string, any>;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
/* http node */
|
||||
export type HttpParamAndHeaderItemType = {
|
||||
key: string;
|
||||
type: string;
|
||||
value: string;
|
||||
};
|
||||
|
@@ -1,4 +1,4 @@
|
||||
export enum ModuleTemplateTypeEnum {
|
||||
export enum FlowNodeTemplateTypeEnum {
|
||||
userGuide = 'userGuide',
|
||||
systemInput = 'systemInput',
|
||||
tools = 'tools',
|
||||
@@ -87,7 +87,8 @@ export enum ModuleInputKeyEnum {
|
||||
runAppSelectApp = 'app',
|
||||
|
||||
// plugin
|
||||
pluginId = 'pluginId'
|
||||
pluginId = 'pluginId',
|
||||
pluginStart = 'pluginStart'
|
||||
}
|
||||
|
||||
export enum ModuleOutputKeyEnum {
|
||||
@@ -117,7 +118,10 @@ export enum ModuleOutputKeyEnum {
|
||||
selectedTools = 'selectedTools',
|
||||
|
||||
// http
|
||||
httpRawResponse = 'httpRawResponse'
|
||||
httpRawResponse = 'httpRawResponse',
|
||||
|
||||
// plugin
|
||||
pluginStart = 'pluginStart'
|
||||
}
|
||||
|
||||
export enum VariableInputEnum {
|
||||
|
@@ -21,10 +21,12 @@ export enum FlowNodeInputTypeEnum {
|
||||
|
||||
// ai model select
|
||||
selectLLMModel = 'selectLLMModel',
|
||||
settingLLMModel = 'settingLLMModel',
|
||||
|
||||
// dataset special input
|
||||
selectDataset = 'selectDataset',
|
||||
selectDatasetParamsModal = 'selectDatasetParamsModal',
|
||||
settingDatasetQuotePrompt = 'settingDatasetQuotePrompt',
|
||||
|
||||
hidden = 'hidden',
|
||||
custom = 'custom'
|
||||
@@ -57,7 +59,8 @@ export enum FlowNodeTypeEnum {
|
||||
pluginInput = 'pluginInput',
|
||||
pluginOutput = 'pluginOutput',
|
||||
queryExtension = 'cfr',
|
||||
tools = 'tools'
|
||||
tools = 'tools',
|
||||
stopTool = 'stopTool'
|
||||
|
||||
// abandon
|
||||
}
|
||||
|
7
packages/global/core/module/node/type.d.ts
vendored
7
packages/global/core/module/node/type.d.ts
vendored
@@ -102,6 +102,13 @@ export type EditNodeFieldType = {
|
||||
};
|
||||
|
||||
/* ------------- item type --------------- */
|
||||
export type SettingAIDataType = {
|
||||
model: string;
|
||||
temperature: number;
|
||||
maxToken: number;
|
||||
isResponseAnswerText?: boolean;
|
||||
maxHistories?: number;
|
||||
};
|
||||
/* ai chat modules props */
|
||||
export type AIChatModuleProps = {
|
||||
[ModuleInputKeyEnum.aiModel]: string;
|
||||
|
@@ -90,6 +90,7 @@ export type DispatchNodeResponseType = {
|
||||
// tool
|
||||
toolCallTokens?: number;
|
||||
toolDetail?: ChatHistoryItemResType[];
|
||||
toolStop?: boolean;
|
||||
};
|
||||
|
||||
export type DispatchNodeResultType<T> = {
|
||||
|
@@ -8,7 +8,9 @@ import { ClassifyQuestionModule } from './system/classifyQuestion';
|
||||
import { ContextExtractModule } from './system/contextExtract';
|
||||
import { HttpModule468 } from './system/http468';
|
||||
import { HttpModule } from './system/abandon/http';
|
||||
|
||||
import { ToolModule } from './system/tools';
|
||||
import { StopToolNode } from './system/stopTool';
|
||||
|
||||
import { RunAppModule } from './system/runApp';
|
||||
import { PluginInputModule } from './system/pluginInput';
|
||||
@@ -16,11 +18,11 @@ import { PluginOutputModule } from './system/pluginOutput';
|
||||
import { RunPluginModule } from './system/runPlugin';
|
||||
import { AiQueryExtension } from './system/queryExtension';
|
||||
|
||||
import type { FlowModuleTemplateType, moduleTemplateListType } from '../../module/type.d';
|
||||
import { ModuleTemplateTypeEnum } from '../../module/constants';
|
||||
import type { FlowNodeTemplateType, moduleTemplateListType } from '../../module/type.d';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../module/constants';
|
||||
|
||||
/* app flow module templates */
|
||||
export const appSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
UserGuideModule,
|
||||
UserInputModule,
|
||||
AiChatModule,
|
||||
@@ -29,13 +31,14 @@ export const appSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
DatasetConcatModule,
|
||||
RunAppModule,
|
||||
ToolModule,
|
||||
StopToolNode,
|
||||
ClassifyQuestionModule,
|
||||
ContextExtractModule,
|
||||
HttpModule468,
|
||||
AiQueryExtension
|
||||
];
|
||||
/* plugin flow module templates */
|
||||
export const pluginSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
PluginInputModule,
|
||||
PluginOutputModule,
|
||||
AiChatModule,
|
||||
@@ -44,6 +47,7 @@ export const pluginSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
DatasetConcatModule,
|
||||
RunAppModule,
|
||||
ToolModule,
|
||||
StopToolNode,
|
||||
ClassifyQuestionModule,
|
||||
ContextExtractModule,
|
||||
HttpModule468,
|
||||
@@ -51,7 +55,7 @@ export const pluginSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
];
|
||||
|
||||
/* all module */
|
||||
export const moduleTemplatesFlat: FlowModuleTemplateType[] = [
|
||||
export const moduleTemplatesFlat: FlowNodeTemplateType[] = [
|
||||
UserGuideModule,
|
||||
UserInputModule,
|
||||
AiChatModule,
|
||||
@@ -63,6 +67,7 @@ export const moduleTemplatesFlat: FlowModuleTemplateType[] = [
|
||||
HttpModule468,
|
||||
HttpModule,
|
||||
ToolModule,
|
||||
StopToolNode,
|
||||
AiChatModule,
|
||||
RunAppModule,
|
||||
PluginInputModule,
|
||||
@@ -73,43 +78,43 @@ export const moduleTemplatesFlat: FlowModuleTemplateType[] = [
|
||||
|
||||
export const moduleTemplatesList: moduleTemplateListType = [
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.userGuide,
|
||||
label: 'core.module.template.Guide module',
|
||||
type: FlowNodeTemplateTypeEnum.userGuide,
|
||||
label: '',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.systemInput,
|
||||
label: 'core.module.template.System input module',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.textAnswer,
|
||||
type: FlowNodeTemplateTypeEnum.textAnswer,
|
||||
label: 'core.module.template.Response module',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.functionCall,
|
||||
type: FlowNodeTemplateTypeEnum.functionCall,
|
||||
label: 'core.module.template.Function module',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.tools,
|
||||
type: FlowNodeTemplateTypeEnum.tools,
|
||||
label: 'core.module.template.Tool module',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.externalCall,
|
||||
type: FlowNodeTemplateTypeEnum.externalCall,
|
||||
label: 'core.module.template.External module',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.personalPlugin,
|
||||
label: 'core.module.template.My plugin module',
|
||||
type: FlowNodeTemplateTypeEnum.personalPlugin,
|
||||
label: '',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.other,
|
||||
type: FlowNodeTemplateTypeEnum.other,
|
||||
label: '其他',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: FlowNodeTemplateTypeEnum.systemInput,
|
||||
label: 'core.module.template.System input module',
|
||||
list: []
|
||||
}
|
||||
];
|
||||
|
@@ -59,7 +59,7 @@ export const Input_Template_DynamicInput: FlowNodeInputItemType = {
|
||||
hideInApp: true
|
||||
};
|
||||
|
||||
export const Input_Template_AiModel: FlowNodeInputItemType = {
|
||||
export const Input_Template_SelectAIModel: FlowNodeInputItemType = {
|
||||
key: ModuleInputKeyEnum.aiModel,
|
||||
type: FlowNodeInputTypeEnum.selectLLMModel,
|
||||
label: 'core.module.input.label.aiModel',
|
||||
@@ -68,6 +68,15 @@ export const Input_Template_AiModel: FlowNodeInputItemType = {
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false
|
||||
};
|
||||
export const Input_Template_SettingAiModel: FlowNodeInputItemType = {
|
||||
key: ModuleInputKeyEnum.aiModel,
|
||||
type: FlowNodeInputTypeEnum.settingLLMModel,
|
||||
label: 'core.module.input.label.aiModel',
|
||||
required: true,
|
||||
valueType: ModuleIOValueTypeEnum.string,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false
|
||||
};
|
||||
|
||||
export const Input_Template_System_Prompt: FlowNodeInputItemType = {
|
||||
key: ModuleInputKeyEnum.aiSystemPrompt,
|
||||
@@ -83,7 +92,7 @@ export const Input_Template_System_Prompt: FlowNodeInputItemType = {
|
||||
|
||||
export const Input_Template_Dataset_Quote: FlowNodeInputItemType = {
|
||||
key: ModuleInputKeyEnum.aiChatDatasetQuote,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
type: FlowNodeInputTypeEnum.settingDatasetQuotePrompt,
|
||||
label: '知识库引用',
|
||||
description: 'core.module.Dataset quote.Input description',
|
||||
valueType: ModuleIOValueTypeEnum.datasetQuote,
|
||||
|
@@ -3,11 +3,11 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../../type';
|
||||
import { FlowNodeTemplateType } from '../../../type';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../../constants';
|
||||
import {
|
||||
Input_Template_AddInputParam,
|
||||
@@ -16,9 +16,9 @@ import {
|
||||
} from '../../input';
|
||||
import { Output_Template_AddOutput, Output_Template_Finish } from '../../output';
|
||||
|
||||
export const HttpModule: FlowModuleTemplateType = {
|
||||
export const HttpModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.httpRequest,
|
||||
templateType: ModuleTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
flowType: FlowNodeTypeEnum.httpRequest,
|
||||
avatar: '/imgs/module/http.png',
|
||||
name: 'core.module.template.Http request',
|
||||
|
@@ -3,15 +3,15 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
Input_Template_AiModel,
|
||||
Input_Template_SettingAiModel,
|
||||
Input_Template_Dataset_Quote,
|
||||
Input_Template_History,
|
||||
Input_Template_Switch,
|
||||
@@ -21,18 +21,18 @@ import {
|
||||
import { chatNodeSystemPromptTip } from '../tip';
|
||||
import { Output_Template_Finish, Output_Template_UserChatInput } from '../output';
|
||||
|
||||
export const AiChatModule: FlowModuleTemplateType = {
|
||||
export const AiChatModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.chatNode,
|
||||
templateType: ModuleTemplateTypeEnum.textAnswer,
|
||||
templateType: FlowNodeTemplateTypeEnum.textAnswer,
|
||||
flowType: FlowNodeTypeEnum.chatNode,
|
||||
avatar: '/imgs/module/AI.png',
|
||||
name: 'AI 对话',
|
||||
intro: 'AI 大模型对话',
|
||||
showStatus: true,
|
||||
// isTool: true,
|
||||
isTool: true,
|
||||
inputs: [
|
||||
Input_Template_Switch,
|
||||
Input_Template_AiModel,
|
||||
Input_Template_SettingAiModel,
|
||||
// --- settings modal
|
||||
{
|
||||
key: ModuleInputKeyEnum.aiChatTemperature,
|
||||
@@ -83,14 +83,6 @@ export const AiChatModule: FlowModuleTemplateType = {
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false
|
||||
},
|
||||
{
|
||||
key: ModuleInputKeyEnum.aiChatSettingModal,
|
||||
type: FlowNodeInputTypeEnum.aiSettings,
|
||||
label: '',
|
||||
valueType: ModuleIOValueTypeEnum.any,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false
|
||||
},
|
||||
// settings modal ---
|
||||
{
|
||||
...Input_Template_System_Prompt,
|
||||
|
@@ -1,12 +1,16 @@
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { ModuleIOValueTypeEnum, ModuleInputKeyEnum, ModuleTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { Input_Template_Switch } from '../input';
|
||||
import { Output_Template_Finish } from '../output';
|
||||
|
||||
export const AssignedAnswerModule: FlowModuleTemplateType = {
|
||||
export const AssignedAnswerModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.answerNode,
|
||||
templateType: ModuleTemplateTypeEnum.textAnswer,
|
||||
templateType: FlowNodeTemplateTypeEnum.textAnswer,
|
||||
flowType: FlowNodeTypeEnum.answerNode,
|
||||
avatar: '/imgs/module/reply.png',
|
||||
name: '指定回复',
|
||||
|
@@ -3,10 +3,14 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { ModuleIOValueTypeEnum, ModuleInputKeyEnum, ModuleTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
Input_Template_AiModel,
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
Input_Template_SelectAIModel,
|
||||
Input_Template_History,
|
||||
Input_Template_Switch,
|
||||
Input_Template_UserChatInput
|
||||
@@ -15,9 +19,9 @@ import { Output_Template_UserChatInput } from '../output';
|
||||
import { Input_Template_System_Prompt } from '../input';
|
||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
||||
|
||||
export const ClassifyQuestionModule: FlowModuleTemplateType = {
|
||||
export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.classifyQuestion,
|
||||
templateType: ModuleTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
flowType: FlowNodeTypeEnum.classifyQuestion,
|
||||
avatar: '/imgs/module/cq.png',
|
||||
name: '问题分类',
|
||||
@@ -26,7 +30,7 @@ export const ClassifyQuestionModule: FlowModuleTemplateType = {
|
||||
inputs: [
|
||||
Input_Template_Switch,
|
||||
{
|
||||
...Input_Template_AiModel,
|
||||
...Input_Template_SelectAIModel,
|
||||
llmModelType: LLMModelTypeEnum.classify
|
||||
},
|
||||
{
|
||||
|
@@ -3,19 +3,23 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { Input_Template_AiModel, Input_Template_History, Input_Template_Switch } from '../input';
|
||||
import {
|
||||
Input_Template_SelectAIModel,
|
||||
Input_Template_History,
|
||||
Input_Template_Switch
|
||||
} from '../input';
|
||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
||||
|
||||
export const ContextExtractModule: FlowModuleTemplateType = {
|
||||
export const ContextExtractModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.contentExtract,
|
||||
templateType: ModuleTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
flowType: FlowNodeTypeEnum.contentExtract,
|
||||
avatar: '/imgs/module/extract.png',
|
||||
name: '文本内容提取',
|
||||
@@ -25,7 +29,7 @@ export const ContextExtractModule: FlowModuleTemplateType = {
|
||||
inputs: [
|
||||
Input_Template_Switch,
|
||||
{
|
||||
...Input_Template_AiModel,
|
||||
...Input_Template_SelectAIModel,
|
||||
llmModelType: LLMModelTypeEnum.extractFields
|
||||
},
|
||||
{
|
||||
@@ -35,7 +39,6 @@ export const ContextExtractModule: FlowModuleTemplateType = {
|
||||
label: '提取要求描述',
|
||||
description:
|
||||
'给AI一些对应的背景知识或要求描述,引导AI更好的完成任务。\n该输入框可使用全局变量。',
|
||||
required: true,
|
||||
placeholder:
|
||||
'例如: \n1. 当前时间为: {{cTime}}。你是一个实验室预约助手,你的任务是帮助用户预约实验室,从文本中获取对应的预约信息。\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。',
|
||||
showTargetInApp: true,
|
||||
|
@@ -3,12 +3,12 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { Input_Template_Dataset_Quote, Input_Template_Switch } from '../input';
|
||||
import { Output_Template_Finish } from '../output';
|
||||
@@ -20,10 +20,10 @@ export const getOneQuoteInputTemplate = (key = getNanoid()) => ({
|
||||
type: FlowNodeInputTypeEnum.hidden
|
||||
});
|
||||
|
||||
export const DatasetConcatModule: FlowModuleTemplateType = {
|
||||
export const DatasetConcatModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.datasetConcatNode,
|
||||
flowType: FlowNodeTypeEnum.datasetConcatNode,
|
||||
templateType: ModuleTemplateTypeEnum.tools,
|
||||
templateType: FlowNodeTemplateTypeEnum.other,
|
||||
avatar: '/imgs/module/concat.svg',
|
||||
name: '知识库搜索引用合并',
|
||||
intro: '可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。',
|
||||
|
@@ -3,20 +3,20 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { Input_Template_Switch, Input_Template_UserChatInput } from '../input';
|
||||
import { Output_Template_Finish, Output_Template_UserChatInput } from '../output';
|
||||
import { DatasetSearchModeEnum } from '../../../dataset/constants';
|
||||
|
||||
export const DatasetSearchModule: FlowModuleTemplateType = {
|
||||
export const DatasetSearchModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.datasetSearchNode,
|
||||
templateType: ModuleTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
flowType: FlowNodeTypeEnum.datasetSearchNode,
|
||||
avatar: '/imgs/module/db.png',
|
||||
name: '知识库搜索',
|
||||
|
@@ -3,12 +3,12 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
Input_Template_AddInputParam,
|
||||
@@ -17,9 +17,9 @@ import {
|
||||
} from '../input';
|
||||
import { Output_Template_AddOutput, Output_Template_Finish } from '../output';
|
||||
|
||||
export const HttpModule468: FlowModuleTemplateType = {
|
||||
export const HttpModule468: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.httpRequest468,
|
||||
templateType: ModuleTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
flowType: FlowNodeTypeEnum.httpRequest468,
|
||||
avatar: '/imgs/module/http.png',
|
||||
name: 'HTTP 请求',
|
||||
|
@@ -1,15 +1,43 @@
|
||||
import { ModuleTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import {
|
||||
FlowNodeTemplateTypeEnum,
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
|
||||
export const PluginInputModule: FlowModuleTemplateType = {
|
||||
export const PluginInputModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.pluginInput,
|
||||
templateType: ModuleTemplateTypeEnum.systemInput,
|
||||
templateType: FlowNodeTemplateTypeEnum.systemInput,
|
||||
flowType: FlowNodeTypeEnum.pluginInput,
|
||||
avatar: '/imgs/module/input.png',
|
||||
name: '定义插件输入',
|
||||
intro: '自定义配置外部输入,使用插件时,仅暴露自定义配置的输入',
|
||||
showStatus: false,
|
||||
inputs: [],
|
||||
outputs: []
|
||||
inputs: [
|
||||
{
|
||||
key: ModuleInputKeyEnum.pluginStart,
|
||||
type: FlowNodeInputTypeEnum.hidden,
|
||||
valueType: ModuleIOValueTypeEnum.boolean,
|
||||
label: '插件开始运行',
|
||||
description:
|
||||
'插件开始运行时,会输出一个 True 的标识。有时候,插件不会有额外的的输入,为了顺利的进入下一个阶段,你可以将该值连接到下一个节点的触发器中。',
|
||||
showTargetInApp: true,
|
||||
showTargetInPlugin: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: ModuleOutputKeyEnum.pluginStart,
|
||||
label: '插件开始运行',
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
valueType: ModuleIOValueTypeEnum.boolean,
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { ModuleTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
|
||||
export const PluginOutputModule: FlowModuleTemplateType = {
|
||||
export const PluginOutputModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.pluginOutput,
|
||||
templateType: ModuleTemplateTypeEnum.systemInput,
|
||||
templateType: FlowNodeTemplateTypeEnum.systemInput,
|
||||
flowType: FlowNodeTypeEnum.pluginOutput,
|
||||
avatar: '/imgs/module/output.png',
|
||||
name: '定义插件输出',
|
||||
|
@@ -3,25 +3,25 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
Input_Template_History,
|
||||
Input_Template_Switch,
|
||||
Input_Template_UserChatInput,
|
||||
Input_Template_AiModel
|
||||
Input_Template_SelectAIModel
|
||||
} from '../input';
|
||||
import { Output_Template_UserChatInput } from '../output';
|
||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
||||
|
||||
export const AiQueryExtension: FlowModuleTemplateType = {
|
||||
export const AiQueryExtension: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.chatNode,
|
||||
templateType: ModuleTemplateTypeEnum.other,
|
||||
templateType: FlowNodeTemplateTypeEnum.other,
|
||||
flowType: FlowNodeTypeEnum.queryExtension,
|
||||
avatar: '/imgs/module/cfr.svg',
|
||||
name: '问题优化',
|
||||
@@ -31,7 +31,7 @@ export const AiQueryExtension: FlowModuleTemplateType = {
|
||||
inputs: [
|
||||
Input_Template_Switch,
|
||||
{
|
||||
...Input_Template_AiModel,
|
||||
...Input_Template_SelectAIModel,
|
||||
llmModelType: LLMModelTypeEnum.queryExtension
|
||||
},
|
||||
{
|
||||
|
@@ -3,12 +3,12 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
Input_Template_History,
|
||||
@@ -17,9 +17,9 @@ import {
|
||||
} from '../input';
|
||||
import { Output_Template_Finish, Output_Template_UserChatInput } from '../output';
|
||||
|
||||
export const RunAppModule: FlowModuleTemplateType = {
|
||||
export const RunAppModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.runApp,
|
||||
templateType: ModuleTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
flowType: FlowNodeTypeEnum.runApp,
|
||||
avatar: '/imgs/module/app.png',
|
||||
name: '应用调用',
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { ModuleTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
|
||||
export const RunPluginModule: FlowModuleTemplateType = {
|
||||
export const RunPluginModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.pluginModule,
|
||||
templateType: ModuleTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
flowType: FlowNodeTypeEnum.pluginModule,
|
||||
intro: '',
|
||||
name: '',
|
||||
|
16
packages/global/core/module/template/system/stopTool.ts
Normal file
16
packages/global/core/module/template/system/stopTool.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { Input_Template_Switch } from '../input';
|
||||
|
||||
export const StopToolNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.stopTool,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
flowType: FlowNodeTypeEnum.stopTool,
|
||||
avatar: '/imgs/module/toolStop.svg',
|
||||
name: '工具调用终止',
|
||||
intro:
|
||||
'该模块需配置工具调用使用。当该模块被执行时,本次工具调用将会强制结束,并且不再调用AI针对工具调用结果回答问题。',
|
||||
inputs: [Input_Template_Switch],
|
||||
outputs: []
|
||||
};
|
@@ -1,12 +1,17 @@
|
||||
import { FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum,
|
||||
ModuleInputKeyEnum
|
||||
} from '../../constants';
|
||||
import {
|
||||
Input_Template_AiModel,
|
||||
Input_Template_SettingAiModel,
|
||||
Input_Template_History,
|
||||
Input_Template_Switch,
|
||||
Input_Template_System_Prompt,
|
||||
@@ -16,19 +21,43 @@ import { chatNodeSystemPromptTip } from '../tip';
|
||||
import { Output_Template_Finish, Output_Template_UserChatInput } from '../output';
|
||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
||||
|
||||
export const ToolModule: FlowModuleTemplateType = {
|
||||
export const ToolModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.tools,
|
||||
flowType: FlowNodeTypeEnum.tools,
|
||||
templateType: ModuleTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
avatar: '/imgs/module/tool.svg',
|
||||
name: '工具调用(实验)',
|
||||
intro: '通过AI模型自动选择一个或多个工具进行调用。工具可以是其他功能块或插件。',
|
||||
intro: '通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。',
|
||||
showStatus: true,
|
||||
inputs: [
|
||||
Input_Template_Switch,
|
||||
{
|
||||
...Input_Template_AiModel,
|
||||
llmModelType: LLMModelTypeEnum.toolCall
|
||||
...Input_Template_SettingAiModel,
|
||||
llmModelType: LLMModelTypeEnum.all
|
||||
},
|
||||
{
|
||||
key: ModuleInputKeyEnum.aiChatTemperature,
|
||||
type: FlowNodeInputTypeEnum.hidden, // Set in the pop-up window
|
||||
label: '',
|
||||
value: 0,
|
||||
valueType: ModuleIOValueTypeEnum.number,
|
||||
min: 0,
|
||||
max: 10,
|
||||
step: 1,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false
|
||||
},
|
||||
{
|
||||
key: ModuleInputKeyEnum.aiChatMaxToken,
|
||||
type: FlowNodeInputTypeEnum.hidden, // Set in the pop-up window
|
||||
label: '',
|
||||
value: 2000,
|
||||
valueType: ModuleIOValueTypeEnum.number,
|
||||
min: 100,
|
||||
max: 4000,
|
||||
step: 50,
|
||||
showTargetInApp: false,
|
||||
showTargetInPlugin: false
|
||||
},
|
||||
{
|
||||
...Input_Template_System_Prompt,
|
||||
|
@@ -1,11 +1,15 @@
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import { userGuideTip } from '../tip';
|
||||
import { ModuleIOValueTypeEnum, ModuleInputKeyEnum, ModuleTemplateTypeEnum } from '../../constants';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
|
||||
export const UserGuideModule: FlowModuleTemplateType = {
|
||||
export const UserGuideModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.userGuide,
|
||||
templateType: ModuleTemplateTypeEnum.userGuide,
|
||||
templateType: FlowNodeTemplateTypeEnum.userGuide,
|
||||
flowType: FlowNodeTypeEnum.userGuide,
|
||||
avatar: '/imgs/module/userGuide.png',
|
||||
name: '全局配置',
|
||||
|
@@ -3,17 +3,17 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowModuleTemplateType } from '../../type.d';
|
||||
import { FlowNodeTemplateType } from '../../type.d';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleInputKeyEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
|
||||
export const UserInputModule: FlowModuleTemplateType = {
|
||||
export const UserInputModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.questionInput,
|
||||
templateType: ModuleTemplateTypeEnum.systemInput,
|
||||
templateType: FlowNodeTemplateTypeEnum.systemInput,
|
||||
flowType: FlowNodeTypeEnum.questionInput,
|
||||
avatar: '/imgs/module/userChatInput.svg',
|
||||
name: '对话入口',
|
||||
|
17
packages/global/core/module/type.d.ts
vendored
17
packages/global/core/module/type.d.ts
vendored
@@ -2,7 +2,7 @@ import { FlowNodeTypeEnum } from './node/constant';
|
||||
import {
|
||||
ModuleIOValueTypeEnum,
|
||||
ModuleOutputKeyEnum,
|
||||
ModuleTemplateTypeEnum,
|
||||
FlowNodeTemplateTypeEnum,
|
||||
VariableInputEnum
|
||||
} from './constants';
|
||||
import { DispatchNodeResponseKeyEnum } from './runtime/constants';
|
||||
@@ -15,10 +15,11 @@ import {
|
||||
} from '../chat/type';
|
||||
import { ChatNodeUsageType } from '../../support/wallet/bill/type';
|
||||
import { RunningModuleItemType } from './runtime/type';
|
||||
import { PluginTypeEnum } from 'core/plugin/constants';
|
||||
|
||||
export type FlowModuleTemplateType = {
|
||||
export type FlowNodeTemplateType = {
|
||||
id: string; // module id, unique
|
||||
templateType: `${ModuleTemplateTypeEnum}`;
|
||||
templateType: `${FlowNodeTemplateTypeEnum}`;
|
||||
flowType: `${FlowNodeTypeEnum}`; // render node card
|
||||
avatar?: string;
|
||||
name: string;
|
||||
@@ -27,14 +28,18 @@ export type FlowModuleTemplateType = {
|
||||
showStatus?: boolean; // chatting response step status
|
||||
inputs: FlowNodeInputItemType[];
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
|
||||
// plugin data
|
||||
pluginType?: `${PluginTypeEnum}`;
|
||||
parentId?: string;
|
||||
};
|
||||
export type FlowModuleItemType = FlowModuleTemplateType & {
|
||||
export type FlowModuleItemType = FlowNodeTemplateType & {
|
||||
moduleId: string;
|
||||
};
|
||||
export type moduleTemplateListType = {
|
||||
type: `${ModuleTemplateTypeEnum}`;
|
||||
type: `${FlowNodeTemplateTypeEnum}`;
|
||||
label: string;
|
||||
list: FlowModuleTemplateType[];
|
||||
list: FlowNodeTemplateType[];
|
||||
}[];
|
||||
|
||||
// store module type
|
||||
|
@@ -9,6 +9,7 @@ import { FlowNodeInputItemType, FlowNodeOutputItemType } from './node/type';
|
||||
import { AppTTSConfigType, ModuleItemType, VariableItemType } from './type';
|
||||
import { Input_Template_Switch } from './template/input';
|
||||
import { EditorVariablePickerType } from '../../../web/components/common/Textarea/PromptEditor/type';
|
||||
import { Output_Template_Finish } from './template/output';
|
||||
|
||||
/* module */
|
||||
export const getGuideModule = (modules: ModuleItemType[]) =>
|
||||
@@ -92,13 +93,16 @@ export const plugin2ModuleIO = (
|
||||
connected: false
|
||||
}))
|
||||
]
|
||||
: [],
|
||||
: [Input_Template_Switch],
|
||||
outputs: pluginOutput
|
||||
? pluginOutput.outputs.map((item) => ({
|
||||
...item,
|
||||
edit: false
|
||||
}))
|
||||
: []
|
||||
? [
|
||||
...pluginOutput.outputs.map((item) => ({
|
||||
...item,
|
||||
edit: false
|
||||
})),
|
||||
Output_Template_Finish
|
||||
]
|
||||
: [Output_Template_Finish]
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user