|
...
|
...
|
@@ -59,14 +59,8 @@ public class YiJiFortuneTellingService { |
|
|
|
jsonObject.put("messages",messageList);
|
|
|
|
|
|
|
|
logger.info("开始请求openai接口:{}",jsonObject);
|
|
|
|
String str = null;
|
|
|
|
try {
|
|
|
|
str = HttpRequest.post("https://proxy.openai.njlaikun.com/v1/chat/completions").setSSLSocketFactory(SSLSocketFactoryBuilder.create().setProtocol("TLSv1.2").build()).setReadTimeout(timeout).timeout(timeout).addHeaders(map).body(jsonObject.toString()).execute().body();
|
|
|
|
} catch (NoSuchAlgorithmException e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
} catch (KeyManagementException e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
String str = HttpRequest.post("http://us.proxy.openai.njlaikun.com/v1/chat/completions").setReadTimeout(timeout).timeout(timeout).addHeaders(map).body(jsonObject.toString()).execute().body();
|
|
|
|
|
|
|
|
logger.info("返回的数据:{}",str);
|
|
|
|
CompletionResult3_5 completionResult = JSONObject.parseObject(str, CompletionResult3_5.class);
|
|
|
|
return completionResult;
|
|
...
|
...
|
@@ -88,7 +82,7 @@ public class YiJiFortuneTellingService { |
|
|
|
// String str = HttpsUtil.post("https://proxy.openai.njlaikun.com/v1/chat/completions",jsonObject,map,true);
|
|
|
|
String str = null;
|
|
|
|
try {
|
|
|
|
str = HttpRequest.post("https://us.proxy.openai.njlaikun.com/v1/chat/completions").setHostnameVerifier(new TrustAnyHostnameVerifier()).addHeaders(map).body(jsonObject.toString()).execute().body();
|
|
|
|
str = HttpRequest.post("http://us.proxy.openai.njlaikun.com/v1/chat/completions").setHostnameVerifier(new TrustAnyHostnameVerifier()).addHeaders(map).body(jsonObject.toString()).execute().body();
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
...
|
...
|
|