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

Method query

src/plugins/chat/chatmanager.cpp:638–672  ·  view source on GitHub ↗

JsonObject: Query: str Chunks: Arr[fileName:str, content:str] Instructions: obj{name:str, description:str, content:str} */

Source from the content-addressed store, hash-verified

636 Instructions: obj{name:str, description:str, content:str}
637*/
638QJsonObject ChatManager::query(const QString &projectPath, const QString &query, int topItems)
639{
640 QProcess process;
641
642 QObject::connect(&process, &QProcess::readyReadStandardError, &process, [&]() {
643 qInfo() << "Error:" << process.readAllStandardError() << "\n";
644 });
645
646 // If modified, update the Python file accordingly.
647 auto pythonPath = condaRootPath() + "/miniforge/envs/deepin_unioncode_env/bin/python";
648 if (!QFileInfo(pythonPath).exists() || !QFileInfo(condaRootPath() + "/index.sqlite").exists())
649 return {};
650
651 auto modelPath = CustomPaths::CustomPaths::global(CustomPaths::Models);
652 auto ragPath = CustomPaths::CustomPaths::global(CustomPaths::Scripts) + "/rag";
653 process.setWorkingDirectory(ragPath);
654 auto queryPyPath = ragPath + "/query.py";
655 process.start(pythonPath, QStringList() << queryPyPath << modelPath << projectPath << query << QString::number(topItems));
656 process.waitForFinished();
657 auto result = process.readAll();
658 QJsonDocument document = QJsonDocument::fromJson(result);
659
660 QJsonObject obj = document.object();
661 if (indexingProject.contains(projectPath))
662 obj["Completed"] = false;
663 else
664 obj["Completed"] = true;
665
666 if (isReferenceCodebase())
667 currentChunks = obj;
668 else
669 currentChunks = QJsonObject();
670
671 return obj;
672}

Callers 5

triggerBuildMethod · 0.45
getChunksMethod · 0.45
createPromptMethod · 0.45
chunkPromptMethod · 0.45

Calls 9

connectFunction · 0.85
numberClass · 0.85
readAllStandardErrorMethod · 0.80
readAllMethod · 0.80
existsMethod · 0.45
setWorkingDirectoryMethod · 0.45
startMethod · 0.45
objectMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected