balibabu
feat: Add hint for operators, round to square, input variable, readable operator ID. #3056 (#3057)
4138aee
| import { LlmModelType } from '@/constants/knowledge'; | |
| import { useComposeLlmOptionsByModelTypes } from '@/hooks/llm-hooks'; | |
| import { useMemo } from 'react'; | |
| interface IProps { | |
| id?: string; | |
| value?: string; | |
| onChange?: (value: string) => void; | |
| disabled?: boolean; | |
| } | |
| const LLMLabel = ({ value }: IProps) => { | |
| const modelOptions = useComposeLlmOptionsByModelTypes([ | |
| LlmModelType.Chat, | |
| LlmModelType.Image2text, | |
| ]); | |
| const label = useMemo(() => { | |
| for (const item of modelOptions) { | |
| for (const option of item.options) { | |
| if (option.value === value) { | |
| return option.label; | |
| } | |
| } | |
| } | |
| }, [modelOptions, value]); | |
| return <div>{label}</div>; | |
| }; | |
| export default LLMLabel; | |