Skip to content

Commit

Permalink
Merge pull request #27 from Uralstech/unstable
Browse files Browse the repository at this point in the history
Null handling hotfix (UGemini v2.0.1)
  • Loading branch information
Uralstech authored Aug 31, 2024
2 parents f11545d + adf3b1c commit 8279331
Show file tree
Hide file tree
Showing 302 changed files with 310 additions and 300 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = UGemini
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.0.0
PROJECT_NUMBER = 2.0.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[TOC]

Please note that the code provided in this page is *purely* for learning purposes and is far from perfect. Remember to null-check all responses!

## Basics

### Setup
Expand Down
Binary file modified UGemini/Packages/com.uralstech.ugemini/Documentation~/refman.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class GeminiChatResponse : IAppendableData<GeminiChatResponse>
/// The parts of the <see cref="GeminiChatResponse"/> message.
/// </summary>
[JsonIgnore]
public GeminiContentPart[] Parts => Candidates.Length > 0 ? Candidates[0]?.Content?.Parts : null;
public GeminiContentPart[] Parts => Candidates?.Length > 0 ? Candidates[0]?.Content?.Parts : null;

/// <inheritdoc/>
public void Append(GeminiChatResponse data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public async void OnChat()
});
#pragma warning restore IDE0090 // Use 'new(...)'

if (response.Answer.Content != null)
_answerText.text = response.Answer.Content.Parts[0].Text;
if (response?.Answer?.Content?.Parts != null && response.Answer.Content.Parts.Length > 0)
_answerText.text = response.Answer.Content.Parts[0]?.Text;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public class UIChatMessage : MonoBehaviour

public void Setup(GeminiContent content, bool isSystemPrompt)
{
if (content.Parts == null)
{
Debug.LogError("Content does not contain any parts!");
return;
}

Texture2D image = new(1, 1);
foreach (GeminiContentPart part in content.Parts)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public async void OnChat()

OnPartialResponseReceived = streamedResponse =>
{
_chatResponse.text = Array.Find(streamedResponse.Parts, part => !string.IsNullOrEmpty(part.Text))?.Text;
if (streamedResponse.Parts != null)
_chatResponse.text = Array.Find(streamedResponse.Parts, part => !string.IsNullOrEmpty(part.Text))?.Text;
return Task.CompletedTask;
}
});
Expand Down
2 changes: 1 addition & 1 deletion UGemini/Packages/com.uralstech.ugemini/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"AI",
"Integration"
],
"version": "2.0.0",
"version": "2.0.1",
"unity": "2022.3",
"hideInEditor": false,
"documentationUrl": "/~https://github.com/Uralstech/UGemini/blob/master/UGemini/Packages/com.uralstech.ugemini/Documentation~/README.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/class_uralstech_1_1_u_gemini_1_1_gemini_manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.0</span>
<div id="projectname">UGemini<span id="projectnumber">&#160;2.0.1</span>
</div>
<div id="projectbrief">A C# wrapper for the Google Gemini API.</div>
</td>
Expand Down
Loading

0 comments on commit 8279331

Please sign in to comment.