UnrealVoxta 0.1.1
 
Loading...
Searching...
No Matches
FChatSession Struct Reference

FChatSession Data struct containing all the relevant information regarding a chat session between the user and AI characters. More...

#include <ChatSession.h>

Public Member Functions

const TArray< FChatMessage > & GetChatMessages ()
 Get the chat message history for this session.
 
FGuid GetSessionId () const
 Get the VoxtaServer assigned ID of this session.
 
const TMap< VoxtaServiceType, FVoxtaServiceEntryData > & GetActiveServices () const
 Get the services that were enabled when the chat session was started.
 
void UpdateContext (const FString &newContext)
 Update the context of the ongoing chat session.
 
void AddChatMessage (const FChatMessage &message)
 Add a new chat message to the session.
 
void RemoveChatMessage (const FGuid &messageID)
 Remove a chat message from the session by message ID.
 
FChatMessageGetChatMessageById (const FGuid &messageId)
 Fetch a raw pointer to the ChatMessage that matches the given ID.
 
 FChatSession (const TArray< const FAiCharData * > &characters, FGuid chatId, FGuid sessionId, const TMap< VoxtaServiceType, FVoxtaServiceEntryData > &services, FStringView chatContext)
 Create a new instance of the ChatSession, containing all relevant data to it.
 
 FChatSession ()=default
 Default constructor.
 
FGuid GetChatId () const
 Get the VoxtaServer assigned ID of this chat session.
 
FStringView GetChatContext () const
 Get the current context of the chat session.
 
const TArray< FGuid > & GetCharacterIds () const
 Get the list of character IDs in the chat session.
 

Detailed Description

FChatSession Data struct containing all the relevant information regarding a chat session between the user and AI characters.

Acts as the single source of truth for chat state, message history, and available services. Thread-safe for concurrent read/write access.

Constructor & Destructor Documentation

◆ FChatSession() [1/2]

FChatSession::FChatSession ( const TArray< const FAiCharData * > & characters,
FGuid chatId,
FGuid sessionId,
const TMap< VoxtaServiceType, FVoxtaServiceEntryData > & services,
FStringView chatContext )
inlineexplicit

Create a new instance of the ChatSession, containing all relevant data to it.

Parameters
charactersThe AIcharacters participating in the chat session.
chatIdThe VoxtaServer assigned id of this Chat.
sessionIdThe VoxtaServer assigned id of this Session.
servicesThe VoxtaServer services that are enabled for this chat session.

◆ FChatSession() [2/2]

FChatSession::FChatSession ( )
default

Default constructor.

Member Function Documentation

◆ AddChatMessage()

void FChatSession::AddChatMessage ( const FChatMessage & message)
inline

Add a new chat message to the session.

Parameters
messageThe chat message to add.

◆ GetActiveServices()

const TMap< VoxtaServiceType, FVoxtaServiceEntryData > & FChatSession::GetActiveServices ( ) const
inline

Get the services that were enabled when the chat session was started.

Used by VoxtaClient to know if it should notify audio playback handlers, mic input, etc.

Returns
The map of active services.

◆ GetCharacterIds()

const TArray< FGuid > & FChatSession::GetCharacterIds ( ) const
inline

Get the list of character IDs in the chat session.

Used to identify which characters are participating.

Returns
The array of character GUIDs.

◆ GetChatContext()

FStringView FChatSession::GetChatContext ( ) const
inline

Get the current context of the chat session.

Used to retrieve the current context text that influences the AI's responses.

Returns
The current chat context string.

◆ GetChatId()

FGuid FChatSession::GetChatId ( ) const
inline

Get the VoxtaServer assigned ID of this chat session.

Used as the session identifier for HTTP requests and WebSocket messages.

Returns
The ID of the chat.

◆ GetChatMessageById()

FChatMessage * FChatSession::GetChatMessageById ( const FGuid & messageId)
inline

Fetch a raw pointer to the ChatMessage that matches the given ID.

Note: The text & audio in this data is not guaranteed to be complete until the message is finalized.

Parameters
messageIdThe ID of the chat message to retrieve.
Returns
An immutable pointer to the chat message, or nullptr if not found.

◆ GetChatMessages()

const TArray< FChatMessage > & FChatSession::GetChatMessages ( )
inline

Get the chat message history for this session.

Can be used to add, remove, and update chat message entries. Acts as the source-of-truth for what has been said so far.

Returns
An immutable reference to the chat message history.

◆ GetSessionId()

FGuid FChatSession::GetSessionId ( ) const
inline

Get the VoxtaServer assigned ID of this session.

Used as required data for some VoxtaServer API calls.

Returns
The session ID.

◆ RemoveChatMessage()

void FChatSession::RemoveChatMessage ( const FGuid & messageID)
inline

Remove a chat message from the session by message ID.

Parameters
messageIDThe ID of the chat message to remove.

◆ UpdateContext()

void FChatSession::UpdateContext ( const FString & newContext)
inline

Update the context of the ongoing chat session.

Parameters
newContextThe new context for the ongoing chat session.

The documentation for this struct was generated from the following file: