chore: message link
This commit is contained in:
@@ -10,6 +10,7 @@ import CopyButton from '../copy-button';
|
||||
import CopyStyle from './copy.less';
|
||||
import './index.less';
|
||||
|
||||
const linkReg = /<a (.*?)>(.*?)<\/a>/g;
|
||||
export const StatusMaps = {
|
||||
transitioning: 'blue',
|
||||
error: 'red',
|
||||
@@ -59,6 +60,18 @@ const StatusTag: React.FC<StatusTagProps> = ({
|
||||
setStatusColor(StatusColorMap[status]);
|
||||
}, [status]);
|
||||
|
||||
const statusMessage = useMemo(() => {
|
||||
return statusValue.message?.replace(linkReg, '');
|
||||
}, [statusValue.message]);
|
||||
|
||||
const messageLink = useMemo(() => {
|
||||
const link = statusValue.message?.match(linkReg);
|
||||
if (link) {
|
||||
return link?.[0].replace(linkReg, '<a $1 target="_blank">$2</a>');
|
||||
}
|
||||
return null;
|
||||
}, [statusValue.message]);
|
||||
|
||||
const renderContent = () => {
|
||||
const percent = download?.percent || 0;
|
||||
|
||||
@@ -78,7 +91,7 @@ const StatusTag: React.FC<StatusTagProps> = ({
|
||||
<div className="copy-button-wrapper">
|
||||
<CopyButton
|
||||
style={{ color: 'rgba(255,255,255,.8)' }}
|
||||
text={statusValue.message || ''}
|
||||
text={statusMessage || ''}
|
||||
size="small"
|
||||
></CopyButton>
|
||||
{actions?.map((item) => {
|
||||
@@ -115,8 +128,12 @@ const StatusTag: React.FC<StatusTagProps> = ({
|
||||
wordBreak: 'break-word'
|
||||
}}
|
||||
>
|
||||
{statusValue.message}
|
||||
{statusMessage}
|
||||
{statusMessage && <span className="m-r-5"></span>}
|
||||
{extra}
|
||||
{messageLink && (
|
||||
<span dangerouslySetInnerHTML={{ __html: messageLink }}></span>
|
||||
)}
|
||||
</div>
|
||||
</SimpleBar>
|
||||
</div>
|
||||
|
||||
@@ -65,7 +65,7 @@ const useSetChunkFetch = () => {
|
||||
bufferManager.add(chunk);
|
||||
throttledCallback();
|
||||
} catch (error) {
|
||||
console.log('error:', error);
|
||||
console.log('error============:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -96,6 +96,8 @@ const useSetChunkFetch = () => {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json();
|
||||
handler(error?.message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ const Catalog: React.FC = () => {
|
||||
<Space>
|
||||
<Input
|
||||
placeholder={intl.formatMessage({ id: 'common.filter.name' })}
|
||||
style={{ width: 200 }}
|
||||
style={{ width: 230 }}
|
||||
size="large"
|
||||
allowClear
|
||||
onClear={() =>
|
||||
@@ -224,8 +224,9 @@ const Catalog: React.FC = () => {
|
||||
></Input>
|
||||
<Select
|
||||
allowClear
|
||||
showSearch={false}
|
||||
placeholder={intl.formatMessage({ id: 'models.filter.category' })}
|
||||
style={{ width: 240 }}
|
||||
style={{ width: 230 }}
|
||||
size="large"
|
||||
mode="multiple"
|
||||
maxTagCount={1}
|
||||
|
||||
@@ -304,13 +304,29 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
||||
return groupList[item.value];
|
||||
});
|
||||
|
||||
const defaultSpec =
|
||||
_.find(res.items, (item: CatalogSpec) => {
|
||||
return getDefaultQuant({
|
||||
category: _.get(current, 'categories.0', ''),
|
||||
quantOption: item.quantization
|
||||
});
|
||||
}) || _.get(res.items, `0`, {});
|
||||
const list72B = _.filter(res.items, (item: CatalogSpec) => {
|
||||
return item.size === 72;
|
||||
});
|
||||
|
||||
let defaultSpec: any = {};
|
||||
|
||||
if (list72B.length) {
|
||||
defaultSpec =
|
||||
_.find(list72B, (item: CatalogSpec) => {
|
||||
return getDefaultQuant({
|
||||
category: _.get(current, 'categories.0', ''),
|
||||
quantOption: item.quantization
|
||||
});
|
||||
}) || _.get(list72B, `0`, {});
|
||||
} else {
|
||||
defaultSpec =
|
||||
_.find(res.items, (item: CatalogSpec) => {
|
||||
return getDefaultQuant({
|
||||
category: _.get(current, 'categories.0', ''),
|
||||
quantOption: item.quantization
|
||||
});
|
||||
}) || _.get(res.items, `0`, {});
|
||||
}
|
||||
|
||||
selectSpecRef.current = defaultSpec;
|
||||
setSourceList(sources);
|
||||
|
||||
@@ -739,17 +739,18 @@ const Models: React.FC<ModelsProps> = ({
|
||||
<Space>
|
||||
<Input
|
||||
placeholder={intl.formatMessage({ id: 'common.filter.name' })}
|
||||
style={{ width: 200 }}
|
||||
style={{ width: 230 }}
|
||||
size="large"
|
||||
allowClear
|
||||
onChange={handleNameChange}
|
||||
></Input>
|
||||
<Select
|
||||
allowClear
|
||||
showSearch={false}
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'models.filter.category'
|
||||
})}
|
||||
style={{ width: 240 }}
|
||||
style={{ width: 230 }}
|
||||
size="large"
|
||||
mode="multiple"
|
||||
maxTagCount={1}
|
||||
|
||||
Reference in New Issue
Block a user