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

Commit 98ee8d7

Browse files
committed
Check request & response before forwarding the data #69
1 parent 6b71130 commit 98ee8d7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Source/HttpGPTCommonModule/Private/Tasks/HttpGPTBaseTask.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,15 @@ void UHttpGPTBaseTask::BindRequestCallbacks()
189189
{
190190
FScopeTryLock Lock(&Mutex);
191191

192-
if (!Lock.IsLocked() || !IsValid(this) || !bIsTaskActive)
192+
if (!Lock.IsLocked() || !IsValid(this) || !bIsTaskActive || !Request.IsValid())
193193
{
194194
return;
195195
}
196196

197-
OnProgressUpdated(Request->GetResponse()->GetContentAsString(), BytesSent, BytesReceived);
197+
if (const FHttpResponsePtr Response = Request->GetResponse(); Response.IsValid())
198+
{
199+
OnProgressUpdated(Response->GetContentAsString(), BytesSent, BytesReceived);
200+
}
198201
}
199202
);
200203
}

Source/HttpGPTCommonModule/Public/Structures/HttpGPTChatTypes.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ struct HTTPGPTCOMMONMODULE_API FHttpGPTChatResponse
104104
UENUM(BlueprintType, Category = "HttpGPT | Chat", Meta = (DisplayName = "HttpGPT Chat Model"))
105105
enum class EHttpGPTChatModel : uint8
106106
{
107-
gpt4 UMETA(DisplayName = "gpt-4"),
108-
gpt432k UMETA(DisplayName = "gpt-4-32k"),
109-
gpt35turbo UMETA(DisplayName = "gpt-3.5-turbo"),
107+
gpt4 UMETA(DisplayName = "gpt-4"),
108+
gpt432k UMETA(DisplayName = "gpt-4-32k"),
109+
gpt35turbo UMETA(DisplayName = "gpt-3.5-turbo"),
110110
gpt35turbo16k UMETA(DisplayName = "gpt-3.5-turbo-16k"),
111-
textdavinci003 UMETA(DisplayName = "text-davinci-003"),
112-
textdavinci002 UMETA(DisplayName = "text-davinci-002"),
113-
codedavinci002 UMETA(DisplayName = "code-davinci-002"),
111+
textdavinci003 UMETA(DisplayName = "text-davinci-003"),
112+
textdavinci002 UMETA(DisplayName = "text-davinci-002"),
113+
codedavinci002 UMETA(DisplayName = "code-davinci-002"),
114114
};
115115

116116
USTRUCT(BlueprintType, Category = "HttpGPT | Chat", Meta = (DisplayName = "HttpGPT Chat Options"))

0 commit comments

Comments
 (0)