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

Method deleteChat

app/src/AI/Assistant.cpp:572–590  ·  view source on GitHub ↗

* @brief Deletes a chat; if it was active, falls back to the newest remaining (or a new) chat. */

Source from the content-addressed store, hash-verified

570 * @brief Deletes a chat; if it was active, falls back to the newest remaining (or a new) chat.
571 */
572void AI::Assistant::deleteChat(const QString& id)
573{
574 if (!m_chats.contains(id))
575 return;
576
577 const bool wasActive = (id == m_activeChatId);
578 m_chats.removeChat(id);
579
580 if (wasActive) {
581 const auto rows = m_chats.list();
582 m_activeChatId = rows.isEmpty() ? m_chats.createChat()
583 : rows.first().toMap().value(QStringLiteral("id")).toString();
584 m_chats.setLastActiveId(m_activeChatId);
585 loadActiveSnapshot();
586 Q_EMIT activeChatChanged();
587 }
588
589 Q_EMIT chatListChanged();
590}
591
592/**
593 * @brief Sets a user-chosen title on a chat.

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected