feat: Add hint for operators, round to square, input variable, readable operator ID. #3056 (#3057)

### What problem does this PR solve?

feat: Add hint for operators, round to square, input variable, readable
operator ID. #3056

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
This commit is contained in:
balibabu
2024-10-28 14:31:19 +08:00
committed by GitHub
parent f93f485696
commit 396feadd4b
56 changed files with 1368 additions and 585 deletions

View File

@ -0,0 +1,3 @@
.llmLabel {
font-size: 14px;
}

View File

@ -7,9 +7,10 @@ interface IProps {
id?: string;
value?: string;
onChange?: (value: string) => void;
disabled?: boolean;
}
const LLMSelect = ({ id, value, onChange }: IProps) => {
const LLMSelect = ({ id, value, onChange, disabled }: IProps) => {
const modelOptions = useComposeLlmOptionsByModelTypes([
LlmModelType.Chat,
LlmModelType.Image2text,
@ -38,6 +39,7 @@ const LLMSelect = ({ id, value, onChange }: IProps) => {
id={id}
value={value}
onChange={onChange}
disabled={disabled}
/>
</Popover>
);

View File

@ -0,0 +1,31 @@
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;