mirror of https://github.com/langgenius/dify.git
fix: run tool cause page crash because of feature context
This commit is contained in:
parent
e2df3f182d
commit
27f65150d7
|
|
@ -1,13 +1,24 @@
|
|||
import { useMemo } from 'react'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { FlowType } from '@/types/common'
|
||||
import { Resolution, TransferMethod } from '@/types/app'
|
||||
|
||||
export const useConfigsMap = () => {
|
||||
const pipelineId = useStore(s => s.pipelineId)
|
||||
const fileUploadConfig = useStore(s => s.fileUploadConfig)
|
||||
return useMemo(() => {
|
||||
return {
|
||||
flowId: pipelineId!,
|
||||
flowType: FlowType.ragPipeline,
|
||||
fileSettings: {
|
||||
image: {
|
||||
enabled: false,
|
||||
detail: Resolution.high,
|
||||
number_limits: 3,
|
||||
transfer_methods: [TransferMethod.local_file, TransferMethod.remote_url],
|
||||
},
|
||||
fileUploadConfig,
|
||||
},
|
||||
}
|
||||
}, [pipelineId])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
import { useMemo } from 'react'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { FlowType } from '@/types/common'
|
||||
import { useFeatures } from '@/app/components/base/features/hooks'
|
||||
|
||||
export const useConfigsMap = () => {
|
||||
const appId = useStore(s => s.appId)
|
||||
const fileSettings = useFeatures(s => s.features.file)
|
||||
return useMemo(() => {
|
||||
return {
|
||||
flowId: appId!,
|
||||
flowType: FlowType.appFlow,
|
||||
fileSettings,
|
||||
}
|
||||
}, [appId])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import type {
|
|||
ValueSelector,
|
||||
} from '@/app/components/workflow/types'
|
||||
import type { FlowType } from '@/types/common'
|
||||
import type { FileUpload } from '../../base/features/types'
|
||||
|
||||
export type AvailableNodesMetaData = {
|
||||
nodes: NodeDefault[]
|
||||
|
|
@ -64,6 +65,7 @@ export type CommonHooksFnMap = {
|
|||
configsMap?: {
|
||||
flowId: string
|
||||
flowType: FlowType
|
||||
fileSettings: FileUpload
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ 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, 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'
|
||||
import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
|
||||
|
|
@ -25,6 +24,7 @@ import { BubbleX } from '@/app/components/base/icons/src/vender/line/others'
|
|||
import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
|
||||
import cn from '@/utils/classnames'
|
||||
import type { FileEntity } from '@/app/components/base/file-uploader/types'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
|
||||
type Props = {
|
||||
payload: InputVar
|
||||
|
|
@ -45,7 +45,8 @@ const FormItem: FC<Props> = ({
|
|||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { type } = payload
|
||||
const fileSettings = useFeatures(s => s.features.file)
|
||||
const fileSettings = useHooksStore(s => s.configsMap?.fileSettings)
|
||||
|
||||
const handleArrayItemChange = useCallback((index: number) => {
|
||||
return (newValue: any) => {
|
||||
const newValues = produce(value, (draft: any) => {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import { useWorkflowRun } from '../hooks'
|
|||
import type { StartNodeType } from '../nodes/start/types'
|
||||
import { TransferMethod } from '../../base/text-generation/types'
|
||||
import Button from '@/app/components/base/button'
|
||||
import { useFeatures } from '@/app/components/base/features/hooks'
|
||||
import {
|
||||
getProcessedInputs,
|
||||
} from '@/app/components/base/chat/chat/utils'
|
||||
import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input-forms-hooks'
|
||||
import { useHooksStore } from '../hooks-store'
|
||||
|
||||
type Props = {
|
||||
onRun: () => void
|
||||
|
|
@ -37,7 +37,7 @@ const InputsPanel = ({ onRun }: Props) => {
|
|||
inputs: s.inputs,
|
||||
setInputs: s.setInputs,
|
||||
}))
|
||||
const fileSettings = useFeatures(s => s.features.file)
|
||||
const fileSettings = useHooksStore(s => s.configsMap?.fileSettings)
|
||||
const nodes = useNodes<StartNodeType>()
|
||||
const files = useStore(s => s.files)
|
||||
const workflowRunningData = useStore(s => s.workflowRunningData)
|
||||
|
|
|
|||
Loading…
Reference in New Issue