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

Method getChunks

src/plugins/chat/chatmanager.cpp:150–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150QString ChatManager::getChunks(const QString &queryText)
151{
152 using dpfservice::ProjectService;
153 ProjectService *prjService = dpfGetService(ProjectService);
154 auto currentProjectPath = prjService->getActiveProjectInfo().workspaceFolder();
155
156 if (currentProjectPath != "") {
157 QJsonObject result = ChatManager::instance()->query(currentProjectPath, queryText, 20);
158 QJsonArray chunks = result["Chunks"].toArray();
159 if (!chunks.isEmpty()) {
160 if (result["Completed"].toBool() == false)
161 emit notify(0, tr("The indexing of project %1 has not been completed, which may cause the results to be inaccurate.").arg(currentProjectPath));
162 QString context;
163 context += "\n<context>\n";
164 for (auto chunk : chunks) {
165 context += chunk.toObject()["fileName"].toString();
166 context += '\n```';
167 context += chunk.toObject()["content"].toString();
168 context += "```\n\n";
169 }
170 context += "\n</context>";
171 return context;
172 } else if (ChatManager::instance()->condaHasInstalled()) {
173 emit noChunksFounded();
174 return "";
175 }
176 }
177
178 return "";
179}
180
181void ChatManager::repairDiagnostic(const QString &info)
182{

Callers

nothing calls this directly

Calls 7

notifyFunction · 0.85
toArrayMethod · 0.80
condaHasInstalledMethod · 0.80
getActiveProjectInfoMethod · 0.45
queryMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected