From 95d1196b50ce649e28319d9d1bfd1e80ec05a08a Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 27 Aug 2023 10:50:03 -0700 Subject: [PATCH] com.openai.unity 5.0.9 (#105) - Fixed Model delete permission Unauthorized Access check --- .../com.openai.unity/Editor/FineTuning/FineTuningWindow.cs | 2 +- .../com.openai.unity/Runtime/Models/ModelsEndpoint.cs | 4 ++-- .../com.openai.unity/Tests/TestFixture_09_FineTuning.cs | 2 +- OpenAI/Packages/com.openai.unity/package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenAI/Packages/com.openai.unity/Editor/FineTuning/FineTuningWindow.cs b/OpenAI/Packages/com.openai.unity/Editor/FineTuning/FineTuningWindow.cs index 3babe3b1..3de4bb14 100644 --- a/OpenAI/Packages/com.openai.unity/Editor/FineTuning/FineTuningWindow.cs +++ b/OpenAI/Packages/com.openai.unity/Editor/FineTuning/FineTuningWindow.cs @@ -656,7 +656,7 @@ private static void RenderOrganizationModels() } catch (UnauthorizedAccessException) { - EditorUtility.DisplayDialog("Unauthorized", "You do not have permissions to delete models for this organization.", "Ok"); + EditorUtility.DisplayDialog("Unauthorized", "You have insufficient permissions for this operation. You need to be this role: Owner.", "Ok"); } catch (Exception e) { diff --git a/OpenAI/Packages/com.openai.unity/Runtime/Models/ModelsEndpoint.cs b/OpenAI/Packages/com.openai.unity/Runtime/Models/ModelsEndpoint.cs index 8c5d5327..1305f96b 100644 --- a/OpenAI/Packages/com.openai.unity/Runtime/Models/ModelsEndpoint.cs +++ b/OpenAI/Packages/com.openai.unity/Runtime/Models/ModelsEndpoint.cs @@ -106,9 +106,9 @@ public async Task DeleteFineTuneModelAsync(string modelId, CancellationTok catch (RestException e) { if (e.Response.Code == 403 || - e.Message.Contains("api.delete")) + e.Message.Contains("You have insufficient permissions for this operation. You need to be this role: Owner.")) { - throw new UnauthorizedAccessException("You do not have permissions to delete models for this organization."); + throw new UnauthorizedAccessException("You have insufficient permissions for this operation. You need to be this role: Owner."); } throw; diff --git a/OpenAI/Packages/com.openai.unity/Tests/TestFixture_09_FineTuning.cs b/OpenAI/Packages/com.openai.unity/Tests/TestFixture_09_FineTuning.cs index 1a23f3e8..6880dc3b 100644 --- a/OpenAI/Packages/com.openai.unity/Tests/TestFixture_09_FineTuning.cs +++ b/OpenAI/Packages/com.openai.unity/Tests/TestFixture_09_FineTuning.cs @@ -209,7 +209,7 @@ public async Task Test_08_DeleteFineTunedModel() } catch (UnauthorizedAccessException) { - Console.WriteLine("Your account does not have permissions to delete models."); + Console.WriteLine("You have insufficient permissions for this operation. You need to be this role: Owner."); } } } diff --git a/OpenAI/Packages/com.openai.unity/package.json b/OpenAI/Packages/com.openai.unity/package.json index f6709f2b..4380b516 100644 --- a/OpenAI/Packages/com.openai.unity/package.json +++ b/OpenAI/Packages/com.openai.unity/package.json @@ -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": "5.0.8", + "version": "5.0.9", "unity": "2021.3", "documentationUrl": "https://github.com/RageAgainstThePixel/com.openai.unity#documentation", "changelogUrl": "https://github.com/RageAgainstThePixel/com.openai.unity/releases",