Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add LLMSelect #1270

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions web/src/components/llm-select/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 changes: 11 additions & 0 deletions web/src/pages/flow/categorize-form/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import LLMSelect from '@/components/llm-select';

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

export default CategorizeForm;
8 changes: 8 additions & 0 deletions web/src/pages/flow/constant.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
DatabaseOutlined,
MergeCellsOutlined,
RocketOutlined,
SendOutlined,
Expand All @@ -10,13 +11,15 @@ export enum Operator {
Retrieval = 'Retrieval',
Generate = 'Generate',
Answer = 'Answer',
Categorize = 'Categorize',
}

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

export const operatorMap = {
Expand All @@ -26,6 +29,7 @@ export const operatorMap = {
[Operator.Generate]: { description: 'Generate description' },
[Operator.Answer]: { description: 'Answer description' },
[Operator.Begin]: { description: 'Begin description' },
[Operator.Categorize]: { description: 'Categorize description' },
};

export const componentMenuList = [
Expand All @@ -41,6 +45,10 @@ export const componentMenuList = [
name: Operator.Answer,
description: operatorMap[Operator.Answer].description,
},
{
name: Operator.Categorize,
description: operatorMap[Operator.Categorize].description,
},
];

export const initialRetrievalValues = {
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/flow/flow-drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useEffect } from 'react';
import { Node } from 'reactflow';
import AnswerForm from '../answer-form';
import BeginForm from '../begin-form';
import CategorizeForm from '../categorize-form';
import { Operator } from '../constant';
import GenerateForm from '../generate-form';
import { useHandleFormValuesChange } from '../hooks';
Expand All @@ -18,6 +19,7 @@ const FormMap = {
[Operator.Retrieval]: RetrievalForm,
[Operator.Generate]: GenerateForm,
[Operator.Answer]: AnswerForm,
[Operator.Categorize]: CategorizeForm,
};

const FlowDrawer = ({
Expand Down