TsgcAIOpenAIChatBot › Methods › ChatAsUser
Sends a text prompt as the user role and triggers a ChatCompletion reply (spoken via TextToSpeech).
void __fastcall ChatAsUser(const UnicodeString aPrompt, TsgcOpenAIArray_Request_Completion_Messages * aHistory = nil);
| Name | Type | Description |
|---|---|---|
aPrompt | const string | The user message sent to the ChatCompletion API. |
aHistory | TsgcOpenAIArray_Request_Completion_Messages | Optional previous messages prepended to the request to preserve conversation context. Pass nil for a single-turn call. |
Builds a ChatCompletion request using ChatBotOptions.ChatCompletion.Model, appends aHistory (if any) followed by the new user message, and calls the OpenAI API. The assistant reply is raised via OnChatCompletion and then forwarded to TextToSpeech (speech is always on for this method).