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

Method create

src/plugins/aimanager/codegeex/codegeexllm.cpp:409–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409QJsonObject CodeGeeXLLM::create(const Conversation &conversation)
410{
411 QJsonObject dataObject;
412 dataObject.insert("ide", qApp->applicationName());
413
414 if (d->talkId.isEmpty())
415 d->createNewSession();
416
417 const QJsonArray &array = conversation.getConversions();
418 QString prompt = "";
419 if (!array.isEmpty() && array.last()["role"] == "user") {
420 prompt = array.last()["content"].toString();
421 }
422 QJsonArray history {}; // [{user}, {assistant} {..}]
423 for (int i = 0; i < array.size() - 1; i++) {
424 QJsonObject obj;
425 if (array[i]["role"] == "user" && array[i+1]["role"] == "assistant") {
426 obj.insert("query", array[i]["content"].toString());
427 obj.insert("answer", array[i+1]["content"].toString());
428 }
429 history.append(obj);
430 }
431
432 dataObject.insert("prompt", prompt);
433 dataObject.insert("machineId", QString(QSysInfo::machineUniqueId()));
434 dataObject.insert("history", history);
435 dataObject.insert("locale", d->locale);
436 dataObject.insert("model", d->modelName);
437 dataObject.insert("stream", d->stream);
438 dataObject.insert("talkId", d->talkId);
439
440 return dataObject;
441}
442
443void CodeGeeXLLM::request(const QJsonObject &data)
444{

Callers 3

loadMethod · 0.45
doParseMethod · 0.45
requestAsyncMethod · 0.45

Calls 8

insertMethod · 0.80
createNewSessionMethod · 0.80
getConversionsMethod · 0.80
QStringClass · 0.50
isEmptyMethod · 0.45
toStringMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected