appendAssistantDelta method

void appendAssistantDelta(
  1. String text
)

Appends a chunk of assistant text to the streaming response.

Implementation

void appendAssistantDelta(String text) {
  if (_messages.isEmpty) return;
  final last = _messages.last;
  if (last.role != AiRole.assistant) return;
  _messages[_messages.length - 1] = AiChatMessage.assistant(
    last.content + text,
  );
  notifyListeners();
}