Files
UE5-cyberHuman/Plugins/OpenAi/Source/OpenAI/Public/BlueprintAsyncActions/Images/ImageAction.h
2025-04-07 18:31:41 -07:00

45 lines
1.3 KiB
C++

// OpenAI, Copyright LifeEXE. All Rights Reserved.
#pragma once
#include "Kismet/BlueprintAsyncActionBase.h"
#include "Provider/ResponseTypes.h"
#include "Provider/RequestTypes.h"
#include "ImageAction.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnImage, const FImageResponse&, Response, const FOpenAIError&, RawError);
class UOpenAIProvider;
UCLASS()
class UImageAction : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintAssignable)
FOnImage OnCompleted;
virtual void Activate() override;
private:
/**
* @param URLOverride Allows for the specification of a custom endpoint. This is beneficial when using a proxy.
* If this functionality is not required, this parameter can be left blank.
*/
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "OpenAI | Images")
static UImageAction* CreateImage(const FOpenAIImage& Image, const FOpenAIAuth& Auth, const FString& URLOverride);
void TryToOverrideURL();
void OnCreateImageCompleted(const FImageResponse& Response);
void OnRequestError(const FString& URL, const FString& Content);
private:
UPROPERTY()
TObjectPtr<UOpenAIProvider> Provider;
FOpenAIImage Image;
FOpenAIAuth Auth;
FString URLOverride{};
};