@@ -54,21 +54,24 @@ void RequestHandler::sendLLMRequest(const LLMConfig &config, const QJsonObject &
54
54
connect (reply, &QNetworkReply::readyRead, this , [this , reply, request, config]() {
55
55
handleLLMResponse (reply, request, config);
56
56
});
57
- connect (reply, &QNetworkReply::finished, this , [manager]() { manager->deleteLater (); });
58
57
59
- connect (reply, &QNetworkReply::finished, this , [this , reply, requestId]() {
60
- reply->deleteLater ();
58
+ connect (reply, &QNetworkReply::finished, this , [this , reply, requestId, manager]() {
61
59
m_activeRequests.remove (requestId);
62
60
if (reply->error () != QNetworkReply::NoError) {
63
- LOG_MESSAGE (QString (" Error details: %1\n Status code: %2\n Response: %3" )
64
- .arg (reply->errorString ())
65
- .arg (reply->attribute (QNetworkRequest::HttpStatusCodeAttribute).toInt ())
66
- .arg (QString (reply->readAll ())));
67
- emit requestFinished (requestId, false , reply->errorString ());
61
+ QString errorMessage = reply->errorString ();
62
+ int statusCode = reply->attribute (QNetworkRequest::HttpStatusCodeAttribute).toInt ();
63
+
64
+ LOG_MESSAGE (
65
+ QString (" Error details: %1\n Status code: %2" ).arg (errorMessage).arg (statusCode));
66
+
67
+ emit requestFinished (requestId, false , errorMessage);
68
68
} else {
69
69
LOG_MESSAGE (" Request finished successfully" );
70
70
emit requestFinished (requestId, true , QString ());
71
71
}
72
+
73
+ reply->deleteLater ();
74
+ manager->deleteLater ();
72
75
});
73
76
}
74
77
0 commit comments