Fix 422 on text-only conversation turns
UploadFile | None = File(None) with from __future__ import annotations caused FastAPI to still treat audio as required when omitted. Changed to Optional[UploadFile] = None (no File() wrapper) so the field is genuinely optional for text-input turns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
74e5181b7e
commit
b3a408bfd9
@ -9,6 +9,11 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Text-input turns returned 422** — `UploadFile | None = File(None)` with
|
||||
`from __future__ import annotations` caused FastAPI to treat `audio` as a
|
||||
required field even when omitted. Changed to `Optional[UploadFile] = None`
|
||||
(no `File()` wrapper) so the field is genuinely optional for text-only turns.
|
||||
|
||||
- **Conversation input bar hidden when mic unavailable** — the mic-blocked
|
||||
warning box was inserted before `conv-chat-window` inside the flex column,
|
||||
pushing the input bar off-screen. Fixed by prepending the warning inside
|
||||
|
||||
@ -11,7 +11,8 @@ import wave
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
from fastapi import APIRouter, File, Form, HTTPException, Request, UploadFile
|
||||
from typing import Optional
|
||||
from fastapi import APIRouter, Form, HTTPException, Request, UploadFile
|
||||
from fastapi.responses import Response, StreamingResponse
|
||||
|
||||
from core.config import _load_settings, _save_settings, _clean_preview_backend
|
||||
@ -659,7 +660,7 @@ async def conversation_llm_models(url: str = ""):
|
||||
|
||||
@router.post("/api/conversation/turn")
|
||||
async def conversation_turn(
|
||||
audio: UploadFile | None = File(None),
|
||||
audio: Optional[UploadFile] = None,
|
||||
text: str = Form(""),
|
||||
stt_backend: str = Form("configured"),
|
||||
llm_url: str = Form(""),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user