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

Method createRequestPrompt

src/plugins/smartut/utils/utils.cpp:175–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175QString Utils::createRequestPrompt(const FileNode *node, const QString &chunkPrompt, const QString &userPrompt)
176{
177 QStringList prompt;
178 prompt << "##### Prompt #####"
179 << "<system>"
180 << "You are an expert software developer. You give helpful and concise responses.\n"
181 << "<user>";
182
183 QStringList fileContents;
184 for (const auto &file : node->sourceFiles()) {
185 fileContents << "```" + file;
186 QFile f(file);
187 if (f.open(QIODevice::ReadOnly))
188 fileContents << f.readAll();
189 fileContents << "```\n";
190 }
191
192 if (!chunkPrompt.isEmpty())
193 prompt << chunkPrompt;
194 prompt << fileContents;
195 prompt << node->sourceFiles().join(" ");
196 prompt << userPrompt;
197
198 return prompt.join('\n');
199}
200
201QString Utils::createChunkPrompt(const QJsonObject &chunkObj)
202{

Callers

nothing calls this directly

Calls 4

sourceFilesMethod · 0.80
readAllMethod · 0.80
openMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected