| 124 | } |
| 125 | |
| 126 | void Copilot::addComment() |
| 127 | { |
| 128 | QString prompt = "You're an intelligent programming assistant." |
| 129 | " You'll answer any questions you may have about programming, code, or computers, and provide formatted, executable, accurate, and secure code." |
| 130 | " Task: Please provide a comment for the input code, including multi-line comments and single-line comments, please be careful not to change the original code, only add comments." |
| 131 | " Directly return the code without any Markdown formatting, such as ```, ```cpp, etc. " |
| 132 | "\n\ncode: ```%1```"; |
| 133 | copilotLLM->setStream(false); |
| 134 | copilotLLM->request(prompt.arg(selectedText()), [=](const QString &data, AbstractLLM::ResponseState state){ |
| 135 | if (state == AbstractLLM::ResponseState::Success) { |
| 136 | if (!data.isEmpty()) |
| 137 | replaceSelectedText(data); |
| 138 | } |
| 139 | }); |
| 140 | } |
| 141 | |
| 142 | void Copilot::fixBug() |
| 143 | { |