OpenAI: image support

This commit is contained in:
M66B
2024-05-14 20:21:54 +02:00
parent 229a45d87b
commit 252ad4c2a5
4 changed files with 66 additions and 23 deletions

View File

@@ -123,7 +123,12 @@ public class OpenAI {
for (Content content : message.content) {
JSONObject jcontent = new JSONObject();
jcontent.put("type", content.type);
jcontent.put(content.type, content.content);
if (CONTENT_IMAGE.equals(content.type)) {
JSONObject jimage = new JSONObject();
jimage.put("url", content.content);
jcontent.put(content.type, jimage);
} else
jcontent.put(content.type, content.content);
jcontents.put(jcontent);
}
jmessage.put("content", jcontents);