Skip to content

Commit 83d7de0

Browse files
committed
♻️ 111
1 parent 25c2bd2 commit 83d7de0

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ maven
6363
<dependency>
6464
<groupId>com.github.plexpt</groupId>
6565
<artifactId>chatgpt</artifactId>
66-
<version>1.1.0</version>
66+
<version>1.1.1</version>
6767
</dependency>
6868
```
6969

7070
gradle
7171
```
72-
implementation group: 'com.github.plexpt', name: 'chatgpt', version: '1.1.0'
72+
implementation group: 'com.github.plexpt', name: 'chatgpt', version: '1.1.1'
7373
```
7474

7575

README_en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ maven
2626
<dependency>
2727
<groupId>com.github.plexpt</groupId>
2828
<artifactId>chatgpt</artifactId>
29-
<version>1.1.0</version>
29+
<version>1.1.1</version>
3030
</dependency>
3131
```
3232

3333
gradle
3434
```
35-
implementation group: 'com.github.plexpt', name: 'chatgpt', version: '1.1.0'
35+
implementation group: 'com.github.plexpt', name: 'chatgpt', version: '1.1.1'
3636
```
3737

3838

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.github.plexpt</groupId>
77
<artifactId>chatgpt</artifactId>
8-
<version>1.1.0</version>
8+
<version>1.1.1</version>
99
<name>chatgpt-java</name>
1010
<description>chatgpt-java</description>
1111

src/main/java/com/github/plexpt/chatgpt/Chatbot.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,18 +260,23 @@ public void refreshSession() {
260260
// Set cookies
261261
session.getCookies().put("__Secure-next-auth.session-token", sessionToken);
262262
session.getCookies().put("cf_clearance", cfClearance);
263+
String cookiesString = session.getCookiesString();
263264
Map<String, String> map = new HashMap<>();
264265
map.put("User-Agent", userAgent);
266+
map.put("cookie", cookiesString);
267+
map.put("Cookie", cookiesString);
265268
session.setHeaders(map);
266-
267269
String urlSession = "https://chat.openai.com/api/auth/session";
268270
HttpResponse response = session.get2(urlSession);
269271

270272
if (response.getStatus() != 200) {
271273
System.err.println("err code: " + response.getStatus());
272-
System.out.println("cf_clearance: " + cfClearance);
273-
System.out.println("token: " + sessionToken);
274-
System.out.println("userAgent: " + userAgent);
274+
System.err.println("cf_clearance: " + cfClearance);
275+
System.err.println("token: " + sessionToken);
276+
System.err.println("userAgent: " + userAgent);
277+
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" );
275280

276281
return;
277282
}

src/main/java/com/github/plexpt/chatgpt/Session.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public Response post(String url, Map<String, String> headers, String payload) {
112112
}
113113

114114

115-
private String getCookiesString() {
115+
public String getCookiesString() {
116116
String result = "";
117117
for (Map.Entry<String, String> entry : cookies.entrySet()) {
118118
String key = entry.getKey();

0 commit comments

Comments
 (0)