mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-01 01:06:11 +00:00
OpenAI: allow (local) http connections
This commit is contained in:
parent
89b2b1f88c
commit
18d69965ef
1 changed files with 3 additions and 4 deletions
|
@ -33,6 +33,7 @@ import org.json.JSONObject;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
@ -40,8 +41,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
public class OpenAI {
|
||||
static final String ASSISTANT = "assistant";
|
||||
static final String USER = "user";
|
||||
|
@ -151,7 +150,7 @@ public class OpenAI {
|
|||
long start = new Date().getTime();
|
||||
|
||||
URL url = new URL(uri.toString());
|
||||
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
|
||||
connection.setRequestMethod(method);
|
||||
connection.setDoOutput(args != null);
|
||||
|
@ -172,7 +171,7 @@ public class OpenAI {
|
|||
}
|
||||
|
||||
int status = connection.getResponseCode();
|
||||
if (status != HttpsURLConnection.HTTP_OK) {
|
||||
if (status != HttpURLConnection.HTTP_OK) {
|
||||
// https://platform.openai.com/docs/guides/error-codes/api-errors
|
||||
String error = "Error " + status + ": " + connection.getResponseMessage();
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue