作者 钟来

修改gpt接口地址

@@ -59,14 +59,8 @@ public class YiJiFortuneTellingService { @@ -59,14 +59,8 @@ public class YiJiFortuneTellingService {
59 jsonObject.put("messages",messageList); 59 jsonObject.put("messages",messageList);
60 60
61 logger.info("开始请求openai接口:{}",jsonObject); 61 logger.info("开始请求openai接口:{}",jsonObject);
62 - String str = null;  
63 - try {  
64 - 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();  
65 - } catch (NoSuchAlgorithmException e) {  
66 - throw new RuntimeException(e);  
67 - } catch (KeyManagementException e) {  
68 - throw new RuntimeException(e);  
69 - } 62 + String str = HttpRequest.post("http://us.proxy.openai.njlaikun.com/v1/chat/completions").setReadTimeout(timeout).timeout(timeout).addHeaders(map).body(jsonObject.toString()).execute().body();
  63 +
70 logger.info("返回的数据:{}",str); 64 logger.info("返回的数据:{}",str);
71 CompletionResult3_5 completionResult = JSONObject.parseObject(str, CompletionResult3_5.class); 65 CompletionResult3_5 completionResult = JSONObject.parseObject(str, CompletionResult3_5.class);
72 return completionResult; 66 return completionResult;
@@ -88,7 +82,7 @@ public class YiJiFortuneTellingService { @@ -88,7 +82,7 @@ public class YiJiFortuneTellingService {
88 // String str = HttpsUtil.post("https://proxy.openai.njlaikun.com/v1/chat/completions",jsonObject,map,true); 82 // String str = HttpsUtil.post("https://proxy.openai.njlaikun.com/v1/chat/completions",jsonObject,map,true);
89 String str = null; 83 String str = null;
90 try { 84 try {
91 - str = HttpRequest.post("https://us.proxy.openai.njlaikun.com/v1/chat/completions").setHostnameVerifier(new TrustAnyHostnameVerifier()).addHeaders(map).body(jsonObject.toString()).execute().body(); 85 + str = HttpRequest.post("http://us.proxy.openai.njlaikun.com/v1/chat/completions").setHostnameVerifier(new TrustAnyHostnameVerifier()).addHeaders(map).body(jsonObject.toString()).execute().body();
92 } catch (Exception e) { 86 } catch (Exception e) {
93 throw new RuntimeException(e); 87 throw new RuntimeException(e);
94 } 88 }