import type { ReactNode } from 'react' import type { OnFeaturesChange } from '@/app/components/base/features/types' import type { InputVar } from '@/app/components/workflow/types' import type { PromptVariable } from '@/models/debug' import { DrawerCloseButton } from '@langgenius/dify-ui/drawer' import { useTranslation } from 'react-i18next' import AnnotationReply from '@/app/components/base/features/new-feature-panel/annotation-reply' import Citation from '@/app/components/base/features/new-feature-panel/citation' import ConversationOpener from '@/app/components/base/features/new-feature-panel/conversation-opener' import { FeaturePanelDrawer } from '@/app/components/base/features/new-feature-panel/feature-panel-drawer' import FileUpload from '@/app/components/base/features/new-feature-panel/file-upload' import FollowUp from '@/app/components/base/features/new-feature-panel/follow-up' import ImageUpload from '@/app/components/base/features/new-feature-panel/image-upload' import Moderation from '@/app/components/base/features/new-feature-panel/moderation' import MoreLikeThis from '@/app/components/base/features/new-feature-panel/more-like-this' import SpeechToText from '@/app/components/base/features/new-feature-panel/speech-to-text' import TextToSpeech from '@/app/components/base/features/new-feature-panel/text-to-speech' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' type Props = Readonly<{ show: boolean isChatMode: boolean disabled: boolean onChange?: OnFeaturesChange onClose: () => void inWorkflow?: boolean showFileUpload?: boolean showModeration?: boolean showAnnotationReply?: boolean promptVariables?: PromptVariable[] workflowVariables?: InputVar[] onAutoAddPromptVariable?: (variable: PromptVariable[]) => void title?: ReactNode description?: ReactNode drawerClassName?: string }> const NewFeaturePanel = ({ show, isChatMode, disabled, onChange, onClose, inWorkflow = true, showFileUpload = true, showModeration = true, showAnnotationReply = true, promptVariables, workflowVariables, onAutoAddPromptVariable, title, description, drawerClassName, }: Props) => { const { t } = useTranslation() const { data: speech2textDefaultModel } = useDefaultModel(ModelTypeEnum.speech2text) const { data: text2speechDefaultModel } = useDefaultModel(ModelTypeEnum.tts) return (
{/* header */}
{title ?? t(($) => $['common.features'], { ns: 'workflow' })}
{description ?? t(($) => $['common.featuresDescription'], { ns: 'workflow' })}
$['operation.close'], { ns: 'common' })} className="size-8 p-2" />
{/* list */}
{!isChatMode && !inWorkflow && } {isChatMode && ( )} {isChatMode && } {text2speechDefaultModel && (isChatMode || !inWorkflow) && ( )} {isChatMode && speech2textDefaultModel && ( )} {showFileUpload && isChatMode && } {showFileUpload && !isChatMode && } {isChatMode && } {showModeration && (isChatMode || !inWorkflow) && ( )} {showAnnotationReply && !inWorkflow && isChatMode && ( )}
) } export default NewFeaturePanel