fix: model import name issues (#5093)
This commit is contained in:
parent
125104320e
commit
cdd13594a3
@ -35,7 +35,7 @@ export const useModelProvider = create<ModelProviderState>()(
|
|||||||
const mergedModels = [
|
const mergedModels = [
|
||||||
...models,
|
...models,
|
||||||
...(provider?.models ?? []).filter(
|
...(provider?.models ?? []).filter(
|
||||||
(e) => !provider?.models.some((m) => m.id === e.id)
|
(e) => !models.some((m) => m.id === e.id)
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -194,7 +194,7 @@ export const importModel = async (
|
|||||||
if (!path) throw new Error('No file selected')
|
if (!path) throw new Error('No file selected')
|
||||||
|
|
||||||
// Extract filename from path to use as model ID if not provided
|
// Extract filename from path to use as model ID if not provided
|
||||||
const defaultModelId = path.split('/').pop()?.replace(/ /g, '-') || path
|
const defaultModelId = path.split(/[/\\]/).pop()?.replace(/ /g, '-') || path
|
||||||
const modelIdToUse = modelId || defaultModelId
|
const modelIdToUse = modelId || defaultModelId
|
||||||
|
|
||||||
return await extension.importModel(modelIdToUse, path, provider)
|
return await extension.importModel(modelIdToUse, path, provider)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user