MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / initChats

Method initChats

app/src/AI/Assistant.cpp:688–700  ·  view source on GitHub ↗

* @brief Picks the active chat on startup (last active, newest, or a fresh one) and loads it. */

Source from the content-addressed store, hash-verified

686 * @brief Picks the active chat on startup (last active, newest, or a fresh one) and loads it.
687 */
688void 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.

Callers

nothing calls this directly

Calls 8

isEmptyMethod · 0.80
createChatMethod · 0.80
lastActiveIdMethod · 0.80
firstMethod · 0.80
setLastActiveIdMethod · 0.80
containsMethod · 0.45
valueMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected