fix: model import name and id is wrong on Windows

This commit is contained in:
Louis 2024-11-11 10:30:22 +07:00
parent 244d3d10dc
commit 19879ef279

View File

@ -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