Browse Source

Matched with base

master
Tillman Staffen 4 weeks ago
parent
commit
cfd37b4998
  1. BIN
      Unreal/Content/Project/BP/Avatars/PersonalityConfigs/DA_PersonalityConfig_Ben_BREX.uasset
  2. BIN
      Unreal/Content/Project/BP/Avatars/PersonalityConfigs/DA_PersonalityConfig_Jasmin.uasset
  3. BIN
      Unreal/Content/Project/BP/BP_Project_Manager.uasset
  4. BIN
      Unreal/Content/Project/BP/Base/PC_Project.uasset
  5. BIN
      Unreal/Content/Project/Widgets/W_Main.uasset
  6. 28
      Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Private/AIBaseManager.cpp
  7. 20
      Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Private/RealtimeAPI/AvatarCoreAIRealtime.cpp
  8. 9
      Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Public/AIBaseManager.h
  9. 21
      Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Public/AvatarCoreAIEnumsAndStructs.h
  10. 13
      Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Public/RealtimeAPI/AvatarCoreAIRealtime.h
  11. BIN
      Unreal/Plugins/AvatarCore_Manager/Content/AvatarCoreManager.uasset
  12. BIN
      Unreal/Plugins/AvatarCore_Manager/Content/StateManagement/BP_StateManager.uasset
  13. BIN
      Unreal/Plugins/AvatarCore_Manager/Content/Widgets/Debug/Pages/W_DebugAvatarCoreSTT.uasset
  14. BIN
      Unreal/Plugins/AvatarCore_MetaHuman/Content/BP/MetaHuman/BaseAvatar.uasset
  15. BIN
      Unreal/Plugins/BTools/Content/ConfigPawn/AC_ConfigComponent.uasset
  16. BIN
      Unreal/Plugins/BTools/Content/ConfigPawn/ConfigPawn.uasset
  17. BIN
      Unreal/Plugins/BTools/Content/ConfigPawn/Structs/E_ConfigWidgetConfigType.uasset
  18. BIN
      Unreal/Plugins/BTools/Content/ConfigPawn/Widgets/W_DebugConfigModeWidget.uasset

BIN
Unreal/Content/Project/BP/Avatars/PersonalityConfigs/DA_PersonalityConfig_Ben_BREX.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Content/Project/BP/Avatars/PersonalityConfigs/DA_PersonalityConfig_Jasmin.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Content/Project/BP/BP_Project_Manager.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Content/Project/BP/Base/PC_Project.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Content/Project/Widgets/W_Main.uasset (Stored with Git LFS)

Binary file not shown.

28
Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Private/AIBaseManager.cpp

@ -126,9 +126,9 @@ void UAIBaseManager::OnAIReady()
UAIBaseManager::SetNewState(EAvatarCoreAIState::Ready); UAIBaseManager::SetNewState(EAvatarCoreAIState::Ready);
if (!ResponseQueue.IsEmpty()) if (!ResponseQueue.IsEmpty())
{ {
FString QueuedPrompt; FPrompt QueuedPrompt;
ResponseQueue.Dequeue(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) { if (CurrentAIState != EAvatarCoreAIState::Ready) {
ResponseQueue.Enqueue(Response); FPrompt tmpPrompt;
tmpPrompt.Prompt = Response;
tmpPrompt.Role = Role;
ResponseQueue.Enqueue(tmpPrompt);
if(CurrentAIState == EAvatarCoreAIState::Disconnected) if(CurrentAIState == EAvatarCoreAIState::Disconnected)
ActivateAI(); ActivateAI();
return; 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)); BroadcastAILog(FString::Printf(TEXT("AI Manager sent question/response: %s"), *Response));
if (NotifyDelay) if (NotifyDelay)
UAIBaseManager::StartDelayedAnswerTimer(); UAIBaseManager::StartDelayedAnswerTimer();
SendResponseChild(Response, NotifyDelay, TriggerResponse); SendResponseChild(Response, Role, NotifyDelay, TriggerResponse);
} }
void UAIBaseManager::RepeatText(FString TextToRepeat, bool DoRephrase) void UAIBaseManager::RepeatText(FString TextToRepeat, bool DoRephrase)
@ -179,7 +182,7 @@ void UAIBaseManager::RepeatText(FString TextToRepeat, bool DoRephrase)
Instruction = "[REPHRASE] " + TextToRepeat; Instruction = "[REPHRASE] " + TextToRepeat;
else else
Instruction = "[REPEAT] " + TextToRepeat; Instruction = "[REPEAT] " + TextToRepeat;
SendResponse(Instruction, false, true); SendResponse(Instruction, EAvatarCoreAIPromptRole::System, false, true);
} }
void UAIBaseManager::ClearAI() 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) void UAIBaseManager::CommandFinished(const FString& Command, const FString& Payload)
{ {
SetNewState(EAvatarCoreAIState::Ready); SetNewState(EAvatarCoreAIState::Ready);

20
Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Private/RealtimeAPI/AvatarCoreAIRealtime.cpp

@ -38,9 +38,9 @@ void UAvatarCoreAIRealtime::DeactivateAI()
UAIBaseManager::DeactivateAI(); UAIBaseManager::DeactivateAI();
} }
void UAvatarCoreAIRealtime::SendResponseChild(const FString& Response, bool NotifyDelay = false, bool TriggerResponse = true) void UAvatarCoreAIRealtime::SendResponseChild(const FString& Response, EAvatarCoreAIPromptRole Role, bool NotifyDelay = false, bool TriggerResponse = true)
{ {
UAvatarCoreAIRealtime::CreateConversationItem(Response, EOpenAIRoleType::User, TriggerResponse); UAvatarCoreAIRealtime::CreateConversationItem(Response, Role, TriggerResponse);
} }
void UAvatarCoreAIRealtime::ClearAI() void UAvatarCoreAIRealtime::ClearAI()
@ -263,7 +263,7 @@ void UAvatarCoreAIRealtime::WebSocketSendType(const FString& type)
} }
} }
void UAvatarCoreAIRealtime::CreateConversationItem(const FString& message, EOpenAIRoleType role, bool triggerResponse) void UAvatarCoreAIRealtime::CreateConversationItem(const FString& message, EAvatarCoreAIPromptRole role, bool triggerResponse)
{ {
TSharedPtr<FJsonObject> RootObject = MakeShareable(new FJsonObject); TSharedPtr<FJsonObject> RootObject = MakeShareable(new FJsonObject);
RootObject->SetStringField("type", "conversation.item.create"); RootObject->SetStringField("type", "conversation.item.create");
@ -695,17 +695,3 @@ void UAvatarCoreAIRealtime::DebugSimulateConnectionDrop()
SetNewState(EAvatarCoreAIState::Error, true); SetNewState(EAvatarCoreAIState::Error, true);
BroadcastAIError("Simulated socket error 3008", EAvatarCoreAIError::ConnectionDropped); BroadcastAIError("Simulated socket error 3008", EAvatarCoreAIError::ConnectionDropped);
} }
FString UAvatarCoreAIRealtime::GetRoleAsString(EOpenAIRoleType role)
{
switch (role) {
case EOpenAIRoleType::Assistant:
return "assistant";
case EOpenAIRoleType::System:
return "system";
case EOpenAIRoleType::User:
default:
return "user";
}
}

9
Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Public/AIBaseManager.h

@ -105,10 +105,10 @@ public:
* Send Response/Question to the AI Model. If NotifyDelay is true call the DelayedAnswer Event when time defined in AIConfig has passed. * Send Response/Question to the AI Model. If NotifyDelay is true call the DelayedAnswer Event when time defined in AIConfig has passed.
*/ */
UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI") UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI")
void SendResponse(const FString& Response, bool NotifyDelay, bool TriggerResponse); void SendResponse(const FString& Response, EAvatarCoreAIPromptRole Role, bool NotifyDelay, bool TriggerResponse);
UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI") UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI")
virtual void SendResponseChild(const FString& Response, bool NotifyDelay, bool TriggerResponse) {}; virtual void SendResponseChild(const FString& Response, EAvatarCoreAIPromptRole Role, bool NotifyDelay, bool TriggerResponse) {};
/** /**
* Make the AI Model repeat the Text. * Make the AI Model repeat the Text.
@ -207,6 +207,9 @@ public:
UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI|MCP Commands") UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI|MCP Commands")
void ClearMCPCommand(); void ClearMCPCommand();
UFUNCTION(BlueprintCallable, Category = "AvatarCoreAI|Helper")
static FString GetRoleAsString(EAvatarCoreAIPromptRole Role);
protected: protected:
/** /**
@ -283,6 +286,6 @@ protected:
private: private:
TQueue<FString, EQueueMode::Spsc> ResponseQueue; TQueue<FPrompt, EQueueMode::Spsc> ResponseQueue;
}; };

21
Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Public/AvatarCoreAIEnumsAndStructs.h

@ -18,6 +18,15 @@ enum class EAvatarCoreAIError : uint8
Unknown Unknown
}; };
UENUM(BlueprintType)
enum class EAvatarCoreAIPromptRole : uint8
{
User UMETA(DisplayName = "User"),
Assistant UMETA(DisplayName = "Assistant"),
System UMETA(DisplayName = "System"),
};
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EAvatarCoreAIState : uint8 enum class EAvatarCoreAIState : uint8
{ {
@ -79,3 +88,15 @@ struct FMCPToolInfo
OutputScheme = ""; OutputScheme = "";
} }
}; };
USTRUCT(BlueprintType)
struct FPrompt
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI")
FString Prompt;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI")
EAvatarCoreAIPromptRole Role;
};

13
Unreal/Plugins/AvatarCore_AI/Source/AvatarCore_AI/Public/RealtimeAPI/AvatarCoreAIRealtime.h

@ -13,13 +13,6 @@
#include "RealtimeAPI/RealtimeAPIConfig.h" #include "RealtimeAPI/RealtimeAPIConfig.h"
#include "AvatarCoreAIRealtime.generated.h" #include "AvatarCoreAIRealtime.generated.h"
UENUM(BlueprintType)
enum class EOpenAIRoleType : uint8 {
User UMETA(DisplayName = "User"),
Assistant UMETA(DisplayName = "Assistant"),
System UMETA(DisplayName = "System"),
};
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EOpenAIRequestType : uint8 { enum class EOpenAIRequestType : uint8 {
undefined UMETA(DisplayName = "UNDEFINED"), undefined UMETA(DisplayName = "UNDEFINED"),
@ -156,7 +149,7 @@ public:
void ActivateAI() override; void ActivateAI() override;
void DeactivateAI() override; void DeactivateAI() override;
void UpdateSession() override; void UpdateSession() override;
void SendResponseChild(const FString& Response, bool NotifyDelay, bool TriggerResponse) override; void SendResponseChild(const FString& Response, EAvatarCoreAIPromptRole Role, bool NotifyDelay, bool TriggerResponse) override;
void ClearAI() override; void ClearAI() override;
void ConnectToWebSocket(); void ConnectToWebSocket();
@ -169,7 +162,7 @@ public:
void WebSocketSendType(const FString& type); void WebSocketSendType(const FString& type);
UFUNCTION(BlueprintCallable, Category = "AvatarCore AI|RealtimeAPI") UFUNCTION(BlueprintCallable, Category = "AvatarCore AI|RealtimeAPI")
void CreateConversationItem(const FString& message, EOpenAIRoleType role, bool triggerResponse = true); void CreateConversationItem(const FString& message, EAvatarCoreAIPromptRole role, bool triggerResponse = true);
UFUNCTION(BlueprintCallable, Category = "AvatarCore AI|RealtimeAPI") UFUNCTION(BlueprintCallable, Category = "AvatarCore AI|RealtimeAPI")
void CreateReseponse(); void CreateReseponse();
@ -198,8 +191,6 @@ public:
private: private:
URealtimeAPIConfig* RealtimeConfig; URealtimeAPIConfig* RealtimeConfig;
FString GetRoleAsString(EOpenAIRoleType role);
FString CurrentRequestID; FString CurrentRequestID;
int32 CurrentRetries = 0; int32 CurrentRetries = 0;
int32 MaxRetries = 2; int32 MaxRetries = 2;

BIN
Unreal/Plugins/AvatarCore_Manager/Content/AvatarCoreManager.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/AvatarCore_Manager/Content/StateManagement/BP_StateManager.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/AvatarCore_Manager/Content/Widgets/Debug/Pages/W_DebugAvatarCoreSTT.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/AvatarCore_MetaHuman/Content/BP/MetaHuman/BaseAvatar.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/BTools/Content/ConfigPawn/AC_ConfigComponent.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/BTools/Content/ConfigPawn/ConfigPawn.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/BTools/Content/ConfigPawn/Structs/E_ConfigWidgetConfigType.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/BTools/Content/ConfigPawn/Widgets/W_DebugConfigModeWidget.uasset (Stored with Git LFS)

Binary file not shown.
Loading…
Cancel
Save