add sleep 500ms if platform is windows (#1215)
Co-authored-by: Hien To <tominhhien97@gmail.com>
This commit is contained in:
parent
1682f894a5
commit
d4b4540505
@ -68,6 +68,15 @@ async function loadModel(nitroResourceProbe: any | undefined) {
|
|||||||
if (!nitroResourceProbe) nitroResourceProbe = await getResourcesInfo();
|
if (!nitroResourceProbe) nitroResourceProbe = await getResourcesInfo();
|
||||||
return killSubprocess()
|
return killSubprocess()
|
||||||
.then(() => tcpPortUsed.waitUntilFree(PORT, 300, 5000))
|
.then(() => tcpPortUsed.waitUntilFree(PORT, 300, 5000))
|
||||||
|
// wait for 500ms to make sure the port is free for windows platform
|
||||||
|
.then(() => {
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
return sleep(500);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return sleep(0);
|
||||||
|
}
|
||||||
|
})
|
||||||
.then(() => spawnNitroProcess(nitroResourceProbe))
|
.then(() => spawnNitroProcess(nitroResourceProbe))
|
||||||
.then(() => loadLLMModel(currentSettings))
|
.then(() => loadLLMModel(currentSettings))
|
||||||
.then(validateModelStatus)
|
.then(validateModelStatus)
|
||||||
@ -78,6 +87,11 @@ async function loadModel(nitroResourceProbe: any | undefined) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add function sleep
|
||||||
|
function sleep(ms) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
function promptTemplateConverter(promptTemplate) {
|
function promptTemplateConverter(promptTemplate) {
|
||||||
// Split the string using the markers
|
// Split the string using the markers
|
||||||
const systemMarker = "{system_message}";
|
const systemMarker = "{system_message}";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user