Small fix

This commit is contained in:
M66B 2024-05-09 17:08:34 +02:00
parent 8cab3786e9
commit e93c0de346
1 changed files with 4 additions and 0 deletions

View File

@ -120,6 +120,10 @@ public class Gemini {
JSONArray jcandidates = jresponse.optJSONArray("candidates");
for (int i = 0; i < jcandidates.length(); i++) {
JSONObject jcandidate = jcandidates.getJSONObject(i);
if (!jcandidate.has("content"))
throw new IOException(jresponse.toString(2));
JSONObject jcontent = jcandidate.getJSONObject("content");
String role = jcontent.getString("role");