* @brief Persists the current chat, then opens a new empty one and switches to it. */
| 525 | * @brief Persists the current chat, then opens a new empty one and switches to it. |
| 526 | */ |
| 527 | void AI::Assistant::newChat() |
| 528 | { |
| 529 | if (m_conversation && m_conversation->messageCount() == 0 && !m_activeChatId.isEmpty()) |
| 530 | return; |
| 531 | |
| 532 | if (m_conversation && m_conversation->busy()) |
| 533 | m_conversation->cancel(); |
| 534 | |
| 535 | persistActiveChat(); |
| 536 | |
| 537 | m_activeChatId = m_chats.createChat(); |
| 538 | m_chats.setLastActiveId(m_activeChatId); |
| 539 | if (m_conversation) |
| 540 | m_conversation->clear(); |
| 541 | |
| 542 | AI::FileSandbox::instance().clearDroppedPaths(); |
| 543 | |
| 544 | Q_EMIT chatListChanged(); |
| 545 | Q_EMIT activeChatChanged(); |
| 546 | } |
| 547 | |
| 548 | /** |
| 549 | * @brief Persists the current chat and loads another saved chat into the conversation. |
nothing calls this directly
no test coverage detected