mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-18 17:45:52 +08:00
fix step run of file type
This commit is contained in:
parent
8b26ae6532
commit
dc5010d833
@ -61,7 +61,7 @@ const NewFeaturePanel = ({
|
||||
</div>
|
||||
{/* list */}
|
||||
<div className='grow overflow-y-auto px-4 pb-4'>
|
||||
{!isChatMode && (
|
||||
{!isChatMode && !inWorkflow && (
|
||||
<MoreLikeThis disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{isChatMode && (
|
||||
@ -72,20 +72,20 @@ const NewFeaturePanel = ({
|
||||
onAutoAddPromptVariable={onAutoAddPromptVariable}
|
||||
/>
|
||||
)}
|
||||
<Moderation disabled={disabled} onChange={onChange} />
|
||||
{isChatMode && speech2textDefaultModel && (
|
||||
<SpeechToText disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{text2speechDefaultModel && (
|
||||
<TextToSpeech disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{showFileUpload && <FileUpload disabled={disabled} onChange={onChange} />}
|
||||
{isChatMode && (
|
||||
<FollowUp disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{text2speechDefaultModel && (isChatMode || !inWorkflow) && (
|
||||
<TextToSpeech disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{isChatMode && speech2textDefaultModel && (
|
||||
<SpeechToText disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{showFileUpload && isChatMode && <FileUpload disabled={disabled} onChange={onChange} />}
|
||||
{isChatMode && (
|
||||
<Citation disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
{(isChatMode || !inWorkflow) && <Moderation disabled={disabled} onChange={onChange} />}
|
||||
{!inWorkflow && isChatMode && (
|
||||
<AnnotationReply disabled={disabled} onChange={onChange} />
|
||||
)}
|
||||
|
@ -14,6 +14,7 @@ import TextGenerationImageUploader from '@/app/components/base/image-uploader/te
|
||||
import type { VisionFile, VisionSettings } from '@/types/app'
|
||||
import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader'
|
||||
import { getProcessedFiles } from '@/app/components/base/file-uploader/utils'
|
||||
// import { InputVarType } from '@/app/components/workflow/types'
|
||||
|
||||
export type IRunOnceProps = {
|
||||
siteInfo: SiteInfo
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
useCallback,
|
||||
useMemo,
|
||||
} from 'react'
|
||||
import { RiApps2AddLine } from '@remixicon/react'
|
||||
import { useNodes } from 'reactflow'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useContext } from 'use-context-selector'
|
||||
@ -46,7 +47,7 @@ const Header: FC = () => {
|
||||
const appSidebarExpand = useAppStore(s => s.appSidebarExpand)
|
||||
const appID = appDetail?.id
|
||||
const isChatMode = useIsChatMode()
|
||||
const { nodesReadOnly } = useNodesReadOnly()
|
||||
const { nodesReadOnly, getNodesReadOnly } = useNodesReadOnly()
|
||||
const publishedAt = useStore(s => s.publishedAt)
|
||||
const draftUpdatedAt = useStore(s => s.draftUpdatedAt)
|
||||
const toolPublished = useStore(s => s.toolPublished)
|
||||
@ -85,6 +86,17 @@ const Header: FC = () => {
|
||||
viewHistory,
|
||||
} = useWorkflowMode()
|
||||
|
||||
const handleShowFeatures = useCallback(() => {
|
||||
const {
|
||||
showFeaturesPanel,
|
||||
isRestoring,
|
||||
setShowFeaturesPanel,
|
||||
} = workflowStore.getState()
|
||||
if (getNodesReadOnly() && !isRestoring)
|
||||
return
|
||||
setShowFeaturesPanel(!showFeaturesPanel)
|
||||
}, [workflowStore, getNodesReadOnly])
|
||||
|
||||
const handleCancelRestore = useCallback(() => {
|
||||
handleLoadBackupDraft()
|
||||
workflowStore.setState({ isRestoring: false })
|
||||
@ -161,6 +173,10 @@ const Header: FC = () => {
|
||||
<EnvButton disabled={nodesReadOnly} />
|
||||
<div className='w-[1px] h-3.5 bg-gray-200'></div>
|
||||
<RunAndHistory />
|
||||
<Button className='text-components-button-secondary-text' onClick={handleShowFeatures}>
|
||||
<RiApps2AddLine className='w-4 h-4 mr-1 text-components-button-secondary-text' />
|
||||
{t('workflow.common.features')}
|
||||
</Button>
|
||||
<AppPublisher
|
||||
{...{
|
||||
publishedAt,
|
||||
@ -197,6 +213,11 @@ const Header: FC = () => {
|
||||
{
|
||||
restoring && (
|
||||
<div className='flex items-center'>
|
||||
<Button className='text-components-button-secondary-text' onClick={handleShowFeatures}>
|
||||
<RiApps2AddLine className='w-4 h-4 mr-1 text-components-button-secondary-text' />
|
||||
{t('workflow.common.features')}
|
||||
</Button>
|
||||
<div className='mx-2 w-[1px] h-3.5 bg-gray-200'></div>
|
||||
<Button
|
||||
className='mr-2'
|
||||
onClick={handleCancelRestore}
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
RiDeleteBinLine,
|
||||
} from '@remixicon/react'
|
||||
import type { InputVar } from '../../../../types'
|
||||
import { BlockEnum, InputVarType } from '../../../../types'
|
||||
import { BlockEnum, InputVarType, SupportUploadFileTypes } from '../../../../types'
|
||||
import CodeEditor from '../editor/code-editor'
|
||||
import { CodeLanguage } from '../../../code/types'
|
||||
import TextEditor from '../editor/text-editor'
|
||||
@ -16,7 +16,7 @@ import Input from '@/app/components/base/input'
|
||||
import Textarea from '@/app/components/base/textarea'
|
||||
import TextGenerationImageUploader from '@/app/components/base/image-uploader/text-generation-image-uploader'
|
||||
import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader'
|
||||
import { Resolution } from '@/types/app'
|
||||
import { Resolution, TransferMethod } from '@/types/app'
|
||||
import { useFeatures } from '@/app/components/base/features/hooks'
|
||||
import { VarBlockIcon } from '@/app/components/workflow/block-icon'
|
||||
import { Line3 } from '@/app/components/base/icons/src/public/common'
|
||||
@ -31,6 +31,7 @@ type Props = {
|
||||
onChange: (value: any) => void
|
||||
className?: string
|
||||
autoFocus?: boolean
|
||||
inStepRun?: boolean
|
||||
}
|
||||
|
||||
const FormItem: FC<Props> = ({
|
||||
@ -39,6 +40,7 @@ const FormItem: FC<Props> = ({
|
||||
onChange,
|
||||
className,
|
||||
autoFocus,
|
||||
inStepRun = false,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { type } = payload
|
||||
@ -164,9 +166,9 @@ const FormItem: FC<Props> = ({
|
||||
onChange(getProcessedFiles(files)[0])
|
||||
}}
|
||||
fileConfig={{
|
||||
allowed_file_types: payload.allowed_file_types,
|
||||
allowed_file_extensions: payload.allowed_file_extensions,
|
||||
allowed_file_upload_methods: payload.allowed_file_upload_methods,
|
||||
allowed_file_types: inStepRun ? [SupportUploadFileTypes.custom] : payload.allowed_file_types,
|
||||
allowed_file_extensions: inStepRun ? [] : payload.allowed_file_extensions,
|
||||
allowed_file_upload_methods: inStepRun ? [TransferMethod.local_file, TransferMethod.remote_url] : payload.allowed_file_upload_methods,
|
||||
number_limits: 1,
|
||||
}}
|
||||
/>
|
||||
@ -175,10 +177,10 @@ const FormItem: FC<Props> = ({
|
||||
<FileUploaderInAttachmentWrapper
|
||||
onChange={files => onChange(getProcessedFiles(files))}
|
||||
fileConfig={{
|
||||
allowed_file_types: payload.allowed_file_types,
|
||||
allowed_file_extensions: payload.allowed_file_extensions,
|
||||
allowed_file_upload_methods: payload.allowed_file_upload_methods,
|
||||
number_limits: payload.max_length,
|
||||
allowed_file_types: inStepRun ? [SupportUploadFileTypes.custom] : payload.allowed_file_types,
|
||||
allowed_file_extensions: inStepRun ? [] : payload.allowed_file_extensions,
|
||||
allowed_file_upload_methods: inStepRun ? [TransferMethod.local_file, TransferMethod.remote_url] : payload.allowed_file_upload_methods,
|
||||
number_limits: inStepRun ? 5 : payload.max_length,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
@ -80,6 +80,7 @@ const Form: FC<Props> = ({
|
||||
{inputs.map((input, index) => {
|
||||
return (
|
||||
<FormItem
|
||||
inStepRun
|
||||
key={index}
|
||||
payload={input}
|
||||
value={values[input.variable]}
|
||||
|
@ -83,7 +83,7 @@ const varTypeToInputVarType = (type: VarType, {
|
||||
if (type === VarType.file)
|
||||
return InputVarType.singleFile
|
||||
if (type === VarType.arrayFile)
|
||||
return InputVarType.files
|
||||
return InputVarType.multiFiles
|
||||
|
||||
return InputVarType.textInput
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user