TsgcAIChat › Events › OnChatStream
Fired for every partial chunk delivered while streaming.
property OnChatStream: TsgcAIChatStreamEvent;
// TsgcAIChatStreamEvent = procedure(Sender: TObject; const aChunk: string; var Cancel: Boolean) of object
—
Raised by ChatStream for each server-sent event chunk that carries assistant text. aChunk contains the incremental token text already decoded from the provider's JSON envelope. Set Cancel to True to abort further chunks; the partial text received so far is still stored in history. Use this event to progressively render the response in a UI.
procedure TForm1.oChatChatStream(Sender: TObject; const aChunk: string;
var Cancel: Boolean);
begin
Memo1.Text := Memo1.Text + aChunk;
end;