UVoxtaClient Main public-facing subsystem for Voxta integration. More...
#include <VoxtaClient.h>
Public Member Functions | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientStateChanged, VoxtaClientState, newState) | |
Delegate fired when the VoxtaClient state changes. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientCharacterRegistered, const FAiCharData &, charData) | |
Delegate fired when a character is registered. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (FVoxtaClientCharMessageAdded, const FBaseCharData &, sender, const FChatMessage &, message) | |
Delegate fired when a chat message is added. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientCharMessageRemoved, const FChatMessage &, message) | |
Delegate fired when a chat message is removed. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientSpeechTranscribed, const FString &, message) | |
Delegate fired when speech is transcribed. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientChatSessionStarted, const FChatSession &, chatSession) | |
Delegate fired when a chat session starts. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientChatSessionStopped, const FChatSession &, chatSession) | |
Delegate fired when a chat session stops. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams (FVoxtaClientAudioPlaybackRegistered, const UVoxtaAudioPlayback *, playbackHandler, const FGuid &, characterId) | |
Delegate fired when an audio playback handler is registered. | |
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FVoxtaClientChatContextUpdated, const FString &, newContext) | |
Delegate fired when the context of a chatsession is updated. | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientStateChangedNative, VoxtaClientState) | |
Native C++ delegates for the above events. | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientCharacterRegisteredNative, const FAiCharData &) | |
DECLARE_MULTICAST_DELEGATE_TwoParams (FVoxtaClientCharMessageAddedNative, const FBaseCharData &, const FChatMessage &) | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientCharMessageRemovedNative, const FChatMessage &) | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientSpeechTranscribedNative, const FString &) | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientChatSessionStartedNative, const FChatSession &) | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientChatSessionStoppedNative, const FChatSession &) | |
DECLARE_MULTICAST_DELEGATE_TwoParams (FVoxtaClientAudioPlaybackRegisteredNative, const UVoxtaAudioPlayback *, const FGuid &) | |
DECLARE_MULTICAST_DELEGATE_OneParam (FVoxtaClientChatContextUpdatedNative, const FString &) | |
virtual void | Initialize (FSubsystemCollectionBase &collection) override |
Initialization of the instance of the system. | |
virtual void | Deinitialize () override |
Deinitialization of the instance of the system. | |
void | StartConnection (const FString &ipv4Address, int port) |
Start the VoxtaClient and connect to the Voxta SignalR hub. | |
void | Disconnect (bool silent=false) |
Disconnect from the VoxtaServer and clean up all resources. | |
void | StartChatWithCharacter (const FGuid &charId, const FString &context=TEXT("")) |
Tell the server to initiate a chat session with the character of the provided ID. | |
void | SetGlobalAudioFallbackEnabled (bool newState) |
Enable or disable the global audio fallback handler (for characters without a specific handler). | |
bool | IsGlobalAudioFallbackActive () const |
void | StopActiveChat () |
Tell the server to stop the ongoing chat session and clean up the relevant dependencies. | |
void | UpdateChatContext (const FString &newContext) |
Update the context of the current chat session. | |
void | SendUserInput (const FString &inputText, bool generateReply=true, bool characterActionInference=false) |
Send user input text to the server as part of the current chat session. | |
const FString & | GetServerAddress () const |
int | GetServerPort () const |
UVoxtaAudioInput * | GetVoiceInputHandler () const |
VoxtaClientState | GetCurrentState () const |
FGuid | GetUserId () const |
FString | GetBrowserUrlForCharacter (const FGuid &aiCharacterId) const |
Get the browser URL for a given AI character. | |
FGuid | GetMainAssistantId () const |
void | TryFetchAndCacheCharacterThumbnail (const FGuid &baseCharacterId, FDownloadedTextureDelegateNative onThumbnailFetched) |
Asynchronously fetch and cache the thumbnail for a character. | |
const UVoxtaAudioPlayback * | GetRegisteredAudioPlaybackHandlerForID (const FGuid &characterId) const |
Try to retrieve a pointer to the UVoxtaAudioPlayback that has claimed playback for the provided characterId. | |
FAiCharData | GetAiCharacterDataCopyById (const FGuid &characterId) const |
Try to retrieve a copy of the characterData for the provided characterId. | |
TArray< FAiCharData > | GetAvailableAiCharactersCopy () const |
bool | TryRegisterPlaybackHandler (const FGuid &characterId, TWeakObjectPtr< UVoxtaAudioPlayback > playbackHandler) |
Register the playback handler for this specific character, this is needed as we need to know if we want to wait for the audio playback to be completed, or if there's no audio playback and we can just skip it. | |
bool | TryUnregisterPlaybackHandler (const FGuid &characterId) |
Unregister the audio playback handler for a character. | |
FChatSession | GetChatSessionCopy () const |
FVoxtaVersionData | GetServerVersionCopy () const |
bool | IsMatchingAPIVersion () const |
const FChatSession * | GetChatSession () const |
TWeakPtr< Audio2FaceRESTHandler > | GetA2FHandler () const |
void | SetCensoredLogs (bool isCensorActive) |
Enable or disable log censoring for sensitive logs. | |
bool | IsLogCensorActive () const |
Public Attributes | |
FVoxtaClientStateChanged | VoxtaClientStateChangedEvent |
Event fired when the internal VoxtaClient has finished transitioning to a different state. | |
FVoxtaClientStateChangedNative | VoxtaClientStateChangedEventNative |
Static Event variation of VoxtaClientStateChangedEvent. | |
FVoxtaClientCharacterRegistered | VoxtaClientCharacterRegisteredEvent |
Event fired when the internal VoxtaClient has loaded the metadata of an AiCharData. | |
FVoxtaClientCharacterRegisteredNative | VoxtaClientCharacterRegisteredEventNative |
Static Event variation of VoxtaClientCharacterRegisteredEvent. | |
FVoxtaClientCharMessageAdded | VoxtaClientCharMessageAddedEvent |
Event fired when the VoxtaClient is notified by the server that a message is added. | |
FVoxtaClientCharMessageAddedNative | VoxtaClientCharMessageAddedEventNative |
Static Event variation of VoxtaClientCharMessageAddedEvent. | |
FVoxtaClientCharMessageRemoved | VoxtaClientCharMessageRemovedEvent |
Event fired when the server has notified the client that a message has been removed. | |
FVoxtaClientCharMessageRemovedNative | VoxtaClientCharMessageRemovedEventNative |
Static Event variation of VoxtaClientCharMessageRemovedEvent. | |
FVoxtaClientSpeechTranscribed | VoxtaClientSpeechTranscribedPartialEvent |
Event fired when the server is in progress of transcribing speech, it contains the current version of the transcription. | |
FVoxtaClientSpeechTranscribedNative | VoxtaClientSpeechTranscribedPartialEventNative |
Static Event variation of VoxtaClientSpeechTranscribedPartialEvent. | |
FVoxtaClientSpeechTranscribed | VoxtaClientSpeechTranscribedCompleteEvent |
Event fired when the server has finished transcribing speech, it contains the final version of whatever the user said. | |
FVoxtaClientSpeechTranscribedNative | VoxtaClientSpeechTranscribedCompleteEventNative |
Static Event variation of VoxtaClientSpeechTranscribedCompleteEvent. | |
FVoxtaClientChatContextUpdated | VoxtaClientChatContextUpdatedEvent |
Event fired when the server has finished transcribing speech, it contains the final version of whatever the user said. | |
FVoxtaClientChatContextUpdatedNative | VoxtaClientChatContextUpdatedEventNative |
Static Event variation of VoxtaClientSpeechTranscribedCompleteEvent. | |
FVoxtaClientChatSessionStarted | VoxtaClientChatSessionStartedEvent |
Event fired when the chat session has begun. | |
FVoxtaClientChatSessionStartedNative | VoxtaClientChatSessionStartedEventNative |
Static Event variation of VoxtaClientChatSessionStartedEvent. | |
FVoxtaClientChatSessionStopped | VoxtaClientChatSessionStoppedEvent |
Event fired when the chat session has ended. | |
FVoxtaClientChatSessionStoppedNative | VoxtaClientChatSessionStoppedEventNative |
Static Event variation of VoxtaClientChatSessionStoppedEvent. | |
FVoxtaClientAudioPlaybackRegistered | VoxtaClientAudioPlaybackRegisteredEvent |
Event fired when a playbackHandler has registered itself & claimed audioplayback for that character. | |
FVoxtaClientAudioPlaybackRegisteredNative | VoxtaClientAudioPlaybackRegisteredEventNative |
Static Event variation of VoxtaClientAudioPlaybackRegisteredEvent. | |
UVoxtaClient Main public-facing subsystem for Voxta integration.
Manages the stateful connection to the VoxtaServer, handles chat session lifecycle, audio input/output, character and message management, and event broadcasting. Provides a singleton-like API for Blueprints and C++ to interact with Voxta features.
Use GetWorld()->GetGameInstance()->GetSubsystem<UVoxtaClient>() to access the instance.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientCharacterRegistered | , |
const FAiCharData & | , | ||
charData | ) |
Delegate fired when a character is registered.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientCharMessageRemoved | , |
const FChatMessage & | , | ||
message | ) |
Delegate fired when a chat message is removed.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientChatContextUpdated | , |
const FString & | , | ||
newContext | ) |
Delegate fired when the context of a chatsession is updated.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientChatSessionStarted | , |
const FChatSession & | , | ||
chatSession | ) |
Delegate fired when a chat session starts.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientChatSessionStopped | , |
const FChatSession & | , | ||
chatSession | ) |
Delegate fired when a chat session stops.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientSpeechTranscribed | , |
const FString & | , | ||
message | ) |
Delegate fired when speech is transcribed.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientStateChanged | , |
VoxtaClientState | , | ||
newState | ) |
Delegate fired when the VoxtaClient state changes.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams | ( | FVoxtaClientAudioPlaybackRegistered | , |
const UVoxtaAudioPlayback * | , | ||
playbackHandler | , | ||
const FGuid & | , | ||
characterId | ) |
Delegate fired when an audio playback handler is registered.
UVoxtaClient::DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams | ( | FVoxtaClientCharMessageAdded | , |
const FBaseCharData & | , | ||
sender | , | ||
const FChatMessage & | , | ||
message | ) |
Delegate fired when a chat message is added.
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientCharacterRegisteredNative | , |
const FAiCharData & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientCharMessageRemovedNative | , |
const FChatMessage & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientChatContextUpdatedNative | , |
const FString & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientChatSessionStartedNative | , |
const FChatSession & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientChatSessionStoppedNative | , |
const FChatSession & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientSpeechTranscribedNative | , |
const FString & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_OneParam | ( | FVoxtaClientStateChangedNative | , |
VoxtaClientState | ) |
Native C++ delegates for the above events.
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_TwoParams | ( | FVoxtaClientAudioPlaybackRegisteredNative | , |
const UVoxtaAudioPlayback * | , | ||
const FGuid & | ) |
UVoxtaClient::DECLARE_MULTICAST_DELEGATE_TwoParams | ( | FVoxtaClientCharMessageAddedNative | , |
const FBaseCharData & | , | ||
const FChatMessage & | ) |
|
overridevirtual |
Deinitialization of the instance of the system.
Called when the subsystem is destroyed.
void UVoxtaClient::Disconnect | ( | bool | silent = false | ) |
Disconnect from the VoxtaServer and clean up all resources.
Only call if you intend to stop using Voxta for the rest of the session.
silent | If true, do not broadcast a notification for the state-change . |
TWeakPtr< Audio2FaceRESTHandler > UVoxtaClient::GetA2FHandler | ( | ) | const |
FAiCharData UVoxtaClient::GetAiCharacterDataCopyById | ( | const FGuid & | characterId | ) | const |
Try to retrieve a copy of the characterData for the provided characterId.
characterId | The character of which you want to retrieve a character-data. |
TArray< FAiCharData > UVoxtaClient::GetAvailableAiCharactersCopy | ( | ) | const |
FString UVoxtaClient::GetBrowserUrlForCharacter | ( | const FGuid & | aiCharacterId | ) | const |
Get the browser URL for a given AI character.
aiCharacterId | The character's unique ID. |
const FChatSession * UVoxtaClient::GetChatSession | ( | ) | const |
FChatSession UVoxtaClient::GetChatSessionCopy | ( | ) | const |
VoxtaClientState UVoxtaClient::GetCurrentState | ( | ) | const |
FGuid UVoxtaClient::GetMainAssistantId | ( | ) | const |
const UVoxtaAudioPlayback * UVoxtaClient::GetRegisteredAudioPlaybackHandlerForID | ( | const FGuid & | characterId | ) | const |
Try to retrieve a pointer to the UVoxtaAudioPlayback that has claimed playback for the provided characterId.
characterID | The character for which you want to retrieve a pointer to the AudioPlayback to. |
const FString & UVoxtaClient::GetServerAddress | ( | ) | const |
int UVoxtaClient::GetServerPort | ( | ) | const |
FVoxtaVersionData UVoxtaClient::GetServerVersionCopy | ( | ) | const |
FGuid UVoxtaClient::GetUserId | ( | ) | const |
UVoxtaAudioInput * UVoxtaClient::GetVoiceInputHandler | ( | ) | const |
|
overridevirtual |
Initialization of the instance of the system.
Called when the subsystem is created.
bool UVoxtaClient::IsGlobalAudioFallbackActive | ( | ) | const |
bool UVoxtaClient::IsLogCensorActive | ( | ) | const |
bool UVoxtaClient::IsMatchingAPIVersion | ( | ) | const |
void UVoxtaClient::SendUserInput | ( | const FString & | inputText, |
bool | generateReply = true, | ||
bool | characterActionInference = false ) |
Send user input text to the server as part of the current chat session.
Triggers an AI reply if generateReply is true.
inputText | The user's input text. |
generateReply | Whether to trigger an AI reply. |
characterActionInference | Whether to enable character action inference. |
void UVoxtaClient::SetCensoredLogs | ( | bool | isCensorActive | ) |
Enable or disable log censoring for sensitive logs.
isCensorActive | True to enable censoring, false to disable. |
void UVoxtaClient::SetGlobalAudioFallbackEnabled | ( | bool | newState | ) |
Enable or disable the global audio fallback handler (for characters without a specific handler).
newState | True to enable, false to disable. |
void UVoxtaClient::StartChatWithCharacter | ( | const FGuid & | charId, |
const FString & | context = TEXT("") ) |
Tell the server to initiate a chat session with the character of the provided ID.
Note: The id must match the id of an already registered character in the client.
charId | The character's unique ID. |
context | Optional context string for the chat. |
void UVoxtaClient::StartConnection | ( | const FString & | ipv4Address, |
int | port ) |
Start the VoxtaClient and connect to the Voxta SignalR hub.
Only supports cold-start; restart is not supported.
ipv4Address | The IPv4 address or hostname of the VoxtaServer. |
port | The HTTP port of the VoxtaServer. |
void UVoxtaClient::StopActiveChat | ( | ) |
Tell the server to stop the ongoing chat session and clean up the relevant dependencies.
void UVoxtaClient::TryFetchAndCacheCharacterThumbnail | ( | const FGuid & | baseCharacterId, |
FDownloadedTextureDelegateNative | onThumbnailFetched ) |
Asynchronously fetch and cache the thumbnail for a character.
baseCharacterId | The character's unique ID. |
onThumbnailFetched | Delegate to call when the thumbnail is fetched. |
bool UVoxtaClient::TryRegisterPlaybackHandler | ( | const FGuid & | characterId, |
TWeakObjectPtr< UVoxtaAudioPlayback > | playbackHandler ) |
Register the playback handler for this specific character, this is needed as we need to know if we want to wait for the audio playback to be completed, or if there's no audio playback and we can just skip it.
characterId | The VoxtaServer assigned id of the character that is being registered for. |
playbackHandler | The audioPlayback component for the specified characterId. |
bool UVoxtaClient::TryUnregisterPlaybackHandler | ( | const FGuid & | characterId | ) |
Unregister the audio playback handler for a character.
characterId | The character for which we will remove the weakPointer to whatever audioplayback was registered for it. |
void UVoxtaClient::UpdateChatContext | ( | const FString & | newContext | ) |
Update the context of the current chat session.
newContext | The new context string to send to the server. |
FVoxtaClientAudioPlaybackRegistered UVoxtaClient::VoxtaClientAudioPlaybackRegisteredEvent |
Event fired when a playbackHandler has registered itself & claimed audioplayback for that character.
FVoxtaClientAudioPlaybackRegisteredNative UVoxtaClient::VoxtaClientAudioPlaybackRegisteredEventNative |
Static Event variation of VoxtaClientAudioPlaybackRegisteredEvent.
FVoxtaClientCharacterRegistered UVoxtaClient::VoxtaClientCharacterRegisteredEvent |
Event fired when the internal VoxtaClient has loaded the metadata of an AiCharData.
FVoxtaClientCharacterRegisteredNative UVoxtaClient::VoxtaClientCharacterRegisteredEventNative |
Static Event variation of VoxtaClientCharacterRegisteredEvent.
FVoxtaClientCharMessageAdded UVoxtaClient::VoxtaClientCharMessageAddedEvent |
Event fired when the VoxtaClient is notified by the server that a message is added.
Note: This is triggered for both AI and user messages!
FVoxtaClientCharMessageAddedNative UVoxtaClient::VoxtaClientCharMessageAddedEventNative |
Static Event variation of VoxtaClientCharMessageAddedEvent.
FVoxtaClientCharMessageRemoved UVoxtaClient::VoxtaClientCharMessageRemovedEvent |
Event fired when the server has notified the client that a message has been removed.
FVoxtaClientCharMessageRemovedNative UVoxtaClient::VoxtaClientCharMessageRemovedEventNative |
Static Event variation of VoxtaClientCharMessageRemovedEvent.
FVoxtaClientChatContextUpdated UVoxtaClient::VoxtaClientChatContextUpdatedEvent |
Event fired when the server has finished transcribing speech, it contains the final version of whatever the user said.
FVoxtaClientChatContextUpdatedNative UVoxtaClient::VoxtaClientChatContextUpdatedEventNative |
Static Event variation of VoxtaClientSpeechTranscribedCompleteEvent.
FVoxtaClientChatSessionStarted UVoxtaClient::VoxtaClientChatSessionStartedEvent |
Event fired when the chat session has begun.
Note: This is triggered right after the configuration is set, and before the first initial AI message is received.
FVoxtaClientChatSessionStartedNative UVoxtaClient::VoxtaClientChatSessionStartedEventNative |
Static Event variation of VoxtaClientChatSessionStartedEvent.
FVoxtaClientChatSessionStopped UVoxtaClient::VoxtaClientChatSessionStoppedEvent |
Event fired when the chat session has ended.
Note: The chat object provided in the parameters will be destroyed immediatly after this call.
FVoxtaClientChatSessionStoppedNative UVoxtaClient::VoxtaClientChatSessionStoppedEventNative |
Static Event variation of VoxtaClientChatSessionStoppedEvent.
FVoxtaClientSpeechTranscribed UVoxtaClient::VoxtaClientSpeechTranscribedCompleteEvent |
Event fired when the server has finished transcribing speech, it contains the final version of whatever the user said.
FVoxtaClientSpeechTranscribedNative UVoxtaClient::VoxtaClientSpeechTranscribedCompleteEventNative |
Static Event variation of VoxtaClientSpeechTranscribedCompleteEvent.
FVoxtaClientSpeechTranscribed UVoxtaClient::VoxtaClientSpeechTranscribedPartialEvent |
Event fired when the server is in progress of transcribing speech, it contains the current version of the transcription.
FVoxtaClientSpeechTranscribedNative UVoxtaClient::VoxtaClientSpeechTranscribedPartialEventNative |
Static Event variation of VoxtaClientSpeechTranscribedPartialEvent.
FVoxtaClientStateChanged UVoxtaClient::VoxtaClientStateChangedEvent |
Event fired when the internal VoxtaClient has finished transitioning to a different state.
FVoxtaClientStateChangedNative UVoxtaClient::VoxtaClientStateChangedEventNative |
Static Event variation of VoxtaClientStateChangedEvent.