cssxsh / mirai-openai-plugin

Mirai Console OpenAI ChatBot 插件
GNU Affero General Public License v3.0
130 stars 14 forks source link

[Bug report] 尝试使用 Clash 进行代理时报错:`javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake` #40

Closed Takeoff0518 closed 1 year ago

Takeoff0518 commented 1 year ago

Mirai 版本:2.15.0

插件版本:v1.5.1

系统版本:Ubuntu 20.04 LTS

本地部署了 Clash,插件通过 socks://127.0.0.1:7891 连接代理服务器,之前一段时间的使用一直正常。从前天开始,发现无法正常返回 OpenAI 的信息.


查看控制台,报错如下:

2023-08-24 20:37:50 W/MiraiOpenAiListener: MiraiOpenAiListener with GroupMessageEvent(group=*****, senderName=*****, sender=*****, permission=ADMINISTRATOR, message=[mirai:source:ids=[36***], internalIds=[1018*****], from group ***** to ***** at *****]chat)
javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
        at java.base/sun.security.ssl.SSLSocketImpl.handleEOF(SSLSocketImpl.java:1714)
        at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1513)
        at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1420)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
        at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at mirai-openai-plugin-1.5.1.mirai2.jar[private]//okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
        at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:483)
        at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
        at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
        at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
        at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1505)
        ... 23 more

Clash 日志输出如下:

[2023-08-24 20:37:48][INFO] [TCP] 127.0.0.1:35514 --> api.openai.com:443 match Match() using ***[🇭🇰香港 06 | 专线]

目前已经尝试过更换多个结点(这些节点均可以正常访问并使用 chat.openai.com),以及使用最新的 Action 版本,但报错均出现,且内容一样。