diff --git a/CHANGELOG.md b/CHANGELOG.md index 03f98e0..615c628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/routes/conversation.py b/routes/conversation.py index 625baca..27050b5 100644 --- a/routes/conversation.py +++ b/routes/conversation.py @@ -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(""),