From 75aadee5b5e30529bf609fcee96a866f35aacee6 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 --- Editor/FineTuning/FineTuningWindow.cs | 2 +- Runtime/Models/ModelsEndpoint.cs | 4 ++-- Tests/TestFixture_09_FineTuning.cs | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Editor/FineTuning/FineTuningWindow.cs b/Editor/FineTuning/FineTuningWindow.cs index 3babe3b1..3de4bb14 100644 --- a/Editor/FineTuning/FineTuningWindow.cs +++ b/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/Runtime/Models/ModelsEndpoint.cs b/Runtime/Models/ModelsEndpoint.cs index 8c5d5327..1305f96b 100644 --- a/Runtime/Models/ModelsEndpoint.cs +++ b/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/Tests/TestFixture_09_FineTuning.cs b/Tests/TestFixture_09_FineTuning.cs index 1a23f3e8..6880dc3b 100644 --- a/Tests/TestFixture_09_FineTuning.cs +++ b/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/package.json b/package.json index f6709f2b..4380b516 100644 --- a/package.json +++ b/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",