* @brief Creates a new untitled chat and returns its id. */
| 142 | * @brief Creates a new untitled chat and returns its id. |
| 143 | */ |
| 144 | QString AI::ChatStore::createChat() |
| 145 | { |
| 146 | Meta meta; |
| 147 | meta.id = QUuid::createUuid().toString(QUuid::WithoutBraces); |
| 148 | meta.createdAt = QDateTime::currentMSecsSinceEpoch(); |
| 149 | meta.updatedAt = meta.createdAt; |
| 150 | Q_ASSERT(!meta.id.isEmpty()); |
| 151 | |
| 152 | m_chats.prepend(meta); |
| 153 | writeIndex(); |
| 154 | return meta.id; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * @brief Reads one chat's snapshot, or an empty object when missing/corrupt. |
no test coverage detected