feat(ModelTagsWithLabel): enhance tag component styling and update layout
- Improved icon size handling in the ModelTagsWithLabel component for better visual consistency. - Adjusted the layout of the tags to prevent wrapping and added horizontal scrolling for better usability. - Updated the EditModelsPopup to increase its width for improved content display. - Removed unnecessary CustomTag usage in ModelList for cleaner code.
This commit is contained in:
parent
a3e10dd116
commit
1f21b99820
@ -66,12 +66,20 @@ const ModelTagsWithLabel: FC<ModelTagsProps> = ({
|
|||||||
return (
|
return (
|
||||||
<Container ref={containerRef}>
|
<Container ref={containerRef}>
|
||||||
{isVisionModel(model) && (
|
{isVisionModel(model) && (
|
||||||
<CustomTag size={size} color="#00b96b" icon={<EyeOutlined />} tooltip={t('models.type.vision')}>
|
<CustomTag
|
||||||
|
size={size}
|
||||||
|
color="#00b96b"
|
||||||
|
icon={<EyeOutlined style={{ fontSize: size }} />}
|
||||||
|
tooltip={t('models.type.vision')}>
|
||||||
{_showLabel ? t('models.type.vision') : ''}
|
{_showLabel ? t('models.type.vision') : ''}
|
||||||
</CustomTag>
|
</CustomTag>
|
||||||
)}
|
)}
|
||||||
{isWebSearchModel(model) && (
|
{isWebSearchModel(model) && (
|
||||||
<CustomTag size={size} color="#1677ff" icon={<GlobalOutlined />} tooltip={t('models.type.websearch')}>
|
<CustomTag
|
||||||
|
size={size}
|
||||||
|
color="#1677ff"
|
||||||
|
icon={<GlobalOutlined style={{ fontSize: size }} />}
|
||||||
|
tooltip={t('models.type.websearch')}>
|
||||||
{_showLabel ? t('models.type.websearch') : ''}
|
{_showLabel ? t('models.type.websearch') : ''}
|
||||||
</CustomTag>
|
</CustomTag>
|
||||||
)}
|
)}
|
||||||
@ -85,7 +93,11 @@ const ModelTagsWithLabel: FC<ModelTagsProps> = ({
|
|||||||
</CustomTag>
|
</CustomTag>
|
||||||
)}
|
)}
|
||||||
{showToolsCalling && isFunctionCallingModel(model) && (
|
{showToolsCalling && isFunctionCallingModel(model) && (
|
||||||
<CustomTag size={size} color="#f18737" icon={<ToolOutlined />} tooltip={t('models.type.function_calling')}>
|
<CustomTag
|
||||||
|
size={size}
|
||||||
|
color="#f18737"
|
||||||
|
icon={<ToolOutlined style={{ fontSize: size }} />}
|
||||||
|
tooltip={t('models.type.function_calling')}>
|
||||||
{_showLabel ? t('models.type.function_calling') : ''}
|
{_showLabel ? t('models.type.function_calling') : ''}
|
||||||
</CustomTag>
|
</CustomTag>
|
||||||
)}
|
)}
|
||||||
@ -107,7 +119,11 @@ const Container = styled.div`
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: nowrap;
|
||||||
|
overflow-x: scroll;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export default ModelTagsWithLabel
|
export default ModelTagsWithLabel
|
||||||
|
|||||||
@ -162,7 +162,7 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
|||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
afterClose={onClose}
|
afterClose={onClose}
|
||||||
footer={null}
|
footer={null}
|
||||||
width="680px"
|
width="800px"
|
||||||
styles={{
|
styles={{
|
||||||
content: { padding: 0 },
|
content: { padding: 0 },
|
||||||
header: { padding: '16px 22px 30px 22px' }
|
header: { padding: '16px 22px 30px 22px' }
|
||||||
@ -202,7 +202,7 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
|||||||
defaultActiveKey={i >= 5 ? [] : ['1']}
|
defaultActiveKey={i >= 5 ? [] : ['1']}
|
||||||
label={
|
label={
|
||||||
<Flex align="center" gap={10}>
|
<Flex align="center" gap={10}>
|
||||||
<span>{group}</span>
|
<span style={{ fontWeight: 600 }}>{group}</span>
|
||||||
<CustomTag color="#02B96B" size={10}>
|
<CustomTag color="#02B96B" size={10}>
|
||||||
{modelGroups[group].length}
|
{modelGroups[group].length}
|
||||||
</CustomTag>
|
</CustomTag>
|
||||||
@ -262,12 +262,11 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
|||||||
placement="top">
|
placement="top">
|
||||||
<span style={{ cursor: 'help' }}>{model.name}</span>
|
<span style={{ cursor: 'help' }}>{model.name}</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<ModelTagsWithLabel model={model} size={11} />
|
||||||
</ListItemName>
|
</ListItemName>
|
||||||
),
|
),
|
||||||
extra: (
|
extra: (
|
||||||
<div style={{ marginTop: 6 }}>
|
<div style={{ marginTop: 6 }}>
|
||||||
<ModelTagsWithLabel model={model} size={11} />
|
|
||||||
|
|
||||||
{model.description && (
|
{model.description && (
|
||||||
<Typography.Paragraph
|
<Typography.Paragraph
|
||||||
type="secondary"
|
type="secondary"
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import {
|
|||||||
SettingOutlined
|
SettingOutlined
|
||||||
} from '@ant-design/icons'
|
} from '@ant-design/icons'
|
||||||
import CustomCollapse from '@renderer/components/CustomCollapse'
|
import CustomCollapse from '@renderer/components/CustomCollapse'
|
||||||
import CustomTag from '@renderer/components/CustomTag'
|
|
||||||
import ModelTagsWithLabel from '@renderer/components/ModelTagsWithLabel'
|
import ModelTagsWithLabel from '@renderer/components/ModelTagsWithLabel'
|
||||||
import { getModelLogo } from '@renderer/config/models'
|
import { getModelLogo } from '@renderer/config/models'
|
||||||
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
import { PROVIDER_CONFIG } from '@renderer/config/providers'
|
||||||
@ -252,9 +251,6 @@ const ModelList: React.FC<ModelListProps> = ({ providerId, modelStatuses = [], s
|
|||||||
label={
|
label={
|
||||||
<Flex align="center" gap={10}>
|
<Flex align="center" gap={10}>
|
||||||
<span style={{ fontWeight: 600 }}>{group}</span>
|
<span style={{ fontWeight: 600 }}>{group}</span>
|
||||||
<CustomTag color="#02B96B" size={10}>
|
|
||||||
{modelGroups[group].length}
|
|
||||||
</CustomTag>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
}
|
}
|
||||||
extra={
|
extra={
|
||||||
@ -294,14 +290,10 @@ const ModelList: React.FC<ModelListProps> = ({ providerId, modelStatuses = [], s
|
|||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
}
|
}
|
||||||
placement="top">
|
placement="top">
|
||||||
<span style={{ cursor: 'help' }}>{model.name}</span>
|
<span>{model.name}</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ListItemName>
|
|
||||||
),
|
|
||||||
extra: (
|
|
||||||
<div style={{ marginTop: 6 }}>
|
|
||||||
<ModelTagsWithLabel model={model} size={11} />
|
<ModelTagsWithLabel model={model} size={11} />
|
||||||
</div>
|
</ListItemName>
|
||||||
),
|
),
|
||||||
ext: '.model',
|
ext: '.model',
|
||||||
actions: (
|
actions: (
|
||||||
@ -378,6 +370,10 @@ const ListItemName = styled.div`
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
cursor: help;
|
||||||
|
font-family: 'Ubuntu';
|
||||||
|
line-height: 30px;
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user