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

Method requestAsync

src/plugins/chat/chatmanager.cpp:267–286  ·  view source on GitHub ↗

For chatting: Using user-defined models

Source from the content-addressed store, hash-verified

265
266//For chatting: Using user-defined models
267void ChatManager::requestAsync(const QString &prompt)
268{
269 if (!chatLLM || chatLLM->modelState() == AbstractLLM::Busy)
270 return;
271
272 answerFlag++;
273 startReceiving();
274 QtConcurrent::run([=]() {
275 auto processedText = promptPreProcessing(prompt);
276 if (processedText.isEmpty())
277 return;
278 auto c = chatLLM->getCurrentConversation();
279 c->addUserData(processedText);
280 QJsonObject obj = chatLLM->create(*c);
281 if (isConnectToNetWork())
282 obj.insert("command", "online_search_v1"); // only worked on CodeGeeX llm
283 if (isRunning) // incase stop generate before prompt preprocessed
284 emit sendSyncRequest(obj);
285 });
286}
287
288//For quick processing of special requests
289QString ChatManager::requestSync(const QString &prompt)

Callers 5

fixBugMethod · 0.80
explainMethod · 0.80
reviewMethod · 0.80
testsMethod · 0.80
commitsMethod · 0.80

Calls 6

modelStateMethod · 0.80
addUserDataMethod · 0.80
insertMethod · 0.80
isEmptyMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected