refactor: add worker

This commit is contained in:
jialin
2025-11-15 22:37:44 +08:00
parent 864cf76c07
commit 0f3f31ef45
39 changed files with 1746 additions and 606 deletions
@@ -5,6 +5,7 @@ import React from 'react';
type ViewModalProps = {
currentGPU?: string;
workerIP?: string;
modelDir?: string;
registrationInfo: {
token: string;
image: string;
@@ -15,19 +16,25 @@ type ViewModalProps = {
const AddWorkerCommand: React.FC<ViewModalProps> = ({
registrationInfo,
workerIP,
modelDir,
currentGPU
}) => {
const code = React.useMemo(() => {
const commandCode = addWorkerGuide['all'];
return commandCode?.registerWorker({
gpu: currentGPU || '',
server: registrationInfo.server_url || origin,
tag: '',
workerIP: '${WORKER_IP}',
image: registrationInfo.image,
token: registrationInfo.token || '${token}'
});
}, [registrationInfo, currentGPU, workerIP]);
return commandCode
?.registerWorker({
gpu: currentGPU || '',
server: registrationInfo.server_url || origin,
tag: '',
workerIP: workerIP,
modelDir: modelDir,
image: registrationInfo.image,
token: registrationInfo.token || '${token}'
})
?.trim()
.replace(/\\\s+$/gm, '')
.replace(/\\+$/, '');
}, [registrationInfo, currentGPU, workerIP, modelDir]);
return (
<HighlightCode