| 173 | } |
| 174 | |
| 175 | QString 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 | |
| 201 | QString Utils::createChunkPrompt(const QJsonObject &chunkObj) |
| 202 | { |
nothing calls this directly
no test coverage detected