closeConversation method

Future<void> closeConversation({
  1. String? conversationId,
})

Close current conversation

Implementation

Future<void> closeConversation({String? conversationId}) async {
  final convId = conversationId ?? _currentConversationId;
  if (convId == null) return;

  try {
    final request = CloseConversationRequest()..conversationId = convId;
    await _client!.closeConversation(request);

    if (convId == _currentConversationId) {
      _currentConversationId = null;
    }

    debugPrint('[LiteRtLmClient] Conversation closed: $convId');
  } catch (e) {
    debugPrint('[LiteRtLmClient] Warning: Failed to close conversation: $e');
  }
}