feat(web): custom model add thinking capability
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:49:28
|
* @Date: 2026-02-03 16:49:28
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-25 14:07:10
|
* @Last Modified time: 2026-03-31 13:56:18
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Custom Model Modal
|
* Custom Model Modal
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
|
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
|
||||||
import { Form, Input, App, Checkbox, Button } from 'antd';
|
import { Form, Input, App, Checkbox, Button, Row, Col } from 'antd';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import type { CustomModelForm, ModelListItem, CustomModelModalRef, CustomModelModalProps } from '../types';
|
import type { CustomModelForm, ModelListItem, CustomModelModalRef, CustomModelModalProps } from '../types';
|
||||||
@@ -72,6 +72,7 @@ const CustomModelModal = forwardRef<CustomModelModalRef, CustomModelModalProps>(
|
|||||||
is_vision: capability?.includes('vision') || false,
|
is_vision: capability?.includes('vision') || false,
|
||||||
is_video: capability?.includes('video') || false,
|
is_video: capability?.includes('video') || false,
|
||||||
is_audio: capability?.includes('audio') || false,
|
is_audio: capability?.includes('audio') || false,
|
||||||
|
is_thinking: capability?.includes('thinking') || false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setIsEdit(false);
|
setIsEdit(false);
|
||||||
@@ -101,7 +102,7 @@ const CustomModelModal = forwardRef<CustomModelModalRef, CustomModelModalProps>(
|
|||||||
form
|
form
|
||||||
.validateFields()
|
.validateFields()
|
||||||
.then((values) => {
|
.then((values) => {
|
||||||
const { logo, type, is_vision, is_video, is_audio, is_omni, ...rest } = values;
|
const { logo, type, is_vision, is_video, is_audio, is_omni, is_thinking, ...rest } = values;
|
||||||
const formData: CustomModelForm = {
|
const formData: CustomModelForm = {
|
||||||
...rest,
|
...rest,
|
||||||
type,
|
type,
|
||||||
@@ -120,6 +121,9 @@ const CustomModelModal = forwardRef<CustomModelModalRef, CustomModelModalProps>(
|
|||||||
capability.push('video')
|
capability.push('video')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (is_thinking) {
|
||||||
|
capability.push('thinking')
|
||||||
|
}
|
||||||
|
|
||||||
formData.capability = capability
|
formData.capability = capability
|
||||||
formData.is_omni = is_omni
|
formData.is_omni = is_omni
|
||||||
@@ -238,21 +242,34 @@ const CustomModelModal = forwardRef<CustomModelModalRef, CustomModelModalProps>(
|
|||||||
<Input placeholder="https://api.example.com/v1" />
|
<Input placeholder="https://api.example.com/v1" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
{!['embedding', 'rerank'].includes(modelType as string) &&
|
{['llm', 'chat'].includes(modelType as string) &&
|
||||||
<>
|
<Row gutter={16}>
|
||||||
<Form.Item name="is_omni" valuePropName="checked" className="rb:mb-2!">
|
<Col span={24}>
|
||||||
<Checkbox>{t('modelNew.is_omni')}</Checkbox>
|
<Form.Item name="is_omni" valuePropName="checked" className="rb:mb-2!">
|
||||||
</Form.Item>
|
<Checkbox>{t('modelNew.is_omni')}</Checkbox>
|
||||||
<Form.Item name="is_vision" valuePropName="checked" className="rb:mb-2!">
|
</Form.Item>
|
||||||
<Checkbox disabled={isOmni}>{t('modelNew.is_vision')}</Checkbox>
|
</Col>
|
||||||
</Form.Item>
|
<Col span={8}>
|
||||||
<Form.Item name="is_video" valuePropName="checked" className="rb:mb-2!">
|
<Form.Item name="is_vision" valuePropName="checked" className="rb:mb-2!">
|
||||||
<Checkbox disabled={isOmni}>{t('modelNew.is_video')}</Checkbox>
|
<Checkbox disabled={isOmni}>{t('modelNew.is_vision')}</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="is_audio" valuePropName="checked" className="rb:mb-0!">
|
</Col>
|
||||||
<Checkbox disabled={isOmni}>{t('modelNew.is_audio')}</Checkbox>
|
<Col span={8}>
|
||||||
</Form.Item>
|
<Form.Item name="is_video" valuePropName="checked" className="rb:mb-2!">
|
||||||
</>
|
<Checkbox disabled={isOmni}>{t('modelNew.is_video')}</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<Form.Item name="is_audio" valuePropName="checked" className="rb:mb-2!">
|
||||||
|
<Checkbox disabled={isOmni}>{t('modelNew.is_audio')}</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={24}>
|
||||||
|
<Form.Item name="is_thinking" valuePropName="checked" className="rb:mb-0!">
|
||||||
|
<Checkbox>{t('modelNew.is_thinking')}</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
}
|
}
|
||||||
</Form>
|
</Form>
|
||||||
</RbModal>
|
</RbModal>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 16:50:18
|
* @Date: 2026-02-03 16:50:18
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-03-25 12:28:10
|
* @Last Modified time: 2026-03-31 15:48:02
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Type definitions for Model Management
|
* Type definitions for Model Management
|
||||||
@@ -295,7 +295,8 @@ export interface CustomModelForm {
|
|||||||
is_video?: boolean;
|
is_video?: boolean;
|
||||||
is_audio?: boolean;
|
is_audio?: boolean;
|
||||||
is_omni?: boolean;
|
is_omni?: boolean;
|
||||||
capability?: string[];
|
is_thinking?: boolean;
|
||||||
|
capability?: Capability[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -324,7 +325,7 @@ export interface BaseRef {
|
|||||||
modelListDetailRefresh?: () => void;
|
modelListDetailRefresh?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Capability = 'vision' | 'audio' | 'video';
|
export type Capability = 'vision' | 'audio' | 'video' | 'thinking';
|
||||||
export interface Model {
|
export interface Model {
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user