This commit is contained in:
StyleZhang
2024-03-14 18:27:34 +08:00
parent 5c246285da
commit d129d7951c
6 changed files with 72 additions and 35 deletions

View File

@ -1,5 +1,5 @@
import type { FC } from 'react'
import React from 'react'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import VarReferencePicker from '../_base/components/variable/var-reference-picker'
import useConfig from './use-config'
@ -11,6 +11,7 @@ import ModelParameterModal from '@/app/components/header/account-setting/model-p
import { InputVarType, type NodePanelProps } from '@/app/components/workflow/types'
import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form'
import ResultPanel from '@/app/components/workflow/run/result-panel'
import { useModelListAndDefaultModelAndCurrentProviderAndModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
const i18nPrefix = 'workflow.nodes.questionClassifiers'
@ -20,6 +21,10 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
}) => {
const { t } = useTranslation()
const readOnly = false
const {
currentProvider,
currentModel,
} = useModelListAndDefaultModelAndCurrentProviderAndModel(1)
const {
inputs,
@ -41,6 +46,15 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
const model = inputs.model
useEffect(() => {
if (currentProvider?.provider && currentModel?.model && !model.provider) {
handleModelChanged({
provider: currentProvider?.provider,
modelId: currentModel?.model,
})
}
}, [model.provider, currentProvider, currentModel, handleModelChanged])
return (
<div>
<div className='mt-2 px-4 space-y-4'>