Skip to content

Commit 444fe53

Browse files
committed
do actual json
1 parent dc83a38 commit 444fe53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/us/ajg0702/bots/ajsupport/autorespond/EmbeddingUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ public static BigDecimal[] embed(String string) throws IOException {
2828
con.setRequestProperty("Authorization", "Bearer " + token); // Replace YOUR_BEARER_TOKEN with your actual token
2929
con.setDoOutput(true);
3030

31-
32-
String payload = String.format("{\"text\": \"%s\"}", string);
31+
JsonObject payloadObject = new JsonObject();
32+
payloadObject.addProperty("text", string);
33+
String payload = new Gson().toJson(payloadObject);
3334
try (var outputStream = con.getOutputStream()) {
3435
outputStream.write(payload.getBytes());
3536
outputStream.flush();

0 commit comments

Comments
 (0)