| 344 | } |
| 345 | |
| 346 | void ChatManager::onLLMChanged(const LLMInfo &llmInfo) |
| 347 | { |
| 348 | if (chatLLM) { |
| 349 | if (chatLLM->modelState() == AbstractLLM::Busy) { |
| 350 | stopReceiving(); |
| 351 | chatLLM->cancel(); |
| 352 | } |
| 353 | disconnect(chatLLM, &AbstractLLM::dataReceived, this, nullptr); |
| 354 | disconnect(chatLLM, &AbstractLLM::customDataReceived, this, nullptr); |
| 355 | disconnect(this, &ChatManager::requestStop, chatLLM, &AbstractLLM::cancel); |
| 356 | }; |
| 357 | |
| 358 | auto aiSrv = dpfGetService(AiService); |
| 359 | auto selectedLLM = aiSrv->getLLM(llmInfo); |
| 360 | if (!selectedLLM) { |
| 361 | QString error = tr("llm named: %1 is not avaliable.").arg(llmInfo.modelName); |
| 362 | emit notify(1, error); |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | chatLLM = selectedLLM; |
| 367 | initLLM(chatLLM); |
| 368 | currentInfo = llmInfo; |
| 369 | emit llmChanged(llmInfo); |
| 370 | } |
| 371 | |
| 372 | void ChatManager::recevieDeleteResult(const QStringList &talkIds, bool success) |
| 373 | { |
nothing calls this directly
no test coverage detected