/**
 * Copyright 2022-2025 Theai, Inc. dba Inworld AI
 */

#include "Graph/Nodes/InworldNode_DialogResponseProcessor.h"

#include "InworldCharacterTypes.h"

THIRD_PARTY_INCLUDES_START
#include "InworldRuntimeLibrary/inworld.h"
THIRD_PARTY_INCLUDES_END

UInworldNode_DialogResponseProcessor::UInworldNode_DialogResponseProcessor()
{
	NodeName = "Dialog Response Processor";
}

inworld::vector_string UInworldNode_DialogResponseProcessor::GetSubstringsToRemove(
	const UInworldProcessContext* ProcessContext) const
{
	inworld::vector_string substrings = Super::GetSubstringsToRemove(ProcessContext);

	if (bRemoveCharacterName)
	{
		if (FInworldCharacterProfile CharacterProfile;
			ProcessContext->GetRuntimeStruct(CharacterProfileRuntimeDataKey, CharacterProfile))
		{
			const FString CharacterNameStringToRemove = FString::Printf(TEXT("%s:"), *CharacterProfile.Name);
			substrings.push_back(TCHAR_TO_UTF8(*CharacterNameStringToRemove));
		}
	}
	return substrings;
}
