mirror of https://github.com/langgenius/dify.git
fix: type
This commit is contained in:
parent
bc95678c5e
commit
99fac21bdb
|
|
@ -110,7 +110,7 @@ const Configuration: FC = () => {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const matched = pathname.match(/\/app\/([^/]+)/)
|
const matched = pathname.match(/\/app\/([^/]+)/)
|
||||||
const appId = (matched?.length && matched[1]) ? matched[1] : ''
|
const appId = (matched?.length && matched[1]) ? matched[1] : ''
|
||||||
const [mode, setMode] = useState<AppModeEnum>()
|
const [mode, setMode] = useState<AppModeEnum>(AppModeEnum.CHAT)
|
||||||
const [publishedConfig, setPublishedConfig] = useState<PublishConfig | null>(null)
|
const [publishedConfig, setPublishedConfig] = useState<PublishConfig | null>(null)
|
||||||
|
|
||||||
const [conversationId, setConversationId] = useState<string | null>('')
|
const [conversationId, setConversationId] = useState<string | null>('')
|
||||||
|
|
@ -705,8 +705,7 @@ const Configuration: FC = () => {
|
||||||
provider: currentRerankProvider?.provider,
|
provider: currentRerankProvider?.provider,
|
||||||
model: currentRerankModel?.model,
|
model: currentRerankModel?.model,
|
||||||
})
|
})
|
||||||
setDatasetConfigs({
|
const datasetConfigsToSet = {
|
||||||
retrieval_model: RETRIEVE_TYPE.multiWay,
|
|
||||||
...modelConfig.dataset_configs,
|
...modelConfig.dataset_configs,
|
||||||
...retrievalConfig,
|
...retrievalConfig,
|
||||||
...(retrievalConfig.reranking_model ? {
|
...(retrievalConfig.reranking_model ? {
|
||||||
|
|
@ -715,7 +714,9 @@ const Configuration: FC = () => {
|
||||||
reranking_provider_name: correctModelProvider(retrievalConfig.reranking_model.provider),
|
reranking_provider_name: correctModelProvider(retrievalConfig.reranking_model.provider),
|
||||||
},
|
},
|
||||||
} : {}),
|
} : {}),
|
||||||
} as DatasetConfigs)
|
} as DatasetConfigs
|
||||||
|
datasetConfigsToSet.retrieval_model = datasetConfigsToSet.retrieval_model ?? RETRIEVE_TYPE.multiWay
|
||||||
|
setDatasetConfigs(datasetConfigsToSet)
|
||||||
setHasFetchedDetail(true)
|
setHasFetchedDetail(true)
|
||||||
})()
|
})()
|
||||||
}, [appId])
|
}, [appId])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,22 @@
|
||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
import type { PluginDetail } from '../types'
|
import type {
|
||||||
|
ParametersSchema,
|
||||||
|
PluginDeclaration,
|
||||||
|
PluginDetail,
|
||||||
|
PluginTriggerSubscriptionConstructor,
|
||||||
|
} from '../types'
|
||||||
|
|
||||||
export type SimpleDetail = Pick<PluginDetail, 'plugin_id' | 'declaration' | 'name' | 'plugin_unique_identifier' | 'id'> & { provider: string }
|
type TriggerDeclarationSummary = {
|
||||||
|
subscription_schema?: ParametersSchema[]
|
||||||
|
subscription_constructor?: PluginTriggerSubscriptionConstructor | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SimpleDetail = Pick<PluginDetail, 'plugin_id' | 'name' | 'plugin_unique_identifier' | 'id'> & {
|
||||||
|
provider: string
|
||||||
|
declaration: Partial<Omit<PluginDeclaration, 'trigger'>> & {
|
||||||
|
trigger?: TriggerDeclarationSummary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Shape = {
|
type Shape = {
|
||||||
detail: SimpleDetail | undefined
|
detail: SimpleDetail | undefined
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => {
|
||||||
const { mutate: buildSubscription, isPending: isBuilding } = useBuildTriggerSubscription()
|
const { mutate: buildSubscription, isPending: isBuilding } = useBuildTriggerSubscription()
|
||||||
const { mutate: updateBuilder } = useUpdateTriggerSubscriptionBuilder()
|
const { mutate: updateBuilder } = useUpdateTriggerSubscriptionBuilder()
|
||||||
|
|
||||||
const manualPropertiesSchema = detail?.declaration.trigger.subscription_schema || [] // manual
|
const manualPropertiesSchema = detail?.declaration?.trigger?.subscription_schema || [] // manual
|
||||||
const manualPropertiesFormRef = React.useRef<FormRefObject>(null)
|
const manualPropertiesFormRef = React.useRef<FormRefObject>(null)
|
||||||
|
|
||||||
const subscriptionFormRef = React.useRef<FormRefObject>(null)
|
const subscriptionFormRef = React.useRef<FormRefObject>(null)
|
||||||
|
|
|
||||||
|
|
@ -297,14 +297,14 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||||
const { setDetail } = usePluginStore()
|
const { setDetail } = usePluginStore()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (currentTriggerPlugin) {
|
if (currentTriggerPlugin?.subscription_constructor) {
|
||||||
setDetail({
|
setDetail({
|
||||||
name: currentTriggerPlugin.label[language],
|
name: currentTriggerPlugin.label[language],
|
||||||
plugin_id: currentTriggerPlugin.plugin_id || '',
|
plugin_id: currentTriggerPlugin.plugin_id || '',
|
||||||
|
plugin_unique_identifier: currentTriggerPlugin.plugin_unique_identifier || '',
|
||||||
|
id: currentTriggerPlugin.id,
|
||||||
provider: currentTriggerPlugin.name,
|
provider: currentTriggerPlugin.name,
|
||||||
declaration: {
|
declaration: {
|
||||||
tool: undefined,
|
|
||||||
// @ts-expect-error just remain the necessary fields
|
|
||||||
trigger: {
|
trigger: {
|
||||||
subscription_schema: currentTriggerPlugin.subscription_schema || [],
|
subscription_schema: currentTriggerPlugin.subscription_schema || [],
|
||||||
subscription_constructor: currentTriggerPlugin.subscription_constructor,
|
subscription_constructor: currentTriggerPlugin.subscription_constructor,
|
||||||
|
|
@ -312,7 +312,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, [currentTriggerPlugin, setDetail])
|
}, [currentTriggerPlugin, language, setDetail])
|
||||||
|
|
||||||
const dataSourceList = useStore(s => s.dataSourceList)
|
const dataSourceList = useStore(s => s.dataSourceList)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import Switch from '@/app/components/base/switch'
|
||||||
import { RiAlertFill, RiQuestionLine } from '@remixicon/react'
|
import { RiAlertFill, RiQuestionLine } from '@remixicon/react'
|
||||||
import { fetchAndMergeValidCompletionParams } from '@/utils/completion-params'
|
import { fetchAndMergeValidCompletionParams } from '@/utils/completion-params'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
|
import { ModelModeType } from '@/types/app'
|
||||||
|
|
||||||
const i18nPrefix = 'workflow.nodes.llm'
|
const i18nPrefix = 'workflow.nodes.llm'
|
||||||
|
|
||||||
|
|
@ -94,6 +95,7 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
}, [inputs.model.completion_params])
|
}, [inputs.model.completion_params])
|
||||||
|
const modelMode = (model?.mode as ModelModeType | undefined) ?? ModelModeType.chat
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mt-2'>
|
<div className='mt-2'>
|
||||||
|
|
@ -106,7 +108,7 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||||
popupClassName='!w-[387px]'
|
popupClassName='!w-[387px]'
|
||||||
isInWorkflow
|
isInWorkflow
|
||||||
isAdvancedMode={true}
|
isAdvancedMode={true}
|
||||||
mode={model?.mode}
|
mode={modelMode}
|
||||||
provider={model?.provider}
|
provider={model?.provider}
|
||||||
completionParams={model?.completion_params}
|
completionParams={model?.completion_params}
|
||||||
modelId={model?.name}
|
modelId={model?.name}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import type { NodePanelProps } from '@/app/components/workflow/types'
|
||||||
import Tooltip from '@/app/components/base/tooltip'
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
import { VarType } from '@/app/components/workflow/types'
|
import { VarType } from '@/app/components/workflow/types'
|
||||||
import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse'
|
import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse'
|
||||||
|
import { ModelModeType } from '@/types/app'
|
||||||
|
|
||||||
const i18nPrefix = 'workflow.nodes.parameterExtractor'
|
const i18nPrefix = 'workflow.nodes.parameterExtractor'
|
||||||
const i18nCommonPrefix = 'workflow.common'
|
const i18nCommonPrefix = 'workflow.common'
|
||||||
|
|
@ -55,6 +56,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
|
||||||
} = useConfig(id, data)
|
} = useConfig(id, data)
|
||||||
|
|
||||||
const model = inputs.model
|
const model = inputs.model
|
||||||
|
const modelMode = (model?.mode as ModelModeType | undefined) ?? ModelModeType.chat
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='pt-2'>
|
<div className='pt-2'>
|
||||||
|
|
@ -67,7 +69,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
|
||||||
popupClassName='!w-[387px]'
|
popupClassName='!w-[387px]'
|
||||||
isInWorkflow
|
isInWorkflow
|
||||||
isAdvancedMode={true}
|
isAdvancedMode={true}
|
||||||
mode={model?.mode}
|
mode={modelMode}
|
||||||
provider={model?.provider}
|
provider={model?.provider}
|
||||||
completionParams={model?.completion_params}
|
completionParams={model?.completion_params}
|
||||||
modelId={model?.name}
|
modelId={model?.name}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import type { NodePanelProps } from '@/app/components/workflow/types'
|
||||||
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
import Split from '@/app/components/workflow/nodes/_base/components/split'
|
||||||
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
|
import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars'
|
||||||
import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse'
|
import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse'
|
||||||
|
import { ModelModeType } from '@/types/app'
|
||||||
|
|
||||||
const i18nPrefix = 'workflow.nodes.questionClassifiers'
|
const i18nPrefix = 'workflow.nodes.questionClassifiers'
|
||||||
|
|
||||||
|
|
@ -44,6 +45,7 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
|
||||||
} = useConfig(id, data)
|
} = useConfig(id, data)
|
||||||
|
|
||||||
const model = inputs.model
|
const model = inputs.model
|
||||||
|
const modelMode = (model?.mode as ModelModeType | undefined) ?? ModelModeType.chat
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='pt-2'>
|
<div className='pt-2'>
|
||||||
|
|
@ -56,7 +58,7 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
|
||||||
popupClassName='!w-[387px]'
|
popupClassName='!w-[387px]'
|
||||||
isInWorkflow
|
isInWorkflow
|
||||||
isAdvancedMode={true}
|
isAdvancedMode={true}
|
||||||
mode={model?.mode}
|
mode={modelMode}
|
||||||
provider={model?.provider}
|
provider={model?.provider}
|
||||||
completionParams={model.completion_params}
|
completionParams={model.completion_params}
|
||||||
modelId={model.name}
|
modelId={model.name}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ const Panel = () => {
|
||||||
// is workflow
|
// is workflow
|
||||||
...((isWorkflowPage && !isChatMode) ? [{
|
...((isWorkflowPage && !isChatMode) ? [{
|
||||||
name: 'timestamp',
|
name: 'timestamp',
|
||||||
value_type: 'integer' as const,
|
value_type: 'number' as const,
|
||||||
description: t('workflow.globalVar.fieldsDescription.triggerTimestamp'),
|
description: t('workflow.globalVar.fieldsDescription.triggerTimestamp'),
|
||||||
}] : []),
|
}] : []),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue