mirror of https://github.com/M66B/FairEmail.git
OpenAI: optional multi modal
This commit is contained in:
parent
08d845887c
commit
f86b572eae
|
@ -116,16 +116,18 @@ public class OpenAI {
|
||||||
JSONObject jmessage = new JSONObject();
|
JSONObject jmessage = new JSONObject();
|
||||||
jmessage.put("role", message.role);
|
jmessage.put("role", message.role);
|
||||||
|
|
||||||
|
if (message.content.length == 1 && CONTENT_TEXT.equals(message.content[0].type))
|
||||||
|
jmessage.put("content", message.content[0].content);
|
||||||
|
else {
|
||||||
JSONArray jcontents = new JSONArray();
|
JSONArray jcontents = new JSONArray();
|
||||||
|
|
||||||
for (Content content : message.content) {
|
for (Content content : message.content) {
|
||||||
JSONObject jcontent = new JSONObject();
|
JSONObject jcontent = new JSONObject();
|
||||||
jcontent.put("type", content.type);
|
jcontent.put("type", content.type);
|
||||||
jcontent.put(content.type, content.content);
|
jcontent.put(content.type, content.content);
|
||||||
jcontents.put(jcontent);
|
jcontents.put(jcontent);
|
||||||
}
|
}
|
||||||
|
|
||||||
jmessage.put("content", jcontents);
|
jmessage.put("content", jcontents);
|
||||||
|
}
|
||||||
|
|
||||||
jmessages.put(jmessage);
|
jmessages.put(jmessage);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue