mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: model parameter default value (#3841)
This commit is contained in:
parent
12435774ca
commit
cde87cb225
|
@ -2,7 +2,7 @@ import type {
|
|||
FC,
|
||||
ReactNode,
|
||||
} from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import useSWR from 'swr'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import cn from 'classnames'
|
||||
|
@ -16,7 +16,6 @@ import ModelSelector from '../model-selector'
|
|||
import {
|
||||
useTextGenerationCurrentProviderAndModelAndModelList,
|
||||
} from '../hooks'
|
||||
import { isNullOrUndefined } from '../utils'
|
||||
import ParameterItem from './parameter-item'
|
||||
import type { ParameterValue } from './parameter-item'
|
||||
import Trigger from './trigger'
|
||||
|
@ -139,26 +138,6 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
|
|||
}
|
||||
}
|
||||
|
||||
const handleInitialParams = () => {
|
||||
const newCompletionParams = { ...completionParams }
|
||||
if (parameterRules.length) {
|
||||
parameterRules.forEach((parameterRule) => {
|
||||
if (!newCompletionParams[parameterRule.name]) {
|
||||
if (!isNullOrUndefined(parameterRule.default))
|
||||
newCompletionParams[parameterRule.name] = parameterRule.default
|
||||
else
|
||||
delete newCompletionParams[parameterRule.name]
|
||||
}
|
||||
})
|
||||
|
||||
onCompletionParamsChange(newCompletionParams)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleInitialParams()
|
||||
}, [parameterRules])
|
||||
|
||||
const handleSelectPresetParameter = (toneId: number) => {
|
||||
const tone = TONE_LIST.find(tone => tone.id === toneId)
|
||||
if (tone) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user