Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.5 KB
Raw Blame
'use client'
import type { ComponentPropsWithRef, ReactElement } from 'react'
import type { OnFeaturesChange } from '@/app/components/base/features/types'
import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'
import { memo } from 'react'
import SettingContent from '@/app/components/base/features/new-feature-panel/file-upload/setting-content'

type FileUploadSettingsProps = {
  open: boolean
  onOpen: (state: boolean) => void
  onChange?: OnFeaturesChange
  disabled?: boolean
  children: ReactElement<ComponentPropsWithRef<'button'>>
  imageUpload?: boolean
}
const FileUploadSettings = ({
  open,
  onOpen,
  onChange,
  disabled,
  children,
  imageUpload,
}: FileUploadSettingsProps) => {
  return (
    <Popover
      open={open}
      onOpenChange={(nextOpen) => {
        if (disabled) return
        onOpen(nextOpen)
      }}
    >
      <PopoverTrigger disabled={disabled} render={children} />
      <PopoverContent
        side="left"
        sideOffset={32}
        className="border-none bg-transparent shadow-none"
      >
        <div className="max-h-[calc(100vh-20px)] w-90 overflow-y-auto rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg p-4 shadow-2xl">
          <SettingContent
            imageUpload={imageUpload}
            onClose={() => onOpen(false)}
            onChange={(v) => {
              onChange?.(v)
              onOpen(false)
            }}
          />
        </div>
      </PopoverContent>
    </Popover>
  )
}
export default memo(FileUploadSettings)