TsgcAIChat › Events › OnChatMessage
Fired when a complete assistant response has been received.
property OnChatMessage: TsgcAIChatMessageEvent;
// TsgcAIChatMessageEvent = procedure(Sender: TObject; const aRole, aContent: string) of object
—
Raised by Chat, ChatStream and ChatWithSystem once the assistant reply has been parsed and stored in history. aRole is always assistant and aContent carries the full response text (for ChatStream it is the concatenation of every streamed chunk). Use it to render or persist the final turn without handling the lower-level streaming event.
procedure TForm1.oChatChatMessage(Sender: TObject; const aRole, aContent: string);
begin
Memo1.Lines.Add(aRole + ': ' + aContent);
end;