fix: password rule
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ export const WatchEventType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const PasswordReg =
|
export const PasswordReg =
|
||||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_])(?=\S+$).{6,12}$/;
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*_+])[a-zA-Z\d!@#$%^&*_+]{6,12}$/;
|
||||||
|
|
||||||
export const uppercaseReg = /(?=.*[A-Z])/;
|
export const uppercaseReg = /(?=.*[A-Z])/;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
'users.form.currentpassword': 'Current Password',
|
'users.form.currentpassword': 'Current Password',
|
||||||
'users.form.updatepassword': 'Modify Password',
|
'users.form.updatepassword': 'Modify Password',
|
||||||
'users.form.rule.password':
|
'users.form.rule.password':
|
||||||
'Contains uppercase and lowercase letters, numbers, and special characters, 6 to 12 characters in length, no spaces allowed.',
|
'Contains uppercase and lowercase letters, numbers, and !@#$%^&*_+, 6 to 12 characters in length, no spaces allowed.',
|
||||||
'users.password.uppcase': 'At least one uppercase letter',
|
'users.password.uppcase': 'At least one uppercase letter',
|
||||||
'users.password.lowercase': 'At least one lowercase letter',
|
'users.password.lowercase': 'At least one lowercase letter',
|
||||||
'users.password.number': 'At least one number',
|
'users.password.number': 'At least one number',
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
'users.form.currentpassword': '当前密码',
|
'users.form.currentpassword': '当前密码',
|
||||||
'users.form.updatepassword': '修改密码',
|
'users.form.updatepassword': '修改密码',
|
||||||
'users.form.rule.password':
|
'users.form.rule.password':
|
||||||
'包含大小写字母、数字和特殊字符,6至12个字符,不允许有空格',
|
'包含大小写字母、数字和!@#$%^&*_+,6至12个字符,不允许有空格',
|
||||||
'users.password.uppcase': '至少包含一个大写字母',
|
'users.password.uppcase': '至少包含一个大写字母',
|
||||||
'users.password.lowercase': '至少包含一个小写字母',
|
'users.password.lowercase': '至少包含一个小写字母',
|
||||||
'users.password.number': '至少包含一个数字',
|
'users.password.number': '至少包含一个数字',
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
repo={huggingfaceRepoId}
|
repo={huggingfaceRepoId}
|
||||||
onSelectFile={handleSelectModelFile}
|
onSelectFile={handleSelectModelFile}
|
||||||
collapsed={collapsed}
|
collapsed={collapsed}
|
||||||
loadingModel={loadingModel}
|
|
||||||
></HFModelFile>
|
></HFModelFile>
|
||||||
</ColumnWrapper>
|
</ColumnWrapper>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { useIntl } from '@umijs/max';
|
|||||||
import { Col, Empty, Row, Select, Spin, Tag, Tooltip } from 'antd';
|
import { Col, Empty, Row, Select, Spin, Tag, Tooltip } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import SimpleBar from 'simplebar-react';
|
import SimpleBar from 'simplebar-react';
|
||||||
import 'simplebar-react/dist/simplebar.min.css';
|
import 'simplebar-react/dist/simplebar.min.css';
|
||||||
import { queryHuggingfaceModelFiles } from '../apis';
|
import { queryHuggingfaceModelFiles } from '../apis';
|
||||||
import FileType from '../config/file-type';
|
import { getFileType } from '../config/file-type';
|
||||||
import '../style/hf-model-file.less';
|
import '../style/hf-model-file.less';
|
||||||
import FileParts from './file-parts';
|
import FileParts from './file-parts';
|
||||||
import TitleWrapper from './title-wrapper';
|
import TitleWrapper from './title-wrapper';
|
||||||
@@ -122,8 +122,8 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
const sortList = _.sortBy(list, (item: any) => {
|
const sortList = _.sortBy(list, (item: any) => {
|
||||||
return sortType === 'size' ? item.size : item.path;
|
return sortType === 'size' ? item.size : item.path;
|
||||||
});
|
});
|
||||||
setDataSource({ fileList: sortList, loading: false });
|
|
||||||
handleSelectModelFile(sortList[0]);
|
handleSelectModelFile(sortList[0]);
|
||||||
|
setDataSource({ fileList: sortList, loading: false });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setDataSource({ fileList: [], loading: false });
|
setDataSource({ fileList: [], loading: false });
|
||||||
handleSelectModelFile({});
|
handleSelectModelFile({});
|
||||||
@@ -139,18 +139,8 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getModelQuantizationType = useCallback((item: any) => {
|
const getModelQuantizationType = useCallback((item: any) => {
|
||||||
let itemPath = item.path;
|
const quanType = getFileType(item.path);
|
||||||
let path = _.split(itemPath, '/').pop();
|
if (quanType) {
|
||||||
|
|
||||||
if (!_.endsWith(path, '.gguf') && !_.includes(path, '.gguf')) {
|
|
||||||
path = `${path}.gguf`;
|
|
||||||
}
|
|
||||||
const name = _.split(path, '.').slice(0, -1).join('.');
|
|
||||||
let quanType = _.toUpper(name.split('-').slice(-1)[0]);
|
|
||||||
if (quanType.indexOf('.') > -1) {
|
|
||||||
quanType = _.split(quanType, '.').pop();
|
|
||||||
}
|
|
||||||
if (FileType[quanType] !== undefined) {
|
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
className="tag-item"
|
className="tag-item"
|
||||||
@@ -159,7 +149,7 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
marginRight: 0
|
marginRight: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{quanType}
|
{_.toUpper(quanType)}
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -182,6 +172,7 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
axiosTokenRef.current?.abort?.();
|
axiosTokenRef.current?.abort?.();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<TitleWrapper>
|
<TitleWrapper>
|
||||||
@@ -205,13 +196,12 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
></Select>
|
></Select>
|
||||||
</TitleWrapper>
|
</TitleWrapper>
|
||||||
<SimpleBar
|
<SimpleBar
|
||||||
style={{ maxHeight: collapsed ? 'max-content' : 'calc(100vh - 300px)' }}
|
style={{
|
||||||
|
height: collapsed ? 'max-content' : 'calc(100vh - 300px)'
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ padding: '16px 24px' }}>
|
<div style={{ padding: '16px 24px' }}>
|
||||||
<Spin
|
<Spin spinning={dataSource.loading} style={{ minHeight: 100 }}>
|
||||||
spinning={dataSource.loading || loadingModel}
|
|
||||||
style={{ minHeight: 100 }}
|
|
||||||
>
|
|
||||||
{dataSource.fileList.length ? (
|
{dataSource.fileList.length ? (
|
||||||
<Row gutter={[16, 24]}>
|
<Row gutter={[16, 24]}>
|
||||||
{_.map(dataSource.fileList, (item: any) => {
|
{_.map(dataSource.fileList, (item: any) => {
|
||||||
@@ -273,7 +263,7 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
</Row>
|
</Row>
|
||||||
) : (
|
) : (
|
||||||
!dataSource.loading &&
|
!dataSource.loading &&
|
||||||
!loadingModel && (
|
!dataSource.fileList.length && (
|
||||||
<Empty
|
<Empty
|
||||||
imageStyle={{ height: 'auto', marginTop: '20px' }}
|
imageStyle={{ height: 'auto', marginTop: '20px' }}
|
||||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||||
@@ -290,4 +280,4 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default HFModelFile;
|
export default memo(HFModelFile);
|
||||||
|
|||||||
@@ -160,7 +160,10 @@ const ModelCard: React.FC<{
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>
|
<Empty
|
||||||
|
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||||
|
style={{ marginBlock: 20 }}
|
||||||
|
></Empty>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -32,4 +32,45 @@ enum FileType {
|
|||||||
BF16 = 32
|
BF16 = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const fileTypeList = [
|
||||||
|
'F32',
|
||||||
|
'F16',
|
||||||
|
'Q4_0',
|
||||||
|
'Q4_1',
|
||||||
|
'Q4_1_SOME_F16',
|
||||||
|
'Q8_0',
|
||||||
|
'Q5_0',
|
||||||
|
'Q5_1',
|
||||||
|
'Q2_K',
|
||||||
|
'Q3_K_S',
|
||||||
|
'Q3_K_M',
|
||||||
|
'Q3_K_L',
|
||||||
|
'Q4_K_S',
|
||||||
|
'Q4_K_M',
|
||||||
|
'Q5_K_S',
|
||||||
|
'Q5_K_M',
|
||||||
|
'Q6_K',
|
||||||
|
'IQ2_XXS',
|
||||||
|
'IQ2_XS',
|
||||||
|
'Q2_K_S',
|
||||||
|
'IQ3_XS',
|
||||||
|
'IQ3_XXS',
|
||||||
|
'IQ1_S',
|
||||||
|
'IQ4_NL',
|
||||||
|
'IQ3_S',
|
||||||
|
'IQ3_M',
|
||||||
|
'IQ2_S',
|
||||||
|
'IQ2_M',
|
||||||
|
'IQ4_XS',
|
||||||
|
'IQ1_M',
|
||||||
|
'BF16'
|
||||||
|
];
|
||||||
|
|
||||||
|
export const getFileType = (fileName: string): string | null => {
|
||||||
|
const pattern = new RegExp(`[._-](${fileTypeList.join('|')})\\.gguf$`, 'i');
|
||||||
|
const match = fileName.match(pattern);
|
||||||
|
|
||||||
|
return match ? match[1].toUpperCase() : null;
|
||||||
|
};
|
||||||
|
|
||||||
export default FileType;
|
export default FileType;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
padding-inline: @padding;
|
padding-inline: @padding;
|
||||||
background: var(--color-white-1);
|
background: var(--color-white-1);
|
||||||
border-bottom: 1px solid var(--ant-color-split);
|
// border-bottom: 1px solid var(--ant-color-split);
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
|
|
||||||
.filter {
|
.filter {
|
||||||
|
|||||||
Reference in New Issue
Block a user