From e5f5d887e3cbc33ae9b7dc222767ff3dc3e371c0 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 28 Oct 2024 19:25:45 +0700 Subject: [PATCH] fix: persists model.json on download (legacy models) --- extensions/model-extension/src/legacy/download.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extensions/model-extension/src/legacy/download.ts b/extensions/model-extension/src/legacy/download.ts index a1a998daf..d4d6c62d9 100644 --- a/extensions/model-extension/src/legacy/download.ts +++ b/extensions/model-extension/src/legacy/download.ts @@ -19,6 +19,14 @@ export const downloadModel = async ( const modelDirPath = await joinPath([homedir, model.id]) if (!(await fs.existsSync(modelDirPath))) await fs.mkdir(modelDirPath) + const jsonFilePath = await joinPath([modelDirPath, 'model.json']) + // Write model.json on download + if (!(await fs.existsSync(jsonFilePath))) + await fs.writeFileSync( + jsonFilePath, + JSON.stringify(model, null, 2) + ) + if (model.engine === InferenceEngine.nitro_tensorrt_llm) { if (!gpuSettings || gpuSettings.gpus.length === 0) { console.error('No GPU found. Please check your GPU setting.')