fix: nhãn của soundfont hiển thị sai và không load được instrument

This commit is contained in:
2026-07-23 22:32:19 +07:00
parent 1a28ebabee
commit 6a17e7036c
14 changed files with 259 additions and 111 deletions
+24
View File
@@ -72,6 +72,30 @@ async def upload_soundfont(
return {"id": file_id, "name": file.filename, "path": dest_path, "size_bytes": len(contents)}
@router.delete("/soundfont/{sf_id}")
async def delete_soundfont(sf_id: str, current_user: dict = Depends(get_current_user)):
base_id = sf_id.replace("sf_", "")
deleted = False
for d in [UPLOAD_SF_DIR, os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "static", "soundfonts")]:
if not os.path.isdir(d):
continue
for f in os.listdir(d):
if os.path.splitext(f)[0] == base_id:
path = os.path.join(d, f)
os.remove(path)
# Remove associated .meta file
meta_path = os.path.join(d, os.path.splitext(f)[0] + ".meta")
if os.path.isfile(meta_path):
os.remove(meta_path)
deleted = True
break
if deleted:
break
if not deleted:
raise HTTPException(status_code=404, detail="SoundFont not found")
return {"deleted": True, "sf_id": sf_id}
class RenderRequest(BaseModel):
project_json: dict
output_filename: Optional[str] = "render_output.wav"