| 164 | } |
| 165 | |
| 166 | void FileEditController::updateFileEditStatus(const QString &editId, const QString &status) |
| 167 | { |
| 168 | auto messages = m_chatModel->getChatHistory(); |
| 169 | for (int i = 0; i < messages.size(); ++i) { |
| 170 | if (messages[i].role == Chat::ChatModel::FileEdit && messages[i].id == editId) { |
| 171 | QString content = messages[i].content; |
| 172 | |
| 173 | const QString marker = "QODEASSIST_FILE_EDIT:"; |
| 174 | int markerPos = content.indexOf(marker); |
| 175 | |
| 176 | QString jsonStr = content; |
| 177 | if (markerPos >= 0) { |
| 178 | jsonStr = content.mid(markerPos + marker.length()); |
| 179 | } |
| 180 | |
| 181 | QJsonDocument doc = QJsonDocument::fromJson(jsonStr.toUtf8()); |
| 182 | if (doc.isObject()) { |
| 183 | QJsonObject obj = doc.object(); |
| 184 | obj["status"] = status; |
| 185 | |
| 186 | auto edit = Context::ChangesManager::instance().getFileEdit(editId); |
| 187 | if (!edit.statusMessage.isEmpty()) { |
| 188 | obj["status_message"] = edit.statusMessage; |
| 189 | } |
| 190 | |
| 191 | QString updatedContent = marker |
| 192 | + QString::fromUtf8( |
| 193 | QJsonDocument(obj).toJson(QJsonDocument::Compact)); |
| 194 | m_chatModel->updateMessageContent(editId, updatedContent); |
| 195 | LOG_MESSAGE(QString("Updated file edit status to: %1").arg(status)); |
| 196 | } |
| 197 | break; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | updateStats(); |
| 202 | } |
| 203 | |
| 204 | void FileEditController::applyAllForCurrentMessage() |
| 205 | { |
nothing calls this directly
no test coverage detected