* @brief Picks the active chat on startup (last active, newest, or a fresh one) and loads it. */
| 686 | * @brief Picks the active chat on startup (last active, newest, or a fresh one) and loads it. |
| 687 | */ |
| 688 | void AI::Assistant::initChats() |
| 689 | { |
| 690 | if (m_chats.isEmpty()) { |
| 691 | m_activeChatId = m_chats.createChat(); |
| 692 | } else { |
| 693 | m_activeChatId = m_chats.lastActiveId(); |
| 694 | if (m_activeChatId.isEmpty() || !m_chats.contains(m_activeChatId)) |
| 695 | m_activeChatId = m_chats.list().first().toMap().value(QStringLiteral("id")).toString(); |
| 696 | } |
| 697 | |
| 698 | m_chats.setLastActiveId(m_activeChatId); |
| 699 | loadActiveSnapshot(); |
| 700 | } |
| 701 | |
| 702 | /** |
| 703 | * @brief Loads the active chat's snapshot into the conversation, or clears it when empty. |
nothing calls this directly
no test coverage detected