balibabu
commited on
Commit
·
70b1cb8
1
Parent(s):
622e082
feat: add LLMSelect (#1270)
Browse files### What problem does this PR solve?
feat: add LLMSelect #918
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/components/llm-select/index.tsx
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Popover, Select } from 'antd';
|
| 2 |
+
import LlmSettingItems from '../llm-setting-items';
|
| 3 |
+
|
| 4 |
+
const LLMSelect = () => {
|
| 5 |
+
const content = (
|
| 6 |
+
<div>
|
| 7 |
+
<LlmSettingItems handleParametersChange={() => {}}></LlmSettingItems>
|
| 8 |
+
</div>
|
| 9 |
+
);
|
| 10 |
+
|
| 11 |
+
return (
|
| 12 |
+
<Popover content={content} trigger="click" placement="left" arrow={false}>
|
| 13 |
+
{/* <Button>Click me</Button> */}
|
| 14 |
+
<Select
|
| 15 |
+
defaultValue="lucy"
|
| 16 |
+
style={{ width: '100%' }}
|
| 17 |
+
dropdownStyle={{ display: 'none' }}
|
| 18 |
+
/>
|
| 19 |
+
</Popover>
|
| 20 |
+
);
|
| 21 |
+
};
|
| 22 |
+
|
| 23 |
+
export default LLMSelect;
|
web/src/pages/flow/categorize-form/index.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import LLMSelect from '@/components/llm-select';
|
| 2 |
+
|
| 3 |
+
const CategorizeForm = () => {
|
| 4 |
+
return (
|
| 5 |
+
<section>
|
| 6 |
+
<LLMSelect></LLMSelect>
|
| 7 |
+
</section>
|
| 8 |
+
);
|
| 9 |
+
};
|
| 10 |
+
|
| 11 |
+
export default CategorizeForm;
|
web/src/pages/flow/constant.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import {
|
|
|
|
| 2 |
MergeCellsOutlined,
|
| 3 |
RocketOutlined,
|
| 4 |
SendOutlined,
|
|
@@ -10,6 +11,7 @@ export enum Operator {
|
|
| 10 |
Retrieval = 'Retrieval',
|
| 11 |
Generate = 'Generate',
|
| 12 |
Answer = 'Answer',
|
|
|
|
| 13 |
}
|
| 14 |
|
| 15 |
export const operatorIconMap = {
|
|
@@ -17,6 +19,7 @@ export const operatorIconMap = {
|
|
| 17 |
[Operator.Generate]: MergeCellsOutlined,
|
| 18 |
[Operator.Answer]: SendOutlined,
|
| 19 |
[Operator.Begin]: SlidersOutlined,
|
|
|
|
| 20 |
};
|
| 21 |
|
| 22 |
export const operatorMap = {
|
|
@@ -26,6 +29,7 @@ export const operatorMap = {
|
|
| 26 |
[Operator.Generate]: { description: 'Generate description' },
|
| 27 |
[Operator.Answer]: { description: 'Answer description' },
|
| 28 |
[Operator.Begin]: { description: 'Begin description' },
|
|
|
|
| 29 |
};
|
| 30 |
|
| 31 |
export const componentMenuList = [
|
|
@@ -41,6 +45,10 @@ export const componentMenuList = [
|
|
| 41 |
name: Operator.Answer,
|
| 42 |
description: operatorMap[Operator.Answer].description,
|
| 43 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
];
|
| 45 |
|
| 46 |
export const initialRetrievalValues = {
|
|
|
|
| 1 |
import {
|
| 2 |
+
DatabaseOutlined,
|
| 3 |
MergeCellsOutlined,
|
| 4 |
RocketOutlined,
|
| 5 |
SendOutlined,
|
|
|
|
| 11 |
Retrieval = 'Retrieval',
|
| 12 |
Generate = 'Generate',
|
| 13 |
Answer = 'Answer',
|
| 14 |
+
Categorize = 'Categorize',
|
| 15 |
}
|
| 16 |
|
| 17 |
export const operatorIconMap = {
|
|
|
|
| 19 |
[Operator.Generate]: MergeCellsOutlined,
|
| 20 |
[Operator.Answer]: SendOutlined,
|
| 21 |
[Operator.Begin]: SlidersOutlined,
|
| 22 |
+
[Operator.Categorize]: DatabaseOutlined,
|
| 23 |
};
|
| 24 |
|
| 25 |
export const operatorMap = {
|
|
|
|
| 29 |
[Operator.Generate]: { description: 'Generate description' },
|
| 30 |
[Operator.Answer]: { description: 'Answer description' },
|
| 31 |
[Operator.Begin]: { description: 'Begin description' },
|
| 32 |
+
[Operator.Categorize]: { description: 'Categorize description' },
|
| 33 |
};
|
| 34 |
|
| 35 |
export const componentMenuList = [
|
|
|
|
| 45 |
name: Operator.Answer,
|
| 46 |
description: operatorMap[Operator.Answer].description,
|
| 47 |
},
|
| 48 |
+
{
|
| 49 |
+
name: Operator.Categorize,
|
| 50 |
+
description: operatorMap[Operator.Categorize].description,
|
| 51 |
+
},
|
| 52 |
];
|
| 53 |
|
| 54 |
export const initialRetrievalValues = {
|
web/src/pages/flow/flow-drawer/index.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { useEffect } from 'react';
|
|
| 4 |
import { Node } from 'reactflow';
|
| 5 |
import AnswerForm from '../answer-form';
|
| 6 |
import BeginForm from '../begin-form';
|
|
|
|
| 7 |
import { Operator } from '../constant';
|
| 8 |
import GenerateForm from '../generate-form';
|
| 9 |
import { useHandleFormValuesChange } from '../hooks';
|
|
@@ -18,6 +19,7 @@ const FormMap = {
|
|
| 18 |
[Operator.Retrieval]: RetrievalForm,
|
| 19 |
[Operator.Generate]: GenerateForm,
|
| 20 |
[Operator.Answer]: AnswerForm,
|
|
|
|
| 21 |
};
|
| 22 |
|
| 23 |
const FlowDrawer = ({
|
|
|
|
| 4 |
import { Node } from 'reactflow';
|
| 5 |
import AnswerForm from '../answer-form';
|
| 6 |
import BeginForm from '../begin-form';
|
| 7 |
+
import CategorizeForm from '../categorize-form';
|
| 8 |
import { Operator } from '../constant';
|
| 9 |
import GenerateForm from '../generate-form';
|
| 10 |
import { useHandleFormValuesChange } from '../hooks';
|
|
|
|
| 19 |
[Operator.Retrieval]: RetrievalForm,
|
| 20 |
[Operator.Generate]: GenerateForm,
|
| 21 |
[Operator.Answer]: AnswerForm,
|
| 22 |
+
[Operator.Categorize]: CategorizeForm,
|
| 23 |
};
|
| 24 |
|
| 25 |
const FlowDrawer = ({
|