fix: edit image: image field is null
This commit is contained in:
@@ -64,6 +64,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
});
|
||||
const doneImage = useRef<boolean>(false);
|
||||
const [activeImgUid, setActiveImgUid] = useState<number>(0);
|
||||
const imageEditorRef = useRef<any>(null);
|
||||
|
||||
const {
|
||||
handleOnValuesChange,
|
||||
@@ -110,9 +111,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
});
|
||||
|
||||
const imageFile = useMemo(() => {
|
||||
if (!image) return null;
|
||||
return base64ToFile(image, 'image');
|
||||
}, [image]);
|
||||
return base64ToFile(uploadList[0]?.dataUrl, 'image');
|
||||
}, [uploadList]);
|
||||
|
||||
const maskFile = useMemo(() => {
|
||||
if (!mask) return null;
|
||||
@@ -123,7 +123,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
if (parameters.size === 'custom') {
|
||||
return {
|
||||
..._.omit(parameters, ['width', 'height', 'preview', 'random_seed']),
|
||||
image: imageFile,
|
||||
image: base64ToFile(image, 'image'),
|
||||
mask: maskFile,
|
||||
size:
|
||||
parameters.width && parameters.height
|
||||
@@ -279,6 +279,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
const handleClearUploadMask = useCallback(() => {
|
||||
setMaskUpload([]);
|
||||
setMask(null);
|
||||
imageEditorRef.current?.clearMask();
|
||||
}, []);
|
||||
|
||||
const handleOnSave = useCallback(
|
||||
@@ -299,6 +300,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
if (image) {
|
||||
return (
|
||||
<CanvasImageEditor
|
||||
ref={imageEditorRef}
|
||||
imguid={activeImgUid}
|
||||
imageStatus={imageStatus}
|
||||
imageSrc={image}
|
||||
@@ -361,7 +363,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
]);
|
||||
|
||||
const handleOnImgClick = useCallback((item: any, isOrigin: boolean) => {
|
||||
if (item.progress < 100) {
|
||||
if (item.progress < 100 && !isOrigin) {
|
||||
return;
|
||||
}
|
||||
setActiveImgUid(item.uid);
|
||||
@@ -421,8 +423,9 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
||||
preview={false}
|
||||
loading={false}
|
||||
autoSize={false}
|
||||
editable={false}
|
||||
editable={true}
|
||||
autoBgColor={false}
|
||||
onDelete={() => handleClearUploadMask()}
|
||||
label={
|
||||
<span>{intl.formatMessage({ id: 'playground.image.mask' })}</span>
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ export default function useTextImage(props: any) {
|
||||
|
||||
const handleStopConversation = () => {
|
||||
requestToken.current?.abort?.();
|
||||
setImageList([]);
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
|
||||
@@ -118,7 +118,12 @@ const AddWorker: React.FC<ViewModalProps> = (props) => {
|
||||
}}
|
||||
></div>
|
||||
)}
|
||||
<HighlightCode theme="dark" code={code} lang="bash"></HighlightCode>
|
||||
<HighlightCode
|
||||
theme="dark"
|
||||
code={code}
|
||||
lang="bash"
|
||||
height={130}
|
||||
></HighlightCode>
|
||||
<h3 className="m-b-0 m-t-10">
|
||||
3. {intl.formatMessage({ id: 'resources.worker.add.step3' })}
|
||||
</h3>
|
||||
|
||||
@@ -44,6 +44,7 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
return `docker run -d --name gpustack-worker --restart=unless-stopped --gpus all -p 10150:10150 -p 40000-41024:40000-41024 -p 50000-51024:50000-51024 --ipc=host -v gpustack-worker-data:/var/lib/gpustack gpustack/gpustack:${params.tag} --server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
|
||||
npu: {
|
||||
getToken:
|
||||
'Get-Content -Path (Join-Path -Path $env:APPDATA -ChildPath "gpustack\\token") -Raw',
|
||||
@@ -53,7 +54,31 @@ export const addWorkerGuide: Record<string, any> = {
|
||||
token: string;
|
||||
workerip: string;
|
||||
}) {
|
||||
return `docker run -d --name gpustack-worker --restart=unless-stopped -e ASCEND_VISIBLE_DEVICES=0 -p 10150:10150 -p 40000-41024:40000-41024 -p 50000-51024:50000-51024 --ipc=host -v gpustack-worker-data:/var/lib/gpustack gpustack/gpustack:${params.tag} --server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
return `docker run -d --name gpustack-worker \\
|
||||
--restart=unless-stopped \\
|
||||
--device /dev/davinci0 \\
|
||||
--device /dev/davinci1 \\
|
||||
--device /dev/davinci2 \\
|
||||
--device /dev/davinci3 \\
|
||||
--device /dev/davinci4 \\
|
||||
--device /dev/davinci5 \\
|
||||
--device /dev/davinci6 \\
|
||||
--device /dev/davinci7 \\
|
||||
--device /dev/davinci_manager \\
|
||||
--device /dev/devmm_svm \\
|
||||
--device /dev/hisi_hdc \\
|
||||
-v /usr/local/dcmi:/usr/local/dcmi \\
|
||||
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \\
|
||||
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \\
|
||||
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \\
|
||||
-v /etc/ascend_install.info:/etc/ascend_install.info \\
|
||||
-p 10150:10150 \\
|
||||
-p 40000-41024:40000-41024 \\
|
||||
-p 50000-51024:50000-51024 \\
|
||||
--ipc=host \\
|
||||
-v gpustack-worker-data:/var/lib/gpustack \\
|
||||
gpustack/gpustack:${params.tag} \\
|
||||
--server-url ${params.server} --token ${params.token} --worker-ip ${params.workerip}`;
|
||||
}
|
||||
},
|
||||
musa: {
|
||||
|
||||
Reference in New Issue
Block a user