Skip to content

Commit

Permalink
com.openai.unity 7.2.1 (#156)
Browse files Browse the repository at this point in the history
- fix ImageResult.CacheedPath calculation
  • Loading branch information
StephenHodgson authored Dec 23, 2023
1 parent 88e5605 commit 7c619b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public override string ToString()
return CachedPath;
}

if (!string.IsNullOrWhiteSpace(Url))
if (!string.IsNullOrWhiteSpace(B64_Json))
{
return Url;
return B64_Json;
}

if (!string.IsNullOrWhiteSpace(B64_Json))
if (!string.IsNullOrWhiteSpace(Url))
{
return B64_Json;
return Url;
}

return string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,21 @@ async Task DownloadAsync(ImageResult result)
}

result.Texture = await Rest.DownloadTextureAsync(localFilePath, debug: EnableDebug, cancellationToken: cancellationToken);

if (Rest.TryGetDownloadCacheItem(result.B64_Json, out var cachedPath))
{
result.CachedPath = cachedPath;
}
#endif
}
else
{
result.Texture = await Rest.DownloadTextureAsync(result.Url, debug: EnableDebug, cancellationToken: cancellationToken);
}

if (Rest.TryGetDownloadCacheItem(result, out var cachedPath))
{
result.CachedPath = cachedPath;
if (Rest.TryGetDownloadCacheItem(result.Url, out var cachedPath))
{
result.CachedPath = cachedPath;
}
}
}

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.2.0",
"version": "7.2.1",
"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 7c619b8

Please sign in to comment.