| 426 | } |
| 427 | |
| 428 | void ClientInterface::cancelRequest() |
| 429 | { |
| 430 | QSet<PluginLLMCore::Provider *> providers; |
| 431 | for (auto it = m_activeRequests.begin(); it != m_activeRequests.end(); ++it) { |
| 432 | if (it.value().provider) { |
| 433 | providers.insert(it.value().provider); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | for (auto *provider : providers) { |
| 438 | disconnect(provider->client(), nullptr, this, nullptr); |
| 439 | } |
| 440 | |
| 441 | for (auto it = m_activeRequests.begin(); it != m_activeRequests.end(); ++it) { |
| 442 | const RequestContext &ctx = it.value(); |
| 443 | if (ctx.provider) { |
| 444 | ctx.provider->cancelRequest(it.key()); |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | m_activeRequests.clear(); |
| 449 | m_accumulatedResponses.clear(); |
| 450 | m_awaitingContinuation.clear(); |
| 451 | |
| 452 | LOG_MESSAGE("All requests cancelled and state cleared"); |
| 453 | } |
| 454 | |
| 455 | void ClientInterface::handleLLMResponse(const QString &response, const QJsonObject &request) |
| 456 | { |