fix: handle modelId special char

This commit is contained in:
Faisal Amir 2025-08-14 09:18:03 +07:00
parent 985a8f31ae
commit b338849952
2 changed files with 5 additions and 3 deletions

View File

@ -287,8 +287,8 @@ function Hub() {
const handleDownload = () => { const handleDownload = () => {
// Immediately set local downloading state // Immediately set local downloading state
addLocalDownloadingModel(modelId) addLocalDownloadingModel(modelId.replace(/[^a-zA-Z0-9/_\-.]/g, ''))
pullModel(modelId, modelUrl) pullModel(modelId.replace(/[^a-zA-Z0-9/_\-.]/g, ''), modelUrl)
} }
return ( return (

View File

@ -162,7 +162,9 @@ export const convertHfRepoToCatalogModel = (
} }
// Generate model_id from filename (remove .gguf extension, case-insensitive) // Generate model_id from filename (remove .gguf extension, case-insensitive)
const modelId = file.rfilename.replace(/\.gguf$/i, '') const modelId = file.rfilename
.replace(/\.gguf$/i, '')
.replace(/[^a-zA-Z0-9/_\-.]/g, '')
return { return {
model_id: modelId, model_id: modelId,