mirror of https://github.com/langgenius/dify.git
feat: Update OptionsField to use correct Options type and enhance Zod schema generation for options and select input types
This commit is contained in:
parent
fd8ee9f53e
commit
839fe12087
|
|
@ -2,6 +2,7 @@ import cn from '@/utils/classnames'
|
|||
import { useFieldContext } from '../..'
|
||||
import type { LabelProps } from '../label'
|
||||
import Label from '../label'
|
||||
import type { Options } from '@/app/components/app/configuration/config-var/config-select'
|
||||
import ConfigSelect from '@/app/components/app/configuration/config-var/config-select'
|
||||
|
||||
type OptionsFieldProps = {
|
||||
|
|
@ -15,7 +16,7 @@ const OptionsField = ({
|
|||
className,
|
||||
labelOptions,
|
||||
}: OptionsFieldProps) => {
|
||||
const field = useFieldContext<string[]>()
|
||||
const field = useFieldContext<Options>()
|
||||
|
||||
return (
|
||||
<div className={cn('flex flex-col gap-y-0.5', className)}>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ export const generateZodSchema = <T>(fields: InputFieldConfiguration<T>[]) => {
|
|||
case InputFieldType.checkbox:
|
||||
zodType = z.boolean()
|
||||
break
|
||||
case InputFieldType.options:
|
||||
zodType = z.array(z.string())
|
||||
break
|
||||
case InputFieldType.select:
|
||||
zodType = z.string()
|
||||
break
|
||||
case InputFieldType.fileTypes:
|
||||
zodType = z.array(z.string())
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in New Issue