| 116 | } |
| 117 | |
| 118 | void TaskManager::fixIssueWithAi(const QModelIndex &index) |
| 119 | { |
| 120 | auto realIndex = filterModel->mapToSource(index); |
| 121 | const auto &task = model->task(realIndex); |
| 122 | if (task.isNull()) |
| 123 | return; |
| 124 | |
| 125 | QString context; |
| 126 | if (!task.file.toString().isEmpty() && task.line > 0) |
| 127 | context = readContext(task.file.toString(), task.line - 1); |
| 128 | |
| 129 | QString prompt = context + "\n\n"; |
| 130 | const auto title = OptionManager::getInstance()->getValue("Builder", "CurrentPrompt").toString(); |
| 131 | if (title.isEmpty()) { |
| 132 | prompt += SettingDialog::defaultIssueFixPrompt() + '\n'; |
| 133 | } else { |
| 134 | const auto prompts = OptionManager::getInstance()->getValue("Builder", "Prompts").toMap(); |
| 135 | prompt += prompts.value(title).toString() + '\n'; |
| 136 | } |
| 137 | |
| 138 | prompt += task.description; |
| 139 | aiSrv->chatWithAi(prompt); |
| 140 | winSrv->showWidgetAtRightspace(MWNA_CHAT); |
| 141 | } |
| 142 | |
| 143 | void TaskManager::currentChanged(const QModelIndex &index) |
| 144 | { |