mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
feat: http modules
This commit is contained in:
@@ -75,11 +75,17 @@ export const appModule2FlowNode = ({
|
||||
const template =
|
||||
ModuleTemplatesFlat.find((template) => template.flowType === item.flowType) || EmptyModule;
|
||||
|
||||
const concatInputs = template.inputs.concat(
|
||||
item.inputs.filter(
|
||||
(input) => input.label && !template.inputs.find((item) => item.key === input.key)
|
||||
)
|
||||
);
|
||||
|
||||
// replace item data
|
||||
const moduleItem: FlowModuleItemType = {
|
||||
...item,
|
||||
...template,
|
||||
inputs: template.inputs.map((templateInput) => {
|
||||
inputs: concatInputs.map((templateInput) => {
|
||||
// use latest inputs
|
||||
const itemInput = item.inputs.find((item) => item.key === templateInput.key) || templateInput;
|
||||
return {
|
||||
@@ -87,7 +93,6 @@ export const appModule2FlowNode = ({
|
||||
value: itemInput.value
|
||||
};
|
||||
}),
|
||||
// 合并 template 和数据库,文案以 template 为准
|
||||
outputs: item.outputs.map((output) => {
|
||||
// unChange outputs
|
||||
const templateOutput = template.outputs.find((item) => item.key === output.key);
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import type { AppModuleInputItemType, AppModuleItemType, VariableItemType } from '@/types/app';
|
||||
import type { AppModuleItemType, VariableItemType } from '@/types/app';
|
||||
import { chatModelList, vectorModelList } from '@/store/static';
|
||||
import { FlowModuleTypeEnum, SpecialInputKeyEnum } from '@/constants/flow';
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { TaskResponseKeyEnum } from '@/constants/chat';
|
||||
import type { SelectedKbType } from '@/types/plugin';
|
||||
import { FlowInputItemType } from '@/types/flow';
|
||||
|
||||
export type EditFormType = {
|
||||
chatModel: {
|
||||
@@ -64,7 +65,7 @@ export const appModules2Form = (modules: AppModuleItemType[]) => {
|
||||
key
|
||||
}: {
|
||||
formKey: string;
|
||||
inputs: AppModuleInputItemType[];
|
||||
inputs: FlowInputItemType[];
|
||||
key: string;
|
||||
}) => {
|
||||
const propertyPath = formKey.split('.');
|
||||
@@ -148,7 +149,7 @@ export const appModules2Form = (modules: AppModuleItemType[]) => {
|
||||
return defaultAppForm;
|
||||
};
|
||||
|
||||
const chatModelInput = (formData: EditFormType): AppModuleInputItemType[] => [
|
||||
const chatModelInput = (formData: EditFormType): FlowInputItemType[] => [
|
||||
{
|
||||
key: 'model',
|
||||
value: formData.chatModel.model,
|
||||
|
Reference in New Issue
Block a user