Browse Source

feat: add LLMSelect (#1270)

### What problem does this PR solve?

feat: add LLMSelect #918 

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
tags/v0.8.0
balibabu 1 year ago
parent
commit
d1ea429bdd
No account linked to committer's email address

+ 23
- 0
web/src/components/llm-select/index.tsx View File

import { Popover, Select } from 'antd';
import LlmSettingItems from '../llm-setting-items';

const LLMSelect = () => {
const content = (
<div>
<LlmSettingItems handleParametersChange={() => {}}></LlmSettingItems>
</div>
);

return (
<Popover content={content} trigger="click" placement="left" arrow={false}>
{/* <Button>Click me</Button> */}
<Select
defaultValue="lucy"
style={{ width: '100%' }}
dropdownStyle={{ display: 'none' }}
/>
</Popover>
);
};

export default LLMSelect;

+ 11
- 0
web/src/pages/flow/categorize-form/index.tsx View File

import LLMSelect from '@/components/llm-select';

const CategorizeForm = () => {
return (
<section>
<LLMSelect></LLMSelect>
</section>
);
};

export default CategorizeForm;

+ 8
- 0
web/src/pages/flow/constant.tsx View File

import { import {
DatabaseOutlined,
MergeCellsOutlined, MergeCellsOutlined,
RocketOutlined, RocketOutlined,
SendOutlined, SendOutlined,
Retrieval = 'Retrieval', Retrieval = 'Retrieval',
Generate = 'Generate', Generate = 'Generate',
Answer = 'Answer', Answer = 'Answer',
Categorize = 'Categorize',
} }


export const operatorIconMap = { export const operatorIconMap = {
[Operator.Generate]: MergeCellsOutlined, [Operator.Generate]: MergeCellsOutlined,
[Operator.Answer]: SendOutlined, [Operator.Answer]: SendOutlined,
[Operator.Begin]: SlidersOutlined, [Operator.Begin]: SlidersOutlined,
[Operator.Categorize]: DatabaseOutlined,
}; };


export const operatorMap = { export const operatorMap = {
[Operator.Generate]: { description: 'Generate description' }, [Operator.Generate]: { description: 'Generate description' },
[Operator.Answer]: { description: 'Answer description' }, [Operator.Answer]: { description: 'Answer description' },
[Operator.Begin]: { description: 'Begin description' }, [Operator.Begin]: { description: 'Begin description' },
[Operator.Categorize]: { description: 'Categorize description' },
}; };


export const componentMenuList = [ export const componentMenuList = [
name: Operator.Answer, name: Operator.Answer,
description: operatorMap[Operator.Answer].description, description: operatorMap[Operator.Answer].description,
}, },
{
name: Operator.Categorize,
description: operatorMap[Operator.Categorize].description,
},
]; ];


export const initialRetrievalValues = { export const initialRetrievalValues = {

+ 2
- 0
web/src/pages/flow/flow-drawer/index.tsx View File

import { Node } from 'reactflow'; import { Node } from 'reactflow';
import AnswerForm from '../answer-form'; import AnswerForm from '../answer-form';
import BeginForm from '../begin-form'; import BeginForm from '../begin-form';
import CategorizeForm from '../categorize-form';
import { Operator } from '../constant'; import { Operator } from '../constant';
import GenerateForm from '../generate-form'; import GenerateForm from '../generate-form';
import { useHandleFormValuesChange } from '../hooks'; import { useHandleFormValuesChange } from '../hooks';
[Operator.Retrieval]: RetrievalForm, [Operator.Retrieval]: RetrievalForm,
[Operator.Generate]: GenerateForm, [Operator.Generate]: GenerateForm,
[Operator.Answer]: AnswerForm, [Operator.Answer]: AnswerForm,
[Operator.Categorize]: CategorizeForm,
}; };


const FlowDrawer = ({ const FlowDrawer = ({

Loading…
Cancel
Save