Skip to content

Commit b48df19

Browse files
authored
fix(组件): 添加密码显示切换功能并调整标签顺序 (#62)
- 在ModelModal中添加密码显示/隐藏切换功能 - 调整ModelTagFilter中标签的显示顺序 - 增加用户列表下拉菜单的最大高度
1 parent 81ebdcc commit b48df19

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

ui/ModelModal/src/ModelModal.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
Checkbox,
1313
FormControlLabel,
1414
ListSubheader,
15+
InputAdornment,
16+
IconButton,
1517
} from '@mui/material';
18+
import { Visibility, VisibilityOff } from '@mui/icons-material';
1619
import { Icon, message, Modal, ThemeProvider } from '@c-x/ui';
1720
import Card from './components/card';
1821
import ModelTagsWithLabel from './components/ModelTagsWithLabel';
@@ -100,6 +103,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
100103
const [addModelError, setAddModelError] = useState('');
101104
const [success, setSuccess] = useState(false);
102105
const [expandAdvanced, setExpandAdvanced] = useState(false);
106+
const [showPassword, setShowPassword] = useState(false);
103107

104108
const handleReset = () => {
105109
onClose();
@@ -633,10 +637,23 @@ export const ModelModal: React.FC<ModelModalProps> = ({
633637
{...field}
634638
fullWidth
635639
size='small'
636-
type='password'
640+
type={showPassword ? 'text' : 'password'}
637641
placeholder=''
638642
error={!!errors.api_key}
639643
helperText={errors.api_key?.message}
644+
InputProps={{
645+
endAdornment: (
646+
<InputAdornment position="end">
647+
<IconButton
648+
aria-label="toggle password visibility"
649+
onClick={() => setShowPassword(!showPassword)}
650+
edge="end"
651+
>
652+
{showPassword ? <VisibilityOff /> : <Visibility />}
653+
</IconButton>
654+
</InputAdornment>
655+
),
656+
}}
640657
onChange={(e) => {
641658
field.onChange(e.target.value);
642659
setModelUserList([]);
@@ -775,7 +792,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
775792
MenuProps: {
776793
PaperProps: {
777794
sx: {
778-
maxHeight: 300,
795+
maxHeight: 450,
779796
'& .MuiList-root': {
780797
paddingTop: 0,
781798
}

ui/ModelModal/src/components/ModelTagFilter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const ModelTagFilter: React.FC<ModelTagFilterProps> = ({
3737
// 定义可用的标签类型
3838
const availableTags = [
3939
{ key: 'all', label: '全部', color: 'default' as const },
40+
{ key: 'code', label: '代码生成', color: 'warning' as const },
4041
{ key: 'reasoning', label: '深度思考', color: 'primary' as const },
41-
{ key: 'vision', label: '视觉', color: 'secondary' as const },
4242
{ key: 'function_calling', label: '工具调用', color: 'success' as const },
43-
{ key: 'code', label: '代码生成', color: 'warning' as const },
43+
{ key: 'vision', label: '视觉', color: 'secondary' as const },
4444
{ key: 'embedding', label: '向量', color: 'error' as const },
4545
{ key: 'rerank', label: '重排', color: 'default' as const }
4646
];

0 commit comments

Comments
 (0)