feat: new input types

This commit is contained in:
Joel
2024-08-02 11:42:48 +08:00
parent 19dfc6d9a8
commit 0480bb03c3
9 changed files with 25 additions and 18 deletions

View File

@ -1,9 +1,8 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import { RiAlignLeft, RiCheckboxMultipleLine, RiFileCopy2Line, RiFileList2Line, RiHashtag, RiTextSnippet } from '@remixicon/react'
import { InputVarType } from '../../../types'
import { AlignLeft, LetterSpacing01 } from '@/app/components/base/icons/src/vender/line/editor'
import { CheckDone01, Hash02 } from '@/app/components/base/icons/src/vender/line/general'
type Props = {
className?: string
@ -12,11 +11,13 @@ type Props = {
const getIcon = (type: InputVarType) => {
return ({
[InputVarType.textInput]: LetterSpacing01,
[InputVarType.paragraph]: AlignLeft,
[InputVarType.select]: CheckDone01,
[InputVarType.number]: Hash02,
} as any)[type] || LetterSpacing01
[InputVarType.textInput]: RiTextSnippet,
[InputVarType.paragraph]: RiAlignLeft,
[InputVarType.select]: RiCheckboxMultipleLine,
[InputVarType.number]: RiHashtag,
[InputVarType.singleFile]: RiFileList2Line,
[InputVarType.multiFiles]: RiFileCopy2Line,
} as any)[type] || RiTextSnippet
}
const InputVarTypeIcon: FC<Props> = ({

View File

@ -79,6 +79,7 @@ const VarItem: FC<Props> = ({
isShowEditVarModal && (
<ConfigVarModal
isShow
supportFile
payload={payload}
onClose={hideEditVarModal}
onConfirm={handlePayloadChange}

View File

@ -117,6 +117,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
{isShowAddVarModal && (
<ConfigVarModal
isCreate
supportFile
isShow={isShowAddVarModal}
onClose={hideAddVarModal}
onConfirm={handleAddVarConfirm}

View File

@ -126,6 +126,8 @@ export enum InputVarType {
json = 'json', // obj, array
contexts = 'contexts', // knowledge retrieval
iterator = 'iterator', // iteration input
singleFile = 'single-file',
multiFiles = 'multi-files',
}
export type InputVar = {