|
|
|
@ -126,9 +126,9 @@ void UAIBaseManager::OnAIReady() |
|
|
|
UAIBaseManager::SetNewState(EAvatarCoreAIState::Ready); |
|
|
|
if (!ResponseQueue.IsEmpty()) |
|
|
|
{ |
|
|
|
FString QueuedPrompt; |
|
|
|
FPrompt QueuedPrompt; |
|
|
|
ResponseQueue.Dequeue(QueuedPrompt); |
|
|
|
UAIBaseManager::SendResponse(QueuedPrompt, false, true); |
|
|
|
UAIBaseManager::SendResponse(QueuedPrompt.Prompt, QueuedPrompt.Role, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -146,10 +146,13 @@ void UAIBaseManager::SetNewState(EAvatarCoreAIState NewState, bool ForceState) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void UAIBaseManager::SendResponse(const FString& Response, bool NotifyDelay = false, bool TriggerResponse = true) |
|
|
|
void UAIBaseManager::SendResponse(const FString& Response, EAvatarCoreAIPromptRole Role = EAvatarCoreAIPromptRole::User, bool NotifyDelay = false, bool TriggerResponse = true) |
|
|
|
{ |
|
|
|
if (CurrentAIState != EAvatarCoreAIState::Ready) { |
|
|
|
ResponseQueue.Enqueue(Response); |
|
|
|
FPrompt tmpPrompt; |
|
|
|
tmpPrompt.Prompt = Response; |
|
|
|
tmpPrompt.Role = Role; |
|
|
|
ResponseQueue.Enqueue(tmpPrompt); |
|
|
|
if(CurrentAIState == EAvatarCoreAIState::Disconnected) |
|
|
|
ActivateAI(); |
|
|
|
return; |
|
|
|
@ -167,7 +170,7 @@ void UAIBaseManager::SendResponse(const FString& Response, bool NotifyDelay = fa |
|
|
|
BroadcastAILog(FString::Printf(TEXT("AI Manager sent question/response: %s"), *Response)); |
|
|
|
if (NotifyDelay) |
|
|
|
UAIBaseManager::StartDelayedAnswerTimer(); |
|
|
|
SendResponseChild(Response, NotifyDelay, TriggerResponse); |
|
|
|
SendResponseChild(Response, Role, NotifyDelay, TriggerResponse); |
|
|
|
} |
|
|
|
|
|
|
|
void UAIBaseManager::RepeatText(FString TextToRepeat, bool DoRephrase) |
|
|
|
@ -179,7 +182,7 @@ void UAIBaseManager::RepeatText(FString TextToRepeat, bool DoRephrase) |
|
|
|
Instruction = "[REPHRASE] " + TextToRepeat; |
|
|
|
else |
|
|
|
Instruction = "[REPEAT] " + TextToRepeat; |
|
|
|
SendResponse(Instruction, false, true); |
|
|
|
SendResponse(Instruction, EAvatarCoreAIPromptRole::System, false, true); |
|
|
|
} |
|
|
|
|
|
|
|
void UAIBaseManager::ClearAI() |
|
|
|
@ -341,6 +344,19 @@ void UAIBaseManager::ClearMCPCommand() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
FString UAIBaseManager::GetRoleAsString(EAvatarCoreAIPromptRole Role) |
|
|
|
{ |
|
|
|
switch (Role) { |
|
|
|
case EAvatarCoreAIPromptRole::Assistant: |
|
|
|
return "assistant"; |
|
|
|
case EAvatarCoreAIPromptRole::System: |
|
|
|
return "system"; |
|
|
|
case EAvatarCoreAIPromptRole::User: |
|
|
|
default: |
|
|
|
return "user"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void UAIBaseManager::CommandFinished(const FString& Command, const FString& Payload) |
|
|
|
{ |
|
|
|
SetNewState(EAvatarCoreAIState::Ready); |
|
|
|
|