Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

An Empty Model Handshake Needs a Recoverable Error, Not a Disabled Composer

Описание и применение

Проблема: после отправки запроса чат‑UI блокирует поле ввода, если сервер возвращает пустой успешный ответ. Решение: заменить два булевых флага на типизированный «фазовый» объект и таймер, который определяет, был ли получен первый байт. Это позволяет корректно отображать сообщение об ошибке и кнопку «Повторить».

Задача

The chat UI locks the composer after sending a prompt when the backend returns an empty successful response, leaving the user unable to retry or continue.

Результат

Implemented a typed state machine for chat phases, enabling the UI to correctly handle empty successful handshakes by showing an error message and retry option instead of locking the composer.

Рабочий процесс

  • 1. User types prompt and presses Enter. 2. UI sets streaming=true, disables composer, shows spinner. 3. Backend returns 200 with no data frames. 4. Reader loop exits cleanly; streaming=false, error=null. 5. UI incorrectly treats this as success, leaving composer disabled and retry hidden. 6. User cannot retry or type again. 7. Fix: replace booleans with a discriminated union ChatPhase. 8. Add timer to detect first byte or silence. 9. On empty handshake, set phase to "empty", enable composer, show status and Retry button. 10. User can retry or type new prompt.

Доказательства

The composer used a boolean latch instead of a typed phase. Booleans cannot represent “handshake started but no first token.”

Источник

I replaced the booleans with a discriminated union and a timer that owns the first byte, not the full generation.

Источник

  • Дата записи: 2026-09-21T23:00:42.369Z