File size: 913 Bytes
c6535db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {api} from "@/composable/comfyAPI.js";
import {toast} from "@/components/toast.js";
import {$t} from "@/composable/i18n.js";

/*
* Clean GPU
*/
export const cleanVRAM = async() =>{
    try {
        const {Running, Pending} = await api.getQueue()
        if(Running.length>0 || Pending.length>0){
            toast.error($t("Clean Failed")+ ":"+ $t("Please stop all running tasks before cleaning GPU"))
            return
        }
        const res = await api.fetchApi("/easyuse/cleangpu",{method:"POST"})
        if(res.status == 200){
            toast.success($t("Clean SuccessFully"))
        }else{
            toast.error($t("Clean Failed"))
        }
    } catch (exception) {}
}

/*
* Reboot
*/
export const reboot = async()=>{
    if (confirm($t("Are you sure you'd like to reboot the server?"))){
        try {
            api.fetchApi("/easyuse/reboot");
        } catch (exception) {}
    }
}