mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-28 16:55:56 +00:00
OpenAI: optional multi modal
This commit is contained in:
parent
08d845887c
commit
f86b572eae
1 changed files with 11 additions and 9 deletions
|
@ -116,17 +116,19 @@ public class OpenAI {
|
|||
JSONObject jmessage = new JSONObject();
|
||||
jmessage.put("role", message.role);
|
||||
|
||||
JSONArray jcontents = new JSONArray();
|
||||
|
||||
for (Content content : message.content) {
|
||||
JSONObject jcontent = new JSONObject();
|
||||
jcontent.put("type", content.type);
|
||||
jcontent.put(content.type, content.content);
|
||||
jcontents.put(jcontent);
|
||||
if (message.content.length == 1 && CONTENT_TEXT.equals(message.content[0].type))
|
||||
jmessage.put("content", message.content[0].content);
|
||||
else {
|
||||
JSONArray jcontents = new JSONArray();
|
||||
for (Content content : message.content) {
|
||||
JSONObject jcontent = new JSONObject();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue