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

Commit

Permalink
Check request & response before forwarding the data #69
Browse files Browse the repository at this point in the history
  • Loading branch information
lucoiso committed Aug 13, 2023
1 parent 6b71130 commit 98ee8d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Source/HttpGPTCommonModule/Private/Tasks/HttpGPTBaseTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ void UHttpGPTBaseTask::BindRequestCallbacks()
{
FScopeTryLock Lock(&Mutex);

if (!Lock.IsLocked() || !IsValid(this) || !bIsTaskActive)
if (!Lock.IsLocked() || !IsValid(this) || !bIsTaskActive || !Request.IsValid())
{
return;
}

OnProgressUpdated(Request->GetResponse()->GetContentAsString(), BytesSent, BytesReceived);
if (const FHttpResponsePtr Response = Request->GetResponse(); Response.IsValid())
{
OnProgressUpdated(Response->GetContentAsString(), BytesSent, BytesReceived);
}
}
);
}
Expand Down
12 changes: 6 additions & 6 deletions Source/HttpGPTCommonModule/Public/Structures/HttpGPTChatTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ struct HTTPGPTCOMMONMODULE_API FHttpGPTChatResponse
UENUM(BlueprintType, Category = "HttpGPT | Chat", Meta = (DisplayName = "HttpGPT Chat Model"))
enum class EHttpGPTChatModel : uint8
{
gpt4 UMETA(DisplayName = "gpt-4"),
gpt432k UMETA(DisplayName = "gpt-4-32k"),
gpt35turbo UMETA(DisplayName = "gpt-3.5-turbo"),
gpt4 UMETA(DisplayName = "gpt-4"),
gpt432k UMETA(DisplayName = "gpt-4-32k"),
gpt35turbo UMETA(DisplayName = "gpt-3.5-turbo"),
gpt35turbo16k UMETA(DisplayName = "gpt-3.5-turbo-16k"),
textdavinci003 UMETA(DisplayName = "text-davinci-003"),
textdavinci002 UMETA(DisplayName = "text-davinci-002"),
codedavinci002 UMETA(DisplayName = "code-davinci-002"),
textdavinci003 UMETA(DisplayName = "text-davinci-003"),
textdavinci002 UMETA(DisplayName = "text-davinci-002"),
codedavinci002 UMETA(DisplayName = "code-davinci-002"),
};

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

0 comments on commit 98ee8d7

Please sign in to comment.