chore: queue server start and model load

This commit is contained in:
Louis 2024-11-07 12:06:46 +07:00
parent e41bcffcef
commit ced44973b8

View File

@ -11,7 +11,6 @@ import {
executeOnMain, executeOnMain,
systemInformation, systemInformation,
joinPath, joinPath,
dirName,
LocalOAIEngine, LocalOAIEngine,
InferenceEngine, InferenceEngine,
getJanDataFolderPath, getJanDataFolderPath,
@ -97,7 +96,7 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
model.settings = settings model.settings = settings
} }
return await ky return await this.queue.add(() => ky
.post(`${CORTEX_API_URL}/v1/models/start`, { .post(`${CORTEX_API_URL}/v1/models/start`, {
json: { json: {
...extractModelLoadParams(model.settings), ...extractModelLoadParams(model.settings),
@ -112,7 +111,7 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
.catch(async (e) => { .catch(async (e) => {
throw (await e.response?.json()) ?? e throw (await e.response?.json()) ?? e
}) })
.then() .then())
} }
override async unloadModel(model: Model): Promise<void> { override async unloadModel(model: Model): Promise<void> {