mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
feat: add plugin instruction config (#2579)
* feat: add plugin instruction config * fix build
This commit is contained in:
3
packages/global/core/app/type.d.ts
vendored
3
packages/global/core/app/type.d.ts
vendored
@@ -96,6 +96,9 @@ export type AppChatConfigType = {
|
||||
scheduledTriggerConfig?: AppScheduledTriggerConfigType;
|
||||
chatInputGuide?: ChatInputGuideConfigType;
|
||||
fileSelectConfig?: AppFileSelectConfigType;
|
||||
|
||||
// plugin
|
||||
instruction?: string;
|
||||
};
|
||||
export type SettingAIDataType = {
|
||||
model: string;
|
||||
|
@@ -52,6 +52,9 @@ export enum NodeInputKeyEnum {
|
||||
scheduleTrigger = 'scheduleTrigger',
|
||||
chatInputGuide = 'chatInputGuide',
|
||||
|
||||
// plugin config
|
||||
instruction = 'instruction',
|
||||
|
||||
// entry
|
||||
userChatInput = 'userChatInput',
|
||||
inputFiles = 'inputFiles',
|
||||
|
@@ -94,6 +94,7 @@ export enum FlowNodeOutputTypeEnum {
|
||||
export enum FlowNodeTypeEnum {
|
||||
emptyNode = 'emptyNode',
|
||||
systemConfig = 'userGuide',
|
||||
pluginConfig = 'pluginConfig',
|
||||
globalVariable = 'globalVariable',
|
||||
workflowStart = 'workflowStart',
|
||||
chatNode = 'chatNode',
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { SystemConfigNode } from './system/systemConfig';
|
||||
import { PluginConfigNode } from './system/pluginConfig';
|
||||
import { EmptyNode } from './system/emptyNode';
|
||||
import { WorkflowStart } from './system/workflowStart';
|
||||
import { AiChatModule } from './system/aiChat';
|
||||
@@ -57,6 +58,7 @@ export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
];
|
||||
/* plugin flow module templates */
|
||||
export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
PluginConfigNode,
|
||||
PluginInputModule,
|
||||
PluginOutputModule,
|
||||
...systemNodes
|
||||
|
@@ -0,0 +1,21 @@
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
|
||||
export const PluginConfigNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.pluginConfig,
|
||||
templateType: FlowNodeTemplateTypeEnum.systemInput,
|
||||
flowNodeType: FlowNodeTypeEnum.pluginConfig,
|
||||
sourceHandle: getHandleConfig(false, false, false, false),
|
||||
targetHandle: getHandleConfig(false, false, false, false),
|
||||
avatar: 'core/workflow/template/systemConfig',
|
||||
name: i18nT('workflow:template.system_config'),
|
||||
intro: '',
|
||||
unique: true,
|
||||
forbidDelete: true,
|
||||
version: '4811',
|
||||
inputs: [],
|
||||
outputs: []
|
||||
};
|
@@ -79,6 +79,10 @@ export const splitGuideModule = (guideModules?: StoreNodeItemType) => {
|
||||
guideModules?.inputs?.find((item) => item.key === NodeInputKeyEnum.chatInputGuide)?.value ||
|
||||
defaultChatInputGuideConfig;
|
||||
|
||||
// plugin
|
||||
const instruction: string =
|
||||
guideModules?.inputs?.find((item) => item.key === NodeInputKeyEnum.instruction)?.value || '';
|
||||
|
||||
return {
|
||||
welcomeText,
|
||||
variables,
|
||||
@@ -86,7 +90,8 @@ export const splitGuideModule = (guideModules?: StoreNodeItemType) => {
|
||||
ttsConfig,
|
||||
whisperConfig,
|
||||
scheduledTriggerConfig,
|
||||
chatInputGuide
|
||||
chatInputGuide,
|
||||
instruction
|
||||
};
|
||||
};
|
||||
|
||||
@@ -111,7 +116,8 @@ export const getAppChatConfig = ({
|
||||
ttsConfig,
|
||||
whisperConfig,
|
||||
scheduledTriggerConfig,
|
||||
chatInputGuide
|
||||
chatInputGuide,
|
||||
instruction
|
||||
} = splitGuideModule(systemConfigNode);
|
||||
|
||||
const config: AppChatConfigType = {
|
||||
@@ -120,6 +126,7 @@ export const getAppChatConfig = ({
|
||||
whisperConfig,
|
||||
scheduledTriggerConfig,
|
||||
chatInputGuide,
|
||||
instruction,
|
||||
...chatConfig,
|
||||
variables: storeVariables ?? chatConfig?.variables ?? variables,
|
||||
welcomeText: storeWelcomeText ?? chatConfig?.welcomeText ?? welcomeText
|
||||
|
Reference in New Issue
Block a user