Unreal OpenAI API 1.0.0
ChatMessageWidget.h
1// OpenAI, Copyright LifeEXE. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "EditorUtilityWidget.h"
7#include "Provider/Types/Chat/ChatCompletionChunkTypes.h"
8#include "Provider/Types/ModelTypes.h"
9#include "ChatMessageWidget.generated.h"
10
11class UBorder;
12class UMultiLineEditableText;
13class UTextBlock;
14class UWidgetSwitcher;
15class UHorizontalBox;
17
18UCLASS()
19class OPENAIEDITOR_API UChatMessageWidget : public UEditorUtilityWidget
20{
21 GENERATED_BODY()
22
23protected:
24 UPROPERTY(meta = (BindWidget))
25 TObjectPtr<UBorder> MainBorder;
26
27 UPROPERTY(meta = (BindWidget))
28 TObjectPtr<UTextBlock> RoleTextBox;
29
30 UPROPERTY(meta = (BindWidget))
31 TObjectPtr<UMultiLineEditableText> MessageText;
32
33 UPROPERTY(meta = (BindWidget))
34 TObjectPtr<UTextBlock> TimeTextBox;
35
36 UPROPERTY(meta = (BindWidget))
37 TObjectPtr<UWidgetSwitcher> WidgetSwitcher; // preloader -> text;
38
39 UPROPERTY(meta = (BindWidget))
40 TObjectPtr<UHorizontalBox> ImageHorizontalBox;
41
42 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "UI")
43 TMap<ERole, FLinearColor> ColorMap{
44 {ERole::Assistant, FColor::FromHex("444654FF")},
45 {ERole::User, FColor::FromHex("343541FF")},
46 {ERole::System, FColor::FromHex("595a68FF")},
47 };
48
49 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "UI")
50 FLinearColor DefaultColor{FColor::FromHex("0e0e0eFF")};
51
52 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "UI")
53 FLinearColor ErrorColor{FColor::FromHex("41343dFF")};
54
55 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI")
56 TSubclassOf<UImagePreviewWidget> ImagePreviewWidgetClass;
57
58public:
59 void SetMessage(const FMessage& Message, bool WasError = false);
60
61private:
62 TArray<TObjectPtr<UImagePreviewWidget>> ImageWidgets;
63};
Definition: ChatMessageWidget.h:20
Definition: ImagePreviewWidget.h:14
Definition: ChatCommonTypes.h:75