diff --git a/src/web/server.py b/src/web/server.py index ccc65a0..94bf547 100644 --- a/src/web/server.py +++ b/src/web/server.py @@ -1950,6 +1950,25 @@ class WebServer: path = await client.download_model(model) if not path: raise HTTPException(status_code=500, detail="Download failed") + # Save metadata alongside the model file + import json + meta = { + "id": data.get("id"), + "name": data.get("name"), + "filename": data.get("filename"), + "size_bytes": data.get("size"), + "author": data.get("author"), + "author_avatar": data.get("author_avatar"), + "thumbnail": data.get("thumbnail"), + "tone_description": data.get("tone_description"), + "pack_name": data.get("pack_name"), + "architecture": data.get("architecture"), + "created_at": data.get("created_at"), + "download_date": datetime.datetime.now().isoformat(), + "source": "tone3000", + } + meta_path = path.with_suffix(".meta.json") + meta_path.write_text(json.dumps(meta, indent=2)) # Refresh the model list via NAM host nam = self.deps.nam_host if nam: diff --git a/src/web/ui-v2-dist/index.html b/src/web/ui-v2-dist/index.html index 9d3d2bb..c0d90fc 100644 --- a/src/web/ui-v2-dist/index.html +++ b/src/web/ui-v2-dist/index.html @@ -1021,10 +1021,10 @@ function init(){ const d=document.createElement('div'); d.className='preset-card'; d.style.cursor='default'; - d.innerHTML='
'+(item.name||'Unknown')+'
'+(item.author||'')+'
'; + d.innerHTML='
'+(item.name||'Unknown')+'
'+(item.author||'')+(item.pack_name?' · '+item.pack_name:'')+'
'+(item.size_display||'')+(item.architecture?' · '+item.architecture:'')+'
'; d.querySelector('button').onclick=async()=>{ d.querySelector('button').textContent='...'; - try{await API._fetch('/api/models/tonedownload/install',{method:'POST',body:JSON.stringify({download_url:item.download_url,name:item.name}),timeout:60000});toast('Downloaded!');d.querySelector('button').textContent='✓';}catch(e){toast(e.message);d.querySelector('button').textContent='Retry';} + try{await API._fetch('/api/models/tonedownload/install',{method:'POST',body:JSON.stringify({id:item.id,download_url:item.download_url,name:item.name,filename:item.filename,size:item.size,author:item.author,author_avatar:item.author_avatar,thumbnail:item.thumbnail,tone_description:item.tone_description,pack_name:item.pack_name,architecture:item.architecture,created_at:item.created_at}),timeout:60000});toast('Downloaded!');d.querySelector('button').textContent='✓';}catch(e){toast(e.message);d.querySelector('button').textContent='Retry';} }; res.appendChild(d); });