Skip to content

Commit

Permalink
com.openai.unity 7.7.9 (#228)
Browse files Browse the repository at this point in the history
- Fixed Chat sample in 2021.3 LTS
  • Loading branch information
StephenHodgson authored May 8, 2024
1 parent a8ac177 commit d647d71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Samples~/Chat/ChatBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public class ChatBehaviour : MonoBehaviour

private readonly List<Tool> assistantTools = new();

#if !UNITY_2022_3_OR_NEWER
private readonly CancellationTokenSource lifetimeCts = new();
private CancellationToken destroyCancellationToken => lifetimeCts.Token;
#endif

private void OnValidate()
{
inputField.Validate();
Expand All @@ -82,6 +87,15 @@ private void Awake()
recordButton.onClick.AddListener(ToggleRecording);
}


#if !UNITY_2022_3_OR_NEWER
private void OnDestroy()
{
lifetimeCts.Cancel();
lifetimeCts.Dispose();
}
#endif

private void SubmitChat(string _) => SubmitChat();

private static bool isChatPending;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "OpenAI",
"description": "A OpenAI package for the Unity Game Engine to use GPT-4, GPT-3.5, GPT-3 and Dall-E though their RESTful API (currently in beta).\n\nIndependently developed, this is not an official library and I am not affiliated with OpenAI.\n\nAn OpenAI API account is required.",
"keywords": [],
"version": "7.7.8",
"version": "7.7.9",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.openai.unity#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.openai.unity/releases",
Expand Down

0 comments on commit d647d71

Please sign in to comment.