mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-29 07:05:14 -07:00
fix(settings): honor explicit null on nullable fields, ignore on the rest
Routes were calling model_dump(exclude_none=True), which drops every client-sent null before it reaches the service. The service then layered on its own `if value is not None` guard. Net effect: setting a nullable column back to null was a no-op — the MCPPage default-voice picker sends null when the user picks "no default" and the row was silently keeping whatever was there before. Switched the routes to exclude_unset=True so absent fields stay absent but explicit nulls survive the dump, and centralised the per-field nullability check in the service. The check inspects the SQLAlchemy column metadata so non-nullable columns (stt_model, llm_model, the chord key lists) still drop nulls instead of crashing the request, while default_playback_voice_id can finally be cleared.
This commit is contained in:
@@ -20,7 +20,7 @@ async def update_capture_settings_endpoint(
|
||||
patch: models.CaptureSettingsUpdate,
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
return settings_service.update_capture_settings(db, patch.model_dump(exclude_none=True))
|
||||
return settings_service.update_capture_settings(db, patch.model_dump(exclude_unset=True))
|
||||
|
||||
|
||||
@router.get("/generation", response_model=models.GenerationSettingsResponse)
|
||||
@@ -33,4 +33,4 @@ async def update_generation_settings_endpoint(
|
||||
patch: models.GenerationSettingsUpdate,
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
return settings_service.update_generation_settings(db, patch.model_dump(exclude_none=True))
|
||||
return settings_service.update_generation_settings(db, patch.model_dump(exclude_unset=True))
|
||||
|
||||
Reference in New Issue
Block a user