| 48 | } |
| 49 | |
| 50 | bool Conversation::addUserData(const QString &data) |
| 51 | { |
| 52 | if (!data.isEmpty()) { |
| 53 | const QJsonDocument &document = QJsonDocument::fromJson(data.toUtf8()); |
| 54 | if (document.isArray()) { |
| 55 | conversation = document.array(); |
| 56 | } else { |
| 57 | conversation.push_back(QJsonObject({ { "role", "user" }, {"content", data} })); |
| 58 | } |
| 59 | return true; |
| 60 | } |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | bool Conversation::popUserData() |
| 65 | { |
no test coverage detected