Feat: Allows users to search for models in the model selection drop-down box #3221 (#6708)

### What problem does this PR solve?

Feat: Allows users to search for models in the model selection drop-down
box #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu 2025-04-01 11:53:48 +08:00 committed by GitHub
parent fc21dd0a4a
commit d0dca16fee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 11 deletions

View File

@ -13,6 +13,7 @@ interface IProps {
items?: MenuProps['items']; items?: MenuProps['items'];
height?: number; height?: number;
needsDeletionValidation?: boolean; needsDeletionValidation?: boolean;
showDeleteItems?: boolean;
} }
const OperateDropdown = ({ const OperateDropdown = ({
@ -23,6 +24,7 @@ const OperateDropdown = ({
items: otherItems = [], items: otherItems = [],
height = 24, height = 24,
needsDeletionValidation = true, needsDeletionValidation = true,
showDeleteItems = true,
}: React.PropsWithChildren<IProps>) => { }: React.PropsWithChildren<IProps>) => {
const { t } = useTranslation(); const { t } = useTranslation();
const showDeleteConfirm = useShowDeleteConfirm(); const showDeleteConfirm = useShowDeleteConfirm();
@ -44,8 +46,10 @@ const OperateDropdown = ({
}; };
const items: MenuProps['items'] = useMemo(() => { const items: MenuProps['items'] = useMemo(() => {
return [ const items = [];
{
if (showDeleteItems) {
items.push({
key: '1', key: '1',
label: ( label: (
<Space> <Space>
@ -53,10 +57,11 @@ const OperateDropdown = ({
<DeleteOutlined /> <DeleteOutlined />
</Space> </Space>
), ),
}, });
...otherItems, }
];
}, [t, otherItems]); return [...items, ...otherItems];
}, [showDeleteItems, otherItems, t]);
return ( return (
<Dropdown <Dropdown

View File

@ -24,6 +24,7 @@ export interface IKnowledge {
vector_similarity_weight: number; vector_similarity_weight: number;
embd_id: string; embd_id: string;
nickname?: string; nickname?: string;
operator_permission: number;
} }
export interface Raptor { export interface Raptor {

View File

@ -11,6 +11,8 @@ export interface IThirdOAIModel {
tags: string; tags: string;
update_date: string; update_date: string;
update_time: number; update_time: number;
tenant_id?: string;
tenant_name?: string;
} }
export type IThirdOAIModelCollection = Record<string, IThirdOAIModel[]>; export type IThirdOAIModelCollection = Record<string, IThirdOAIModel[]>;

View File

@ -64,6 +64,7 @@ const SystemModelSettingModal = ({
...allOptions[LlmModelType.Image2text], ...allOptions[LlmModelType.Image2text],
]} ]}
allowClear allowClear
showSearch
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -71,14 +72,22 @@ const SystemModelSettingModal = ({
name="embd_id" name="embd_id"
tooltip={t('embeddingModelTip')} tooltip={t('embeddingModelTip')}
> >
<Select options={allOptions[LlmModelType.Embedding]} allowClear /> <Select
options={allOptions[LlmModelType.Embedding]}
allowClear
showSearch
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t('img2txtModel')} label={t('img2txtModel')}
name="img2txt_id" name="img2txt_id"
tooltip={t('img2txtModelTip')} tooltip={t('img2txtModelTip')}
> >
<Select options={allOptions[LlmModelType.Image2text]} allowClear /> <Select
options={allOptions[LlmModelType.Image2text]}
allowClear
showSearch
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -86,21 +95,33 @@ const SystemModelSettingModal = ({
name="asr_id" name="asr_id"
tooltip={t('sequence2txtModelTip')} tooltip={t('sequence2txtModelTip')}
> >
<Select options={allOptions[LlmModelType.Speech2text]} allowClear /> <Select
options={allOptions[LlmModelType.Speech2text]}
allowClear
showSearch
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t('rerankModel')} label={t('rerankModel')}
name="rerank_id" name="rerank_id"
tooltip={t('rerankModelTip')} tooltip={t('rerankModelTip')}
> >
<Select options={allOptions[LlmModelType.Rerank]} allowClear /> <Select
options={allOptions[LlmModelType.Rerank]}
allowClear
showSearch
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t('ttsModel')} label={t('ttsModel')}
name="tts_id" name="tts_id"
tooltip={t('ttsModelTip')} tooltip={t('ttsModelTip')}
> >
<Select options={allOptions[LlmModelType.TTS]} allowClear /> <Select
options={allOptions[LlmModelType.TTS]}
allowClear
showSearch
/>
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>