OpenAI: optional multi modal

pull/215/head
M66B 1 year ago
parent 08d845887c
commit f86b572eae

@ -116,17 +116,19 @@ public class OpenAI {
JSONObject jmessage = new JSONObject(); JSONObject jmessage = new JSONObject();
jmessage.put("role", message.role); jmessage.put("role", message.role);
JSONArray jcontents = new JSONArray(); if (message.content.length == 1 && CONTENT_TEXT.equals(message.content[0].type))
jmessage.put("content", message.content[0].content);
for (Content content : message.content) { else {
JSONObject jcontent = new JSONObject(); JSONArray jcontents = new JSONArray();
jcontent.put("type", content.type); for (Content content : message.content) {
jcontent.put(content.type, content.content); JSONObject jcontent = new JSONObject();
jcontents.put(jcontent); jcontent.put("type", content.type);
jcontent.put(content.type, content.content);
jcontents.put(jcontent);
}
jmessage.put("content", jcontents);
} }
jmessage.put("content", jcontents);
jmessages.put(jmessage); jmessages.put(jmessage);
} }

Loading…
Cancel
Save