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 966d3a1 commit 11ca590
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions OpenAI/Packages/com.openai.unity/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 OpenAI/Packages/com.openai.unity/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
4 changes: 2 additions & 2 deletions OpenAI/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2022.3.16f1
m_EditorVersionWithRevision: 2022.3.16f1 (d2c21f0ef2f1)
m_EditorVersion: 2021.3.37f1
m_EditorVersionWithRevision: 2021.3.37f1 (3b6005ad5ad6)

0 comments on commit 11ca590

Please sign in to comment.