For chatting: Using user-defined models
| 265 | |
| 266 | //For chatting: Using user-defined models |
| 267 | void 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 |
| 289 | QString ChatManager::requestSync(const QString &prompt) |
no test coverage detected