import React from 'react' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' import { RiCloseLine, RiInformation2Fill } from '@remixicon/react' import DialogWrapper from '@/app/components/base/features/new-feature-panel/dialog-wrapper' import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import type { OnFeaturesChange } from '@/app/components/base/features/types' import MoreLikeThis from '@/app/components/base/features/new-feature-panel/more-like-this' import ConversationOpener from '@/app/components/base/features/new-feature-panel/conversation-opener' import FollowUp from '@/app/components/base/features/new-feature-panel/follow-up' 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 FileUpload from '@/app/components/base/features/new-feature-panel/file-upload' import Citation from '@/app/components/base/features/new-feature-panel/citation' import ImageUpload from '@/app/components/base/features/new-feature-panel/image-upload' import Moderation from '@/app/components/base/features/new-feature-panel/moderation' import AnnotationReply from '@/app/components/base/features/new-feature-panel/annotation-reply' import type { PromptVariable } from '@/models/debug' import type { InputVar } from '@/app/components/workflow/types' import I18n from '@/context/i18n' import { LanguagesSupported } from '@/i18n/language' type Props = { show: boolean isChatMode: boolean disabled: boolean onChange?: OnFeaturesChange onClose: () => void inWorkflow?: boolean showFileUpload?: boolean promptVariables?: PromptVariable[] workflowVariables?: InputVar[] onAutoAddPromptVariable?: (variable: PromptVariable[]) => void } const NewFeaturePanel = ({ show, isChatMode, disabled, onChange, onClose, inWorkflow = true, showFileUpload = true, promptVariables, workflowVariables, onAutoAddPromptVariable, }: Props) => { const { t } = useTranslation() const { locale } = useContext(I18n) const { data: speech2textDefaultModel } = useDefaultModel(ModelTypeEnum.speech2text) const { data: text2speechDefaultModel } = useDefaultModel(ModelTypeEnum.tts) return (
{/* header */}
{t('workflow.common.features')}
{t('workflow.common.featuresDescription')}
{/* list */}
{showFileUpload && (
{isChatMode ? t('workflow.common.fileUploadTip') : t('workflow.common.ImageUploadLegacyTip')} {t('workflow.common.featuresDocLink')}
)} {!isChatMode && !inWorkflow && ( )} {isChatMode && ( )} {isChatMode && ( )} {text2speechDefaultModel && (isChatMode || !inWorkflow) && ( )} {isChatMode && speech2textDefaultModel && ( )} {showFileUpload && isChatMode && } {showFileUpload && !isChatMode && } {isChatMode && ( )} {(isChatMode || !inWorkflow) && } {!inWorkflow && isChatMode && ( )}
) } export default NewFeaturePanel