* @brief Forwards a user message to the active conversation after the availability gate. */
| 453 | * @brief Forwards a user message to the active conversation after the availability gate. |
| 454 | */ |
| 455 | void AI::Assistant::sendMessage(const QString& userText) |
| 456 | { |
| 457 | if (!isProAvailable()) { |
| 458 | Q_EMIT errorOccurred(tr("AI Assistant is not available in this build")); |
| 459 | return; |
| 460 | } |
| 461 | |
| 462 | if (!hasAnyKey()) { |
| 463 | Q_EMIT errorOccurred(tr("Set an API key first")); |
| 464 | return; |
| 465 | } |
| 466 | |
| 467 | rewireConversationProvider(); |
| 468 | m_conversation->start(userText); |
| 469 | } |
| 470 | |
| 471 | /** |
| 472 | * @brief Aborts the in-flight reply, if any. |