replaceHistory method

  1. @override
Future<void> replaceHistory(
  1. List<OmnixMessage> messages
)
override

Replaces native session history with messages.

Durable persistence remains the responsibility of a host or storage adapter. This method only restores the active model session.

Implementation

@override
Future<void> replaceHistory(List<OmnixMessage> messages) {
  if (_closed) throw StateError('Conversation is closed.');
  if (_generating) throw StateError('Generation is already in progress.');
  return _chat.clearHistory(
    replayHistory: messages.map(mapOmnixMessage).toList(growable: false),
  );
}