Remove dead code across plugin: unused members, constants, includes
- EL_LOG() function + JsonUtilities.h include (WebSocketProxy) - SilenceBuffer, bSpeculativeTurn (ElevenLabsComponent + proxy) - bSignedURLMode, SignedURLEndpoint (plugin settings) - bHasPendingAnalysis (LipSyncComponent) - bForceSelectionActive (InteractionComponent) - UserActivity, InternalTentativeAgent constants (Definitions) - Engine/AssetManager.h includes (EmotionPoseMap, LipSyncPoseMap) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5323da6908
commit
09ca2215a0
@ -256,7 +256,6 @@ void UPS_AI_ConvAgent_ElevenLabsComponent::StartConversation_Internal()
|
|||||||
|
|
||||||
// Pass configuration to the proxy before connecting.
|
// Pass configuration to the proxy before connecting.
|
||||||
WebSocketProxy->TurnMode = TurnMode;
|
WebSocketProxy->TurnMode = TurnMode;
|
||||||
WebSocketProxy->bSpeculativeTurn = bSpeculativeTurn;
|
|
||||||
|
|
||||||
WebSocketProxy->Connect(AgentID);
|
WebSocketProxy->Connect(AgentID);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,26 +7,10 @@
|
|||||||
#include "IWebSocket.h"
|
#include "IWebSocket.h"
|
||||||
|
|
||||||
#include "Json.h"
|
#include "Json.h"
|
||||||
#include "JsonUtilities.h"
|
|
||||||
#include "Misc/Base64.h"
|
#include "Misc/Base64.h"
|
||||||
|
|
||||||
DEFINE_LOG_CATEGORY_STATIC(LogPS_AI_ConvAgent_WS_ElevenLabs, Log, All);
|
DEFINE_LOG_CATEGORY_STATIC(LogPS_AI_ConvAgent_WS_ElevenLabs, Log, All);
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
|
||||||
// Helpers
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
|
||||||
static void EL_LOG(bool bVerbose, const TCHAR* Format, ...)
|
|
||||||
{
|
|
||||||
if (!bVerbose) return;
|
|
||||||
va_list Args;
|
|
||||||
va_start(Args, Format);
|
|
||||||
// Forward to UE_LOG at Verbose level
|
|
||||||
TCHAR Buffer[2048];
|
|
||||||
FCString::GetVarArgs(Buffer, UE_ARRAY_COUNT(Buffer), Format, Args);
|
|
||||||
va_end(Args);
|
|
||||||
UE_LOG(LogPS_AI_ConvAgent_WS_ElevenLabs, Verbose, TEXT("%s"), Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
// Connect / Disconnect
|
// Connect / Disconnect
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@ -15,14 +15,6 @@ class PS_AI_CONVAGENT_API UPS_AI_ConvAgent_Settings_ElevenLabs : public UObject
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UPS_AI_ConvAgent_Settings_ElevenLabs(const FObjectInitializer& ObjectInitializer)
|
|
||||||
: Super(ObjectInitializer)
|
|
||||||
{
|
|
||||||
API_Key = TEXT("");
|
|
||||||
AgentID = TEXT("");
|
|
||||||
bSignedURLMode = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElevenLabs API key.
|
* ElevenLabs API key.
|
||||||
* Obtain from https://elevenlabs.io – used to authenticate WebSocket connections.
|
* Obtain from https://elevenlabs.io – used to authenticate WebSocket connections.
|
||||||
@ -38,23 +30,6 @@ public:
|
|||||||
UPROPERTY(Config, EditAnywhere, Category = "PS AI ConvAgent|ElevenLabs API")
|
UPROPERTY(Config, EditAnywhere, Category = "PS AI ConvAgent|ElevenLabs API")
|
||||||
FString AgentID;
|
FString AgentID;
|
||||||
|
|
||||||
/**
|
|
||||||
* When true, the plugin fetches a signed WebSocket URL from your own backend
|
|
||||||
* before connecting, so the API key is never exposed in the client.
|
|
||||||
* Set SignedURLEndpoint to point to your server that returns the signed URL.
|
|
||||||
*/
|
|
||||||
UPROPERTY(Config, EditAnywhere, Category = "PS AI ConvAgent|ElevenLabs API|Security")
|
|
||||||
bool bSignedURLMode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Your backend endpoint that returns a signed WebSocket URL for ElevenLabs.
|
|
||||||
* Only used when bSignedURLMode = true.
|
|
||||||
* Expected response body: { "signed_url": "wss://..." }
|
|
||||||
*/
|
|
||||||
UPROPERTY(Config, EditAnywhere, Category = "PS AI ConvAgent|ElevenLabs API|Security",
|
|
||||||
meta = (EditCondition = "bSignedURLMode"))
|
|
||||||
FString SignedURLEndpoint;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override the ElevenLabs WebSocket base URL. Leave empty to use the default:
|
* Override the ElevenLabs WebSocket base URL. Leave empty to use the default:
|
||||||
* wss://api.elevenlabs.io/v1/convai/conversation
|
* wss://api.elevenlabs.io/v1/convai/conversation
|
||||||
|
|||||||
@ -36,8 +36,6 @@ namespace PS_AI_ConvAgent_MessageType_ElevenLabs
|
|||||||
{
|
{
|
||||||
// Client → Server
|
// Client → Server
|
||||||
static const FString AudioChunk = TEXT("user_audio_chunk");
|
static const FString AudioChunk = TEXT("user_audio_chunk");
|
||||||
// Client turn mode: signal user is currently active/speaking
|
|
||||||
static const FString UserActivity = TEXT("user_activity");
|
|
||||||
// Client turn mode: send a text message without audio
|
// Client turn mode: send a text message without audio
|
||||||
static const FString UserMessage = TEXT("user_message");
|
static const FString UserMessage = TEXT("user_message");
|
||||||
static const FString Interrupt = TEXT("interrupt");
|
static const FString Interrupt = TEXT("interrupt");
|
||||||
@ -55,7 +53,6 @@ namespace PS_AI_ConvAgent_MessageType_ElevenLabs
|
|||||||
static const FString InterruptionEvent = TEXT("interruption");
|
static const FString InterruptionEvent = TEXT("interruption");
|
||||||
static const FString PingEvent = TEXT("ping");
|
static const FString PingEvent = TEXT("ping");
|
||||||
static const FString ClientToolCall = TEXT("client_tool_call");
|
static const FString ClientToolCall = TEXT("client_tool_call");
|
||||||
static const FString InternalTentativeAgent = TEXT("internal_tentative_agent_response");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@ -125,11 +125,6 @@ public:
|
|||||||
meta = (ToolTip = "Auto-open the microphone when the conversation starts.\nOnly applies in Server VAD mode. In push-to-talk mode, call StartListening() manually."))
|
meta = (ToolTip = "Auto-open the microphone when the conversation starts.\nOnly applies in Server VAD mode. In push-to-talk mode, call StartListening() manually."))
|
||||||
bool bAutoStartListening = true;
|
bool bAutoStartListening = true;
|
||||||
|
|
||||||
/** Let the LLM start generating a response during silence, before the VAD is fully confident the user has finished speaking. Saves 200-500ms of latency but may be unstable in long multi-turn sessions. Disabled by default. */
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PS AI ConvAgent|ElevenLabs|Latency",
|
|
||||||
meta = (ToolTip = "Speculative turn: the LLM begins generating during silence before full turn-end confidence.\nReduces latency by 200-500ms. May be unstable in long sessions — test before enabling in production."))
|
|
||||||
bool bSpeculativeTurn = false;
|
|
||||||
|
|
||||||
/** How many milliseconds of microphone audio to accumulate before sending a chunk to ElevenLabs. Lower values reduce latency but may degrade voice detection accuracy. Higher values are more reliable but add delay. */
|
/** How many milliseconds of microphone audio to accumulate before sending a chunk to ElevenLabs. Lower values reduce latency but may degrade voice detection accuracy. Higher values are more reliable but add delay. */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PS AI ConvAgent|ElevenLabs|Latency",
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PS AI ConvAgent|ElevenLabs|Latency",
|
||||||
meta = (ClampMin = "20", ClampMax = "500",
|
meta = (ClampMin = "20", ClampMax = "500",
|
||||||
@ -545,10 +540,6 @@ private:
|
|||||||
TArray<uint8> AudioQueue;
|
TArray<uint8> AudioQueue;
|
||||||
FCriticalSection AudioQueueLock;
|
FCriticalSection AudioQueueLock;
|
||||||
|
|
||||||
// Reusable zero-filled buffer fed to USoundWaveProcedural during TTS gaps
|
|
||||||
// to keep the audio component alive (prevents stop on buffer underrun).
|
|
||||||
TArray<uint8> SilenceBuffer;
|
|
||||||
|
|
||||||
// Pre-buffer state: delay playback start to absorb TTS inter-chunk gaps.
|
// Pre-buffer state: delay playback start to absorb TTS inter-chunk gaps.
|
||||||
bool bPreBuffering = false;
|
bool bPreBuffering = false;
|
||||||
double PreBufferStartTime = 0.0;
|
double PreBufferStartTime = 0.0;
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Engine/DataAsset.h"
|
#include "Engine/DataAsset.h"
|
||||||
#include "Engine/AssetManager.h"
|
|
||||||
#include "PS_AI_ConvAgent_Definitions.h"
|
#include "PS_AI_ConvAgent_Definitions.h"
|
||||||
#include "PS_AI_ConvAgent_EmotionPoseMap.generated.h"
|
#include "PS_AI_ConvAgent_EmotionPoseMap.generated.h"
|
||||||
|
|
||||||
|
|||||||
@ -210,9 +210,6 @@ private:
|
|||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
UPS_AI_ConvAgent_MicrophoneCaptureComponent* MicComponent = nullptr;
|
UPS_AI_ConvAgent_MicrophoneCaptureComponent* MicComponent = nullptr;
|
||||||
|
|
||||||
/** True while ForceSelectAgent is active (suppresses automatic re-evaluation for one frame). */
|
|
||||||
bool bForceSelectionActive = false;
|
|
||||||
|
|
||||||
// ── Posture timers ───────────────────────────────────────────────────────
|
// ── Posture timers ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
FTimerHandle PostureAttachTimerHandle;
|
FTimerHandle PostureAttachTimerHandle;
|
||||||
|
|||||||
@ -261,9 +261,6 @@ private:
|
|||||||
// with fast attack (mouth opens quickly) and slow release (closes gradually).
|
// with fast attack (mouth opens quickly) and slow release (closes gradually).
|
||||||
float AudioEnvelopeValue = 0.0f;
|
float AudioEnvelopeValue = 0.0f;
|
||||||
|
|
||||||
// Whether we have pending analysis results to process
|
|
||||||
bool bHasPendingAnalysis = false;
|
|
||||||
|
|
||||||
// ── Text-driven lip sync ──────────────────────────────────────────────────
|
// ── Text-driven lip sync ──────────────────────────────────────────────────
|
||||||
|
|
||||||
// Accumulated partial text from streaming (agent_chat_response_part events).
|
// Accumulated partial text from streaming (agent_chat_response_part events).
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Engine/DataAsset.h"
|
#include "Engine/DataAsset.h"
|
||||||
#include "Engine/AssetManager.h"
|
|
||||||
#include "PS_AI_ConvAgent_LipSyncPoseMap.generated.h"
|
#include "PS_AI_ConvAgent_LipSyncPoseMap.generated.h"
|
||||||
|
|
||||||
class UAnimSequence;
|
class UAnimSequence;
|
||||||
|
|||||||
@ -261,7 +261,4 @@ public:
|
|||||||
// Set by UPS_AI_ConvAgent_ElevenLabsComponent before calling Connect().
|
// Set by UPS_AI_ConvAgent_ElevenLabsComponent before calling Connect().
|
||||||
// Controls turn_timeout in conversation_initiation_client_data.
|
// Controls turn_timeout in conversation_initiation_client_data.
|
||||||
EPS_AI_ConvAgent_TurnMode_ElevenLabs TurnMode = EPS_AI_ConvAgent_TurnMode_ElevenLabs::Server;
|
EPS_AI_ConvAgent_TurnMode_ElevenLabs TurnMode = EPS_AI_ConvAgent_TurnMode_ElevenLabs::Server;
|
||||||
|
|
||||||
// Speculative turn: start LLM generation during silence before full turn confidence.
|
|
||||||
bool bSpeculativeTurn = true;
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user