2024-01-04 14:39:33 +07:00

35 lines
1.0 KiB
TypeScript

/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react'
import { useAtomValue } from 'jotai'
import { selectedModelAtom } from '@/containers/DropdownListSidebar'
import { getConfigurationsData } from '@/utils/componentSettings'
import { toRuntimeParams } from '@/utils/model_param'
import settingComponentBuilder from './settingComponentBuilder'
import { getActiveThreadModelParamsAtom } from '@/helpers/atoms/Thread.atom'
const ModelSetting = (props: { form: any }) => {
const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom)
const selectedModel = useAtomValue(selectedModelAtom)
if (!selectedModel || !activeModelParams) return null
const modelRuntimeParams = toRuntimeParams(activeModelParams)
const componentData = getConfigurationsData(modelRuntimeParams)
componentData.sort((a, b) => a.title.localeCompare(b.title))
return (
<div className="flex flex-col">
{settingComponentBuilder(componentData, props.form)}
</div>
)
}
export default React.memo(ModelSetting)