chore: add changes tips
This commit is contained in:
@@ -13,7 +13,7 @@ interface AlertInfoProps {
|
||||
ellipsis?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
contentStyle?: React.CSSProperties;
|
||||
title: React.ReactNode;
|
||||
title?: React.ReactNode;
|
||||
}
|
||||
|
||||
const TitleWrapper = styled.div`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Button, Space } from 'antd';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
type ModalFooterProps = {
|
||||
onOk?: () => void;
|
||||
@@ -16,7 +17,16 @@ type ModalFooterProps = {
|
||||
showCancelBtn?: boolean;
|
||||
extra?: React.ReactNode;
|
||||
form?: any;
|
||||
description?: React.ReactNode;
|
||||
};
|
||||
|
||||
const Wrapper = styled.div`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
`;
|
||||
|
||||
const ModalFooter: React.FC<ModalFooterProps> = ({
|
||||
onOk,
|
||||
onCancel,
|
||||
@@ -28,29 +38,37 @@ const ModalFooter: React.FC<ModalFooterProps> = ({
|
||||
htmlType = 'button',
|
||||
style,
|
||||
showOkBtn = true,
|
||||
description,
|
||||
extra,
|
||||
form
|
||||
}) => {
|
||||
const intl = useIntl();
|
||||
return (
|
||||
<Space size={20} style={{ ...style }}>
|
||||
<Button onClick={onCancel} style={{ width: '88px' }} {...cancelBtnProps}>
|
||||
{cancelText || intl.formatMessage({ id: 'common.button.cancel' })}
|
||||
</Button>
|
||||
{extra}
|
||||
{showOkBtn && (
|
||||
<Wrapper>
|
||||
<div>{description}</div>
|
||||
<Space size={20} style={{ ...style }}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={onOk}
|
||||
onClick={onCancel}
|
||||
style={{ width: '88px' }}
|
||||
loading={loading}
|
||||
htmlType={htmlType}
|
||||
{...okBtnProps}
|
||||
{...cancelBtnProps}
|
||||
>
|
||||
{okText || intl.formatMessage({ id: 'common.button.save' })}
|
||||
{cancelText || intl.formatMessage({ id: 'common.button.cancel' })}
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
{extra}
|
||||
{showOkBtn && (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={onOk}
|
||||
style={{ width: '88px' }}
|
||||
loading={loading}
|
||||
htmlType={htmlType}
|
||||
{...okBtnProps}
|
||||
>
|
||||
{okText || intl.formatMessage({ id: 'common.button.save' })}
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -130,5 +130,7 @@ export default {
|
||||
'models.form.check.params': 'Checking configuration...',
|
||||
'models.form.check.passed': 'Compatibility Check Passed',
|
||||
'models.form.check.claims':
|
||||
'The model requires approximately {vram} VRAM and {ram} RAM.'
|
||||
'The model requires approximately {vram} VRAM and {ram} RAM.',
|
||||
'models.form.update.tips':
|
||||
'Changes will only apply after you delete and recreate the instance.'
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ export default {
|
||||
'Get Token <span class="note-text">(Run on the server)</span>',
|
||||
'resources.worker.add.step2': 'Register Worker',
|
||||
'resources.worker.add.step2.tips':
|
||||
'(Run on the worker to be added, <span style="color: #000;font-weight: 600">mytoken</span> is the token obtained in the first step.)',
|
||||
'(Run on the worker to be added, <span style="color: #000;font-weight: 600">token</span> is the token obtained in the first step.)',
|
||||
'resources.worker.add.step3':
|
||||
'After success, refresh the workers list to view the new worker.',
|
||||
'resources.worker.container.supported': 'Do not support macOS or Windows.',
|
||||
|
||||
@@ -127,7 +127,9 @@ export default {
|
||||
'models.form.check.params': 'Checking configuration...',
|
||||
'models.form.check.passed': 'Compatibility Check Passed',
|
||||
'models.form.check.claims':
|
||||
'The model requires approximately {vram} VRAM and {ram} RAM.'
|
||||
'The model requires approximately {vram} VRAM and {ram} RAM.',
|
||||
'models.form.update.tips':
|
||||
'Changes will only apply after you delete and recreate the instance.'
|
||||
};
|
||||
|
||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||
@@ -144,4 +146,5 @@ export default {
|
||||
// 11. 'models.form.check.passed',
|
||||
// 12. 'models.form.check.claims',
|
||||
// 13. 'model.deploy.search.placeholder',
|
||||
// 14. 'models.form.update.tips
|
||||
// ========== End of To-Do List ==========
|
||||
|
||||
@@ -45,7 +45,7 @@ export default {
|
||||
'Get Token <span class="note-text">(Run on the server)</span>',
|
||||
'resources.worker.add.step2': 'ワーカーを登録',
|
||||
'resources.worker.add.step2.tips':
|
||||
'(Run on the worker to be added, <span style="color: #000;font-weight: 600">mytoken</span> is the token obtained in the first step.)',
|
||||
'(Run on the worker to be added, <span style="color: #000;font-weight: 600">token</span> is the token obtained in the first step.)',
|
||||
'resources.worker.add.step3':
|
||||
'成功後、ワーカーリストを更新して新しいワーカーを確認してください。',
|
||||
'resources.worker.container.supported':
|
||||
|
||||
@@ -129,11 +129,15 @@ export default {
|
||||
'При возникновении ошибки система автоматически попытается перезапуститься.',
|
||||
'models.form.check.params': 'Проверка конфигурации...',
|
||||
'models.form.check.passed': 'Compatibility Check Passed',
|
||||
'models.form.check.claims': 'Модель требует примерно {vram} VRAM и {ram} RAM.'
|
||||
'models.form.check.claims':
|
||||
'Модель требует примерно {vram} VRAM и {ram} RAM.',
|
||||
'models.form.update.tips':
|
||||
'Changes will only apply after you delete and recreate the instance.'
|
||||
};
|
||||
|
||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||
// 1. 'models.form.check.passed',
|
||||
// 2. 'models.form.partialoffload.tips
|
||||
// 3. 'model.deploy.search.placeholder'
|
||||
// 3. 'model.deploy.search.placeholder',
|
||||
// 4. 'models.form.update.tips',
|
||||
// ========== End of To-Do List ==========
|
||||
|
||||
@@ -45,7 +45,7 @@ export default {
|
||||
'Получить токен <span class="note-text">(Запустить на сервере)</span>',
|
||||
'resources.worker.add.step2': 'Зарегистрировать воркер',
|
||||
'resources.worker.add.step2.tips':
|
||||
'(выполнить на подключаемом воркере, <span style="color: #000;font-weight: 600">mytoken</span> это токен, полученный на первом шаге)',
|
||||
'(выполнить на подключаемом воркере, <span style="color: #000;font-weight: 600">token</span> это токен, полученный на первом шаге)',
|
||||
'resources.worker.add.step3':
|
||||
'После успешной регистрации обновите список воркеров.',
|
||||
'resources.worker.container.supported': 'Только для Linux.',
|
||||
|
||||
@@ -122,5 +122,6 @@ export default {
|
||||
'models.form.restart.onerror.tips': '当发生错误时,将自动尝试恢复',
|
||||
'models.form.check.params': '正在校验配置...',
|
||||
'models.form.check.passed': '兼容性检查通过',
|
||||
'models.form.check.claims': '该模型大约需要 {vram} 显存和 {ram} 内存。'
|
||||
'models.form.check.claims': '该模型大约需要 {vram} 显存和 {ram} 内存。',
|
||||
'models.form.update.tips': '更改仅在删除并重新创建实例后生效。'
|
||||
};
|
||||
|
||||
@@ -42,10 +42,10 @@ export default {
|
||||
'resources.table.unified': '统一内存',
|
||||
'resources.worker.linuxormaxos': 'Linux 或 macOS',
|
||||
'resources.worker.add.step1':
|
||||
'获取 token<span class="note-text">(在 Server 上运行)</span>',
|
||||
'获取 Token<span class="note-text">(在 Server 上运行)</span>',
|
||||
'resources.worker.add.step2': '注册 Worker',
|
||||
'resources.worker.add.step2.tips':
|
||||
'(在需要添加的 Worker 上运行,<span style="color: #000;font-weight: 600">mytoken</span> 为第一步获取到的 token)',
|
||||
'(在需要添加的 Worker 上运行,<span style="color: #000;font-weight: 600">token</span> 为第一步获取到的 token)',
|
||||
'resources.worker.add.step3': '成功后,刷新 Worker 列表即可看到新的 Worker',
|
||||
'resources.worker.container.supported': '不支持 macOS 和 Windows',
|
||||
'resources.worker.current.version': '当前版本为 {version}',
|
||||
|
||||
@@ -29,8 +29,9 @@ const DivWrapper = styled.div`
|
||||
|
||||
const CloseWrapper = styled.div`
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
top: 12px;
|
||||
right: 18px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
background-color: var(--ant-color-warning-bg);
|
||||
`;
|
||||
|
||||
@@ -56,6 +56,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
onCancel,
|
||||
updateFormInitials: { gpuOptions, isGGUF, data: formData }
|
||||
} = props || {};
|
||||
const intl = useIntl();
|
||||
const {
|
||||
setWarningStatus,
|
||||
generateGPUIds,
|
||||
@@ -63,9 +64,9 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
checkTokenRef,
|
||||
warningStatus
|
||||
} = useCheckCompatibility();
|
||||
|
||||
const { getRuleMessage } = useAppUtils();
|
||||
const [form] = Form.useForm();
|
||||
const intl = useIntl();
|
||||
const localPathCache = useRef<string>('');
|
||||
const submitAnyway = useRef<boolean>(false);
|
||||
|
||||
@@ -353,6 +354,12 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
useEffect(() => {
|
||||
if (open && formData) {
|
||||
form.setFieldsValue(formData);
|
||||
setWarningStatus({
|
||||
show: true,
|
||||
message: intl.formatMessage({
|
||||
id: 'models.form.update.tips'
|
||||
})
|
||||
});
|
||||
}
|
||||
if (!open) {
|
||||
checkTokenRef.current?.cancel?.();
|
||||
@@ -426,17 +433,19 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
: 0
|
||||
}
|
||||
footer={
|
||||
<CompatibilityAlert
|
||||
showClose={true}
|
||||
onClose={() => {
|
||||
setWarningStatus({
|
||||
show: false,
|
||||
message: ''
|
||||
});
|
||||
}}
|
||||
warningStatus={warningStatus}
|
||||
contentStyle={{ paddingInline: 0 }}
|
||||
></CompatibilityAlert>
|
||||
<>
|
||||
<CompatibilityAlert
|
||||
showClose={false}
|
||||
onClose={() => {
|
||||
setWarningStatus({
|
||||
show: false,
|
||||
message: ''
|
||||
});
|
||||
}}
|
||||
warningStatus={warningStatus}
|
||||
contentStyle={{ paddingInline: 0 }}
|
||||
></CompatibilityAlert>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<FormContext.Provider
|
||||
|
||||
@@ -228,7 +228,6 @@ export const useGenerateModelFileOptions = () => {
|
||||
|
||||
export const useCheckCompatibility = () => {
|
||||
const intl = useIntl();
|
||||
|
||||
const cacheFormValuesRef = useRef<any>({});
|
||||
const checkTokenRef = useRef<any>(null);
|
||||
const submitAnyway = useRef<boolean>(false);
|
||||
|
||||
@@ -31,15 +31,15 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
return commandCode?.registerWorker({
|
||||
server: origin,
|
||||
tag: version,
|
||||
token: '${mytoken}',
|
||||
workerip: '${myworkerip}'
|
||||
token: '${token}',
|
||||
workerip: '${workerip}'
|
||||
});
|
||||
}
|
||||
return commandCode?.registerWorker({
|
||||
server: origin,
|
||||
tag: `${version}-${activeKey}`,
|
||||
token: '${mytoken}',
|
||||
workerip: '${myworkerip}'
|
||||
token: '${token}',
|
||||
workerip: '${workerip}'
|
||||
});
|
||||
}, [versionInfo, activeKey, props.token]);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
<HighlightCode
|
||||
code={addWorkerGuide.mac.registerWorker({
|
||||
server: origin,
|
||||
token: '${mytoken}'
|
||||
token: '${token}'
|
||||
})}
|
||||
theme="dark"
|
||||
></HighlightCode>
|
||||
@@ -59,7 +59,7 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
theme="dark"
|
||||
code={addWorkerGuide.win.registerWorker({
|
||||
server: origin,
|
||||
token: '${mytoken}'
|
||||
token: '${token}'
|
||||
})}
|
||||
></HighlightCode>
|
||||
<h3 className="m-b-0 m-t-10 font-size-14 font-600">3. {labels.step3}</h3>
|
||||
|
||||
Reference in New Issue
Block a user