mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
feat: question guide (#1508)
* feat: question guide * fix * fix * fix * change interface * fix
This commit is contained in:
@@ -18,3 +18,9 @@ export const defaultWhisperConfig: AppWhisperConfigType = {
|
||||
autoSend: false,
|
||||
autoTTSResponse: false
|
||||
};
|
||||
|
||||
export const defaultQuestionGuideTextConfig = {
|
||||
open: false,
|
||||
textList: [],
|
||||
customURL: ''
|
||||
};
|
||||
|
7
packages/global/core/app/type.d.ts
vendored
7
packages/global/core/app/type.d.ts
vendored
@@ -88,6 +88,7 @@ export type AppSimpleEditFormType = {
|
||||
};
|
||||
whisper: AppWhisperConfigType;
|
||||
scheduleTrigger: AppScheduledTriggerConfigType | null;
|
||||
questionGuideText: AppQuestionGuideTextConfigType;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -123,6 +124,12 @@ export type AppWhisperConfigType = {
|
||||
autoSend: boolean;
|
||||
autoTTSResponse: boolean;
|
||||
};
|
||||
// question guide text
|
||||
export type AppQuestionGuideTextConfigType = {
|
||||
open: boolean;
|
||||
textList: string[];
|
||||
customURL: string;
|
||||
};
|
||||
// interval timer
|
||||
export type AppScheduledTriggerConfigType = {
|
||||
cronString: string;
|
||||
|
@@ -5,7 +5,7 @@ import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
||||
import { getGuideModule, splitGuideModule } from '../workflow/utils';
|
||||
import { StoreNodeItemType } from '../workflow/type';
|
||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||
import { defaultWhisperConfig } from './constants';
|
||||
import { defaultQuestionGuideTextConfig, defaultWhisperConfig } from './constants';
|
||||
|
||||
export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
||||
return {
|
||||
@@ -35,7 +35,8 @@ export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
||||
type: 'web'
|
||||
},
|
||||
whisper: defaultWhisperConfig,
|
||||
scheduleTrigger: null
|
||||
scheduleTrigger: null,
|
||||
questionGuideText: defaultQuestionGuideTextConfig
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -109,7 +110,8 @@ export const appWorkflow2Form = ({ nodes }: { nodes: StoreNodeItemType[] }) => {
|
||||
questionGuide,
|
||||
ttsConfig,
|
||||
whisperConfig,
|
||||
scheduledTriggerConfig
|
||||
scheduledTriggerConfig,
|
||||
questionGuideText
|
||||
} = splitGuideModule(getGuideModule(nodes));
|
||||
|
||||
defaultAppForm.userGuide = {
|
||||
@@ -118,7 +120,8 @@ export const appWorkflow2Form = ({ nodes }: { nodes: StoreNodeItemType[] }) => {
|
||||
questionGuide: questionGuide,
|
||||
tts: ttsConfig,
|
||||
whisper: whisperConfig,
|
||||
scheduleTrigger: scheduledTriggerConfig
|
||||
scheduleTrigger: scheduledTriggerConfig,
|
||||
questionGuideText: questionGuideText
|
||||
};
|
||||
} else if (node.flowNodeType === FlowNodeTypeEnum.pluginModule) {
|
||||
if (!node.pluginId) return;
|
||||
|
@@ -45,6 +45,7 @@ export enum NodeInputKeyEnum {
|
||||
whisper = 'whisper',
|
||||
variables = 'variables',
|
||||
scheduleTrigger = 'scheduleTrigger',
|
||||
questionGuideText = 'questionGuideText',
|
||||
|
||||
// entry
|
||||
userChatInput = 'userChatInput',
|
||||
|
@@ -56,6 +56,12 @@ export const SystemConfigNode: FlowNodeTemplateType = {
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
label: ''
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.questionGuideText,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
label: ''
|
||||
}
|
||||
],
|
||||
outputs: []
|
||||
|
@@ -11,7 +11,8 @@ import type {
|
||||
VariableItemType,
|
||||
AppTTSConfigType,
|
||||
AppWhisperConfigType,
|
||||
AppScheduledTriggerConfigType
|
||||
AppScheduledTriggerConfigType,
|
||||
AppQuestionGuideTextConfigType
|
||||
} from '../app/type';
|
||||
import { EditorVariablePickerType } from '../../../web/components/common/Textarea/PromptEditor/type';
|
||||
import { defaultWhisperConfig } from '../app/constants';
|
||||
@@ -59,13 +60,20 @@ export const splitGuideModule = (guideModules?: StoreNodeItemType) => {
|
||||
guideModules?.inputs?.find((item) => item.key === NodeInputKeyEnum.scheduleTrigger)?.value ??
|
||||
null;
|
||||
|
||||
const questionGuideText: AppQuestionGuideTextConfigType = guideModules?.inputs?.find(
|
||||
(item) => item.key === NodeInputKeyEnum.questionGuideText
|
||||
)?.value || {
|
||||
open: false
|
||||
};
|
||||
|
||||
return {
|
||||
welcomeText,
|
||||
variableNodes,
|
||||
questionGuide,
|
||||
ttsConfig,
|
||||
whisperConfig,
|
||||
scheduledTriggerConfig
|
||||
scheduledTriggerConfig,
|
||||
questionGuideText
|
||||
};
|
||||
};
|
||||
export const replaceAppChatConfig = ({
|
||||
|
Reference in New Issue
Block a user