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