TsgcAIChat › Properties › MaxHistoryMessages
Maximum number of messages kept in the conversation history.
property MaxHistoryMessages: Integer read FMaxHistoryMessages write SetMaxHistoryMessages;
—
The component stores each user and assistant turn in an internal history so subsequent requests carry prior context. When the history grows past this limit the oldest messages are dropped in FIFO order. Defaults to 50. Raise it for long multi-turn dialogs (bearing in mind provider token limits) or lower it to reduce request size and cost. Call ClearHistory to wipe the buffer without changing the limit.
oChat.MaxHistoryMessages := 20;