* @brief Forwards every chunk from the network reply into the SSE reader. */
| 318 | * @brief Forwards every chunk from the network reply into the SSE reader. |
| 319 | */ |
| 320 | void AI::AnthropicReply::onReplyReadyRead() |
| 321 | { |
| 322 | if (!m_reply || m_finished) |
| 323 | return; |
| 324 | |
| 325 | const auto status = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); |
| 326 | if (status >= 400) |
| 327 | return; |
| 328 | |
| 329 | m_sse->feed(m_reply->readAll()); |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * @brief Handles end-of-stream cleanup and surfaces 4xx/5xx error bodies. |