MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / onLLMChanged

Method onLLMChanged

src/plugins/chat/chatmanager.cpp:346–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void 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
372void ChatManager::recevieDeleteResult(const QStringList &talkIds, bool success)
373{

Callers

nothing calls this directly

Calls 3

modelStateMethod · 0.80
getLLMMethod · 0.80
cancelMethod · 0.45

Tested by

no test coverage detected