@@ -28,6 +28,8 @@ public class Chatbot {
2828 private String parentId ;
2929 private Map <String , String > headers = new HashMap <>();
3030
31+ private String host = "https://chat.openai.com" ;
32+
3133 private String conversationIdPrev ;
3234 private String parentIdPrev ;
3335
@@ -91,7 +93,7 @@ public void refreshHeaders() {
9193
9294
9395 Map <String , Object > getChatStream (Map <String , Object > data ) {
94- String url = "https://chat.openai.com /backend-api/conversation" ;
96+ String url = host + " /backend-api/conversation" ;
9597
9698 String body = HttpUtil .createPost (url )
9799 .headerMap (headers , true )
@@ -157,7 +159,7 @@ public Map<String, Object> getChatText(Map<String, Object> data) {
157159 // Set proxies
158160 setupProxy (session );
159161
160- HttpResponse response = session .post2 ("https://chat.openai.com /backend-api/conversation" ,
162+ HttpResponse response = session .post2 (host + " /backend-api/conversation" ,
161163 data );
162164 String body = response .body ();
163165
@@ -266,7 +268,7 @@ public void refreshSession() {
266268 map .put ("cookie" , cookiesString );
267269 map .put ("Cookie" , cookiesString );
268270 session .setHeaders (map );
269- String urlSession = "https://chat.openai.com /api/auth/session" ;
271+ String urlSession = host + " /api/auth/session" ;
270272 HttpResponse response = session .get2 (urlSession );
271273
272274 if (response .getStatus () != 200 ) {
@@ -275,8 +277,10 @@ public void refreshSession() {
275277 System .err .println ("token: " + sessionToken );
276278 System .err .println ("userAgent: " + userAgent );
277279
278- System .err .println ("请检查以上参数是否正确,是否过期。并且获取以上参数的浏览器要和本程序在同一IP地址" );
279- System .err .println ("Please check whether the above parameters are correct or expired. And the browser that obtains the above parameters must be at the same IP address as this program" );
280+ System .err .println ("请检查以上参数是否正确,是否过期。并且获取以上参数的浏览器要和本程序在同一IP地址" );
281+ System .err .println ("Please check whether the above parameters are correct or expired." +
282+ " And the browser that obtains the above parameters must be at the same IP " +
283+ "address as this program" );
280284
281285 return ;
282286 }
0 commit comments