diff --git a/web/app/components/app/configuration/index.tsx b/web/app/components/app/configuration/index.tsx index 1a3e687e04..69f764e5c8 100644 --- a/web/app/components/app/configuration/index.tsx +++ b/web/app/components/app/configuration/index.tsx @@ -110,7 +110,7 @@ const Configuration: FC = () => { const pathname = usePathname() const matched = pathname.match(/\/app\/([^/]+)/) const appId = (matched?.length && matched[1]) ? matched[1] : '' - const [mode, setMode] = useState() + const [mode, setMode] = useState(AppModeEnum.CHAT) const [publishedConfig, setPublishedConfig] = useState(null) const [conversationId, setConversationId] = useState('') @@ -705,8 +705,7 @@ const Configuration: FC = () => { provider: currentRerankProvider?.provider, model: currentRerankModel?.model, }) - setDatasetConfigs({ - retrieval_model: RETRIEVE_TYPE.multiWay, + const datasetConfigsToSet = { ...modelConfig.dataset_configs, ...retrievalConfig, ...(retrievalConfig.reranking_model ? { @@ -715,7 +714,9 @@ const Configuration: FC = () => { 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) })() }, [appId]) diff --git a/web/app/components/plugins/plugin-detail-panel/store.ts b/web/app/components/plugins/plugin-detail-panel/store.ts index 26b778f288..931b08215d 100644 --- a/web/app/components/plugins/plugin-detail-panel/store.ts +++ b/web/app/components/plugins/plugin-detail-panel/store.ts @@ -1,7 +1,22 @@ import { create } from 'zustand' -import type { PluginDetail } from '../types' +import type { + ParametersSchema, + PluginDeclaration, + PluginDetail, + PluginTriggerSubscriptionConstructor, +} from '../types' -export type SimpleDetail = Pick & { provider: string } +type TriggerDeclarationSummary = { + subscription_schema?: ParametersSchema[] + subscription_constructor?: PluginTriggerSubscriptionConstructor | null +} + +export type SimpleDetail = Pick & { + provider: string + declaration: Partial> & { + trigger?: TriggerDeclarationSummary + } +} type Shape = { detail: SimpleDetail | undefined diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx index 9eb7b90f88..dd5309559f 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx @@ -139,7 +139,7 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => { const { mutate: buildSubscription, isPending: isBuilding } = useBuildTriggerSubscription() const { mutate: updateBuilder } = useUpdateTriggerSubscriptionBuilder() - const manualPropertiesSchema = detail?.declaration.trigger.subscription_schema || [] // manual + const manualPropertiesSchema = detail?.declaration?.trigger?.subscription_schema || [] // manual const manualPropertiesFormRef = React.useRef(null) const subscriptionFormRef = React.useRef(null) diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx index 93589795a6..19de8206cf 100644 --- a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx +++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx @@ -297,14 +297,14 @@ const BasePanel: FC = ({ const { setDetail } = usePluginStore() useEffect(() => { - if (currentTriggerPlugin) { + if (currentTriggerPlugin?.subscription_constructor) { setDetail({ name: currentTriggerPlugin.label[language], plugin_id: currentTriggerPlugin.plugin_id || '', + plugin_unique_identifier: currentTriggerPlugin.plugin_unique_identifier || '', + id: currentTriggerPlugin.id, provider: currentTriggerPlugin.name, declaration: { - tool: undefined, - // @ts-expect-error just remain the necessary fields trigger: { subscription_schema: currentTriggerPlugin.subscription_schema || [], subscription_constructor: currentTriggerPlugin.subscription_constructor, @@ -312,7 +312,7 @@ const BasePanel: FC = ({ }, }) } - }, [currentTriggerPlugin, setDetail]) + }, [currentTriggerPlugin, language, setDetail]) const dataSourceList = useStore(s => s.dataSourceList) diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index cd79b9f3d9..bdd51f9cfb 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -22,6 +22,7 @@ import Switch from '@/app/components/base/switch' import { RiAlertFill, RiQuestionLine } from '@remixicon/react' import { fetchAndMergeValidCompletionParams } from '@/utils/completion-params' import Toast from '@/app/components/base/toast' +import { ModelModeType } from '@/types/app' const i18nPrefix = 'workflow.nodes.llm' @@ -94,6 +95,7 @@ const Panel: FC> = ({ } })() }, [inputs.model.completion_params]) + const modelMode = (model?.mode as ModelModeType | undefined) ?? ModelModeType.chat return (
@@ -106,7 +108,7 @@ const Panel: FC> = ({ popupClassName='!w-[387px]' isInWorkflow isAdvancedMode={true} - mode={model?.mode} + mode={modelMode} provider={model?.provider} completionParams={model?.completion_params} modelId={model?.name} diff --git a/web/app/components/workflow/nodes/parameter-extractor/panel.tsx b/web/app/components/workflow/nodes/parameter-extractor/panel.tsx index a169217609..fff3853273 100644 --- a/web/app/components/workflow/nodes/parameter-extractor/panel.tsx +++ b/web/app/components/workflow/nodes/parameter-extractor/panel.tsx @@ -19,6 +19,7 @@ import type { NodePanelProps } from '@/app/components/workflow/types' import Tooltip from '@/app/components/base/tooltip' import { VarType } from '@/app/components/workflow/types' import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse' +import { ModelModeType } from '@/types/app' const i18nPrefix = 'workflow.nodes.parameterExtractor' const i18nCommonPrefix = 'workflow.common' @@ -55,6 +56,7 @@ const Panel: FC> = ({ } = useConfig(id, data) const model = inputs.model + const modelMode = (model?.mode as ModelModeType | undefined) ?? ModelModeType.chat return (
@@ -67,7 +69,7 @@ const Panel: FC> = ({ popupClassName='!w-[387px]' isInWorkflow isAdvancedMode={true} - mode={model?.mode} + mode={modelMode} provider={model?.provider} completionParams={model?.completion_params} modelId={model?.name} diff --git a/web/app/components/workflow/nodes/question-classifier/panel.tsx b/web/app/components/workflow/nodes/question-classifier/panel.tsx index 8e27f5dceb..a0ce9ee346 100644 --- a/web/app/components/workflow/nodes/question-classifier/panel.tsx +++ b/web/app/components/workflow/nodes/question-classifier/panel.tsx @@ -13,6 +13,7 @@ import type { NodePanelProps } from '@/app/components/workflow/types' import Split from '@/app/components/workflow/nodes/_base/components/split' import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' import { FieldCollapse } from '@/app/components/workflow/nodes/_base/components/collapse' +import { ModelModeType } from '@/types/app' const i18nPrefix = 'workflow.nodes.questionClassifiers' @@ -44,6 +45,7 @@ const Panel: FC> = ({ } = useConfig(id, data) const model = inputs.model + const modelMode = (model?.mode as ModelModeType | undefined) ?? ModelModeType.chat return (
@@ -56,7 +58,7 @@ const Panel: FC> = ({ popupClassName='!w-[387px]' isInWorkflow isAdvancedMode={true} - mode={model?.mode} + mode={modelMode} provider={model?.provider} completionParams={model.completion_params} modelId={model.name} diff --git a/web/app/components/workflow/panel/global-variable-panel/index.tsx b/web/app/components/workflow/panel/global-variable-panel/index.tsx index 6a455cf571..a421a1605a 100644 --- a/web/app/components/workflow/panel/global-variable-panel/index.tsx +++ b/web/app/components/workflow/panel/global-variable-panel/index.tsx @@ -52,7 +52,7 @@ const Panel = () => { // is workflow ...((isWorkflowPage && !isChatMode) ? [{ name: 'timestamp', - value_type: 'integer' as const, + value_type: 'number' as const, description: t('workflow.globalVar.fieldsDescription.triggerTimestamp'), }] : []), ]