chatgpt-java
chatgpt-java copied to clipboard
设置代理
有没有办法设置一个代理呢,因为国内并不能登录openai,但是使用代理获得的token加上国内的cf_clearance和user-agent并不能成功访问。所以希望能添加个代理设置。
登录后取消代理即可
我的代理用的是一个单独的浏览器,取消代理就无法访问网站了
登录需要,登录后就不用了,亲测
还是没用
2022-12-12 15:37:23 W/stderr: java.lang.Exception: Error refreshing session
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar[private]//com.github.plexpt.chatgpt.Chatbot.refreshSession(Chatbot.java:281)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar[private]//com.github.plexpt.chatgpt.Chatbot.<init>(Chatbot.java:53)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.utils.ChatGPT.get(ChatGPT.kt:22)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.utils.ChatGPT.chat0(ChatGPT.kt:24)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.utils.ChatGPT.chat(ChatGPT.kt:29)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.utils.ChatGPT$chat$2.invoke(ChatGPT.kt)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.utils.ChatGPT$chat$2.invoke(ChatGPT.kt)
2022-12-12 15:37:23 W/stderr: at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:205)
2022-12-12 15:37:23 W/stderr: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2022-12-12 15:37:23 W/stderr: at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar[private]//me.him188.kotlin.jvm.blocking.bridge.internal.RunSuspendKt.$runSuspend$(RunSuspend.kt:18)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.utils.ChatGPT.chat(ChatGPT.kt)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar//NoMathExpectation.NMEBoot.commandSystem.services.General.lambda$onMessage$1(General.java:573)
2022-12-12 15:37:23 W/stderr: at java.base/java.lang.Thread.run(Thread.java:829)
2022-12-12 15:37:23 W/stderr: Caused by: com.alibaba.fastjson2.JSONException: illegal input, offset 1, char <
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar[private]//com.alibaba.fastjson2.JSONReader.read(JSONReader.java:1432)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar[private]//com.alibaba.fastjson2.JSON.parseObject(JSON.java:193)
2022-12-12 15:37:23 W/stderr: at NMEboot-1.2.mirai2.jar[private]//com.github.plexpt.chatgpt.Chatbot.refreshSession(Chatbot.java:271)
2022-12-12 15:37:23 W/stderr: ... 13 more
所以有没有解决办法