Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit dbe5b06

Browse files
authored
Merge pull request #82 from lucoiso/development
HttpGPT v1.5.6
2 parents 5e38ba6 + f3ed85c commit dbe5b06

File tree

15 files changed

+476
-75
lines changed

15 files changed

+476
-75
lines changed

HttpGPT.uplugin

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
3-
"Version": 18,
4-
"VersionName": "1.5.5",
3+
"Version": 19,
4+
"VersionName": "1.5.6",
55
"FriendlyName": "HttpGPT - GPT Integration",
66
"Description": "HttpGPT is an Unreal Engine plugin that facilitates integration with OpenAI's GPT based services (ChatGPT and DALL-E) through asynchronous REST requests, making it easy for developers to communicate with these services. HttpGPT also includes new Editor Tools to integrate Chat GPT and DALL-E image generation directly in the Engine.",
77
"Category": "Game Features",
@@ -19,7 +19,7 @@
1919
"Name": "HttpGPTChatModule",
2020
"Type": "Runtime",
2121
"LoadingPhase": "Default",
22-
"WhitelistPlatforms": [
22+
"PlatformAllowList": [
2323
"Win64",
2424
"Mac",
2525
"Linux",
@@ -32,7 +32,7 @@
3232
"Name": "HttpGPTImageModule",
3333
"Type": "Runtime",
3434
"LoadingPhase": "Default",
35-
"WhitelistPlatforms": [
35+
"PlatformAllowList": [
3636
"Win64",
3737
"Mac",
3838
"Linux",
@@ -45,7 +45,7 @@
4545
"Name": "HttpGPTCommonModule",
4646
"Type": "Runtime",
4747
"LoadingPhase": "Default",
48-
"WhitelistPlatforms": [
48+
"PlatformAllowList": [
4949
"Win64",
5050
"Mac",
5151
"Linux",
@@ -57,7 +57,7 @@
5757
{
5858
"Name": "HttpGPTEditorModule",
5959
"Type": "Editor",
60-
"WhitelistPlatforms": [
60+
"PlatformAllowList": [
6161
"Win64",
6262
"Mac",
6363
"Linux"

Source/HttpGPTChatModule/Private/Tasks/HttpGPTChatRequest.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ UHttpGPTChatRequest* UHttpGPTChatRequest::EditorTask(const TArray<FHttpGPTChatMe
3636
}
3737
#endif
3838

39-
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessage_DefaultOptions(UObject* WorldContextObject, const FString& Message)
39+
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessage_DefaultOptions(UObject* const WorldContextObject, const FString& Message)
4040
{
4141
return SendMessage_CustomOptions(WorldContextObject, Message, FHttpGPTCommonOptions(), FHttpGPTChatOptions());
4242
}
4343

44-
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessages_DefaultOptions(UObject* WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages)
44+
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessages_DefaultOptions(UObject* const WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages)
4545
{
4646
return SendMessages_CustomOptions(WorldContextObject, Messages, FHttpGPTCommonOptions(), FHttpGPTChatOptions());
4747
}
4848

49-
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessage_CustomOptions(UObject* WorldContextObject, const FString& Message, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions)
49+
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessage_CustomOptions(UObject* const WorldContextObject, const FString& Message, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions)
5050
{
5151
return SendMessages_CustomOptions(WorldContextObject, { FHttpGPTChatMessage(EHttpGPTChatRole::User, Message) }, CommonOptions, ChatOptions);
5252
}
5353

54-
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessages_CustomOptions(UObject* WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions)
54+
UHttpGPTChatRequest* UHttpGPTChatRequest::SendMessages_CustomOptions(UObject* const WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions)
5555
{
5656
UHttpGPTChatRequest* const NewAsyncTask = NewObject<UHttpGPTChatRequest>();
5757
NewAsyncTask->Messages = Messages;
@@ -388,7 +388,7 @@ void UHttpGPTChatRequest::DeserializeSingleResponse(const FString& Content)
388388
}
389389
}
390390

391-
UHttpGPTChatRequest* UHttpGPTChatHelper::CastToHttpGPTChatRequest(UObject* Object)
391+
UHttpGPTChatRequest* UHttpGPTChatHelper::CastToHttpGPTChatRequest(UObject* const Object)
392392
{
393393
return Cast<UHttpGPTChatRequest>(Object);
394394
}

Source/HttpGPTChatModule/Public/Tasks/HttpGPTChatRequest.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ class HTTPGPTCHATMODULE_API UHttpGPTChatRequest : public UHttpGPTBaseTask
3939
#endif
4040

4141
UFUNCTION(BlueprintCallable, Category = "HttpGPT | Chat | Default", meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", DisplayName = "Send Message with Default Options"))
42-
static UHttpGPTChatRequest* SendMessage_DefaultOptions(UObject* WorldContextObject, const FString& Message);
42+
static UHttpGPTChatRequest* SendMessage_DefaultOptions(UObject* const WorldContextObject, const FString& Message);
4343

4444
UFUNCTION(BlueprintCallable, Category = "HttpGPT | Chat | Default", meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", DisplayName = "Send Messages with Default Options"))
45-
static UHttpGPTChatRequest* SendMessages_DefaultOptions(UObject* WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages);
45+
static UHttpGPTChatRequest* SendMessages_DefaultOptions(UObject* const WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages);
4646

4747
UFUNCTION(BlueprintCallable, Category = "HttpGPT | Chat | Custom", meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", DisplayName = "Send Message with Custom Options"))
48-
static UHttpGPTChatRequest* SendMessage_CustomOptions(UObject* WorldContextObject, const FString& Message, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions);
48+
static UHttpGPTChatRequest* SendMessage_CustomOptions(UObject* const WorldContextObject, const FString& Message, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions);
4949

5050
UFUNCTION(BlueprintCallable, Category = "HttpGPT | Chat | Custom", meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", DisplayName = "Send Messages with Custom Options"))
51-
static UHttpGPTChatRequest* SendMessages_CustomOptions(UObject* WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions);
51+
static UHttpGPTChatRequest* SendMessages_CustomOptions(UObject* const WorldContextObject, const TArray<FHttpGPTChatMessage>& Messages, const FHttpGPTCommonOptions CommonOptions, const FHttpGPTChatOptions ChatOptions);
5252

5353
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat")
5454
const FHttpGPTChatOptions GetChatOptions() const;
@@ -81,5 +81,5 @@ class HTTPGPTCHATMODULE_API UHttpGPTChatHelper final : public UBlueprintFunction
8181

8282
public:
8383
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", Meta = (DisplayName = "Cast to HttpGPT Chat Request"))
84-
static UHttpGPTChatRequest* CastToHttpGPTChatRequest(UObject* Object);
84+
static UHttpGPTChatRequest* CastToHttpGPTChatRequest(UObject* const Object);
8585
};

Source/HttpGPTCommonModule/Private/Utils/HttpGPTHelper.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include UE_INLINE_GENERATED_CPP_BY_NAME(HttpGPTHelper)
1010
#endif
1111

12-
const FName UHttpGPTHelper::ModelToName(const EHttpGPTChatModel& Model)
12+
const FName UHttpGPTHelper::ModelToName(const EHttpGPTChatModel Model)
1313
{
1414
switch (Model)
1515
{
@@ -74,7 +74,7 @@ const EHttpGPTChatModel UHttpGPTHelper::NameToModel(const FName Model)
7474
return EHttpGPTChatModel::gpt35turbo;
7575
}
7676

77-
const FName UHttpGPTHelper::RoleToName(const EHttpGPTChatRole& Role)
77+
const FName UHttpGPTHelper::RoleToName(const EHttpGPTChatRole Role)
7878
{
7979
switch (Role)
8080
{
@@ -124,7 +124,7 @@ const TArray<FName> UHttpGPTHelper::GetAvailableGPTModels()
124124
return Output;
125125
}
126126

127-
const FName UHttpGPTHelper::GetEndpointForModel(const EHttpGPTChatModel& Model)
127+
const FName UHttpGPTHelper::GetEndpointForModel(const EHttpGPTChatModel Model)
128128
{
129129
switch (Model)
130130
{
@@ -145,7 +145,7 @@ const FName UHttpGPTHelper::GetEndpointForModel(const EHttpGPTChatModel& Model)
145145
return NAME_None;
146146
}
147147

148-
const bool UHttpGPTHelper::ModelSupportsChat(const EHttpGPTChatModel& Model)
148+
const bool UHttpGPTHelper::ModelSupportsChat(const EHttpGPTChatModel Model)
149149
{
150150
switch (Model)
151151
{
@@ -166,7 +166,7 @@ const bool UHttpGPTHelper::ModelSupportsChat(const EHttpGPTChatModel& Model)
166166
return false;
167167
}
168168

169-
const FName UHttpGPTHelper::SizeToName(const EHttpGPTImageSize& Size)
169+
const FName UHttpGPTHelper::SizeToName(const EHttpGPTImageSize Size)
170170
{
171171
switch (Size)
172172
{
@@ -204,7 +204,7 @@ const EHttpGPTImageSize UHttpGPTHelper::NameToSize(const FName Size)
204204
return EHttpGPTImageSize::x256;
205205
}
206206

207-
const FName UHttpGPTHelper::FormatToName(const EHttpGPTResponseFormat& Format)
207+
const FName UHttpGPTHelper::FormatToName(const EHttpGPTResponseFormat Format)
208208
{
209209
switch (Format)
210210
{

Source/HttpGPTCommonModule/Public/Utils/HttpGPTHelper.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class HTTPGPTCOMMONMODULE_API UHttpGPTHelper final : public UBlueprintFunctionLi
2020

2121
public:
2222
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", meta = (DisplayName = "Convert HttpGPT Model to Name"))
23-
static const FName ModelToName(const EHttpGPTChatModel& Model);
23+
static const FName ModelToName(const EHttpGPTChatModel Model);
2424

2525
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", meta = (DisplayName = "Convert Name to HttpGPT Model"))
2626
static const EHttpGPTChatModel NameToModel(const FName Model);
2727

2828
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", meta = (DisplayName = "Convert HttpGPT Role to Name"))
29-
static const FName RoleToName(const EHttpGPTChatRole& Role);
29+
static const FName RoleToName(const EHttpGPTChatRole Role);
3030

3131
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", meta = (DisplayName = "Convert Name to HttpGPT Role"))
3232
static const EHttpGPTChatRole NameToRole(const FName Role);
@@ -35,19 +35,19 @@ class HTTPGPTCOMMONMODULE_API UHttpGPTHelper final : public UBlueprintFunctionLi
3535
static const TArray<FName> GetAvailableGPTModels();
3636

3737
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", meta = (DisplayName = "Get Endpoint for Model"))
38-
static const FName GetEndpointForModel(const EHttpGPTChatModel& Model);
38+
static const FName GetEndpointForModel(const EHttpGPTChatModel Model);
3939

4040
UFUNCTION(BlueprintPure, Category = "HttpGPT | Chat", meta = (DisplayName = "Model Supports Chat"))
41-
static const bool ModelSupportsChat(const EHttpGPTChatModel& Model);
41+
static const bool ModelSupportsChat(const EHttpGPTChatModel Model);
4242

4343
UFUNCTION(BlueprintPure, Category = "HttpGPT | Image", meta = (DisplayName = "Convert HttpGPT Size to Name"))
44-
static const FName SizeToName(const EHttpGPTImageSize& Size);
44+
static const FName SizeToName(const EHttpGPTImageSize Size);
4545

4646
UFUNCTION(BlueprintPure, Category = "HttpGPT | Image", meta = (DisplayName = "Convert Name to HttpGPT Size"))
4747
static const EHttpGPTImageSize NameToSize(const FName Size);
4848

4949
UFUNCTION(BlueprintPure, Category = "HttpGPT | Image", meta = (DisplayName = "Convert HttpGPT Format to Name"))
50-
static const FName FormatToName(const EHttpGPTResponseFormat& Format);
50+
static const FName FormatToName(const EHttpGPTResponseFormat Format);
5151

5252
UFUNCTION(BlueprintPure, Category = "HttpGPT | Image", meta = (DisplayName = "Convert Name to HttpGPT Format"))
5353
static const EHttpGPTResponseFormat NameToFormat(const FName Format);

Source/HttpGPTEditorModule/Private/Chat/SHttpGPTChatItem.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,35 @@ void SHttpGPTChatItem::Construct(const FArguments& InArgs)
4242
];
4343
}
4444

45+
static FSlateColor& operator*=(FSlateColor& Lhs, const float Rhs)
46+
{
47+
FLinearColor NewColor = Lhs.GetSpecifiedColor() * Rhs;
48+
NewColor.A = 1.f;
49+
Lhs = FSlateColor(NewColor);
50+
51+
return Lhs;
52+
}
53+
4554
TSharedRef<SWidget> SHttpGPTChatItem::ConstructContent()
4655
{
4756
constexpr float SlotPadding = 4.0f;
48-
constexpr float PaddingMultiplier = 16.0f;
57+
constexpr float PaddingMultiplier = 32.0f;
4958

50-
FText RoleText = FText::FromString(TEXT("Undefined:"));
51-
FMargin BoxMargin(SlotPadding);
59+
FText RoleText = FText::FromString(TEXT("User:"));
60+
FMargin BoxMargin(SlotPadding * PaddingMultiplier, SlotPadding, SlotPadding, SlotPadding);
61+
FSlateColor MessageColor(FLinearColor::White);
5262

53-
if (MessageRole == EHttpGPTChatRole::User)
54-
{
55-
RoleText = FText::FromString(TEXT("User:"));
56-
BoxMargin = FMargin(SlotPadding * PaddingMultiplier, SlotPadding, SlotPadding, SlotPadding);
57-
}
58-
else if (MessageRole == EHttpGPTChatRole::Assistant)
63+
if (MessageRole == EHttpGPTChatRole::Assistant)
5964
{
6065
RoleText = FText::FromString(TEXT("Assistant:"));
6166
BoxMargin = FMargin(SlotPadding, SlotPadding, SlotPadding * PaddingMultiplier, SlotPadding);
67+
MessageColor *= 0.3f;
6268
}
6369
else if (MessageRole == EHttpGPTChatRole::System)
6470
{
6571
RoleText = FText::FromString(TEXT("System:"));
66-
BoxMargin = FMargin(SlotPadding * (PaddingMultiplier * 0.5f), SlotPadding);
72+
BoxMargin = FMargin(SlotPadding * PaddingMultiplier * 0.5f, SlotPadding);
73+
MessageColor *= 0.f;
6774
}
6875

6976
const FMargin MessageMargin(SlotPadding * 4.f, SlotPadding, SlotPadding, SlotPadding);
@@ -77,6 +84,7 @@ TSharedRef<SWidget> SHttpGPTChatItem::ConstructContent()
7784
[
7885
SNew(SBorder)
7986
.BorderImage(FAppStyle::Get().GetBrush("Menu.Background"))
87+
.BorderBackgroundColor(MessageColor)
8088
[
8189
SNew(SVerticalBox)
8290
+ SVerticalBox::Slot()

Source/HttpGPTEditorModule/Private/Chat/SHttpGPTChatItem.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
#include <CoreMinimal.h>
88
#include <Widgets/SCompoundWidget.h>
9-
#include "Structures/HttpGPTChatTypes.h"
9+
#include <Structures/HttpGPTChatTypes.h>
10+
11+
static const FName NewSessionName = TEXT("New Session");
1012

1113
class SHttpGPTChatItem final : public SCompoundWidget
1214
{

0 commit comments

Comments
 (0)