From 19879ef2790bc5f60d16d1ac1913419cc0d50636 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 11 Nov 2024 10:30:22 +0700 Subject: [PATCH] fix: model import name and id is wrong on Windows --- web/hooks/useImportModel.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/hooks/useImportModel.ts b/web/hooks/useImportModel.ts index 093385f0d..ee66c9e8f 100644 --- a/web/hooks/useImportModel.ts +++ b/web/hooks/useImportModel.ts @@ -5,11 +5,11 @@ import { ImportingModel, LocalImportModelEvent, Model, - ModelEvent, ModelExtension, OptionType, events, fs, + baseName } from '@janhq/core' import { atom, useSetAtom } from 'jotai' @@ -61,8 +61,8 @@ const useImportModel = () => { const importModels = useCallback( (models: ImportingModel[], optionType: OptionType) => { - models.map((model) => { - const modelId = model.modelId ?? model.path.split('/').pop() + models.map(async (model) => { + const modelId = model.modelId ?? await baseName(model.path) if (modelId) { addDownloadingModel(modelId) extensionManager