OpenAI ChatBot 插件,已添加预设功能(为啥你们都想整猫娘)
-
@awslnotbad API被墙了 现在需要使用代理...然后新的gpt3.5模型的api指令好像也略有修改
-
api.openai.com
已列入黑名单,你需要配置代理 -
拉取分支编译了一下,运行时出错:
2023-03-03 14:29:58 W/mirai-openai-plugin: Linked class io.ktor.client.engine.okhttp.OkHttp in MiraiPythonPlugin-1.0-RELEASE-jar-with-dependencies.jar but plugin not depend on it. 2023-03-03 14:29:58 W/mirai-openai-plugin: Class loading logic may change in feature. 2023-03-03 14:29:58 E/mirai-openai-plugin: net.mamoe.mirai.console.internal.util.ServiceLoadException: Could not load service xyz.cssxsh.mirai.openai.MiraiOpenAiListener. net.mamoe.mirai.console.internal.util.ServiceLoadException: Could not load service xyz.cssxsh.mirai.openai.MiraiOpenAiListener. at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:60) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadAllServices(PluginServiceHelper.kt:42) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.mirai.openai.MiraiOpenAiPlugin$special$$inlined$spi$2.invoke(MiraiOpenAiPlugin.kt:37) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.mirai.openai.MiraiOpenAiPlugin$special$$inlined$spi$2.invoke(MiraiOpenAiPlugin.kt:33) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.mirai.openai.MiraiOpenAiPlugin.getListeners(MiraiOpenAiPlugin.kt:30) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.mirai.openai.MiraiOpenAiPlugin.onEnable(MiraiOpenAiPlugin.kt:67) at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.internalOnEnable$mirai_console(JvmPluginInternal.kt:232) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:305) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:35) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt:50) at net.mamoe.mirai.console.plugin.PluginManager.enablePlugin(PluginManager.kt:173) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.enableAllLoadedPlugins$mirai_console(PluginManagerImpl.kt:181) at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:347) at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:496) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:177) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon$default(MiraiConsoleTerminalLoader.kt:176) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.main(MiraiConsoleTerminalLoader.kt:54) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.itxtech.mcl.Utility.bootJars(Utility.java:86) at org.itxtech.mcl.Utility.bootJars(Utility.java:76) at org.itxtech.mcl.Utility.bootMirai(Utility.java:98) at org.itxtech.mcl.module.builtin.Boot.boot(Boot.java:113) at org.itxtech.mcl.module.ModuleManager.phaseBoot(ModuleManager.java:123) at org.itxtech.mcl.Loader.lambda$start$4(Loader.java:196) at org.itxtech.mcl.Loader.tryCatching(Loader.java:151) at org.itxtech.mcl.Loader.start(Loader.java:196) at org.itxtech.mcl.Loader.main(Loader.java:84) Caused by: java.lang.NoClassDefFoundError: io/ktor/client/plugins/contentnegotiation/ContentNegotiation at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.openai.OpenAiClient$http$1.invoke(OpenAiClient.kt:28) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.openai.OpenAiClient$http$1.invoke(OpenAiClient.kt:27) at MiraiPythonPlugin-1.0-RELEASE-jar-with-dependencies.jar//io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:41) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.openai.OpenAiClient.<init>(OpenAiClient.kt:27) at mirai-openai-plugin-1.1.0.jar//xyz.cssxsh.mirai.openai.MiraiOpenAiListener.<clinit>(MiraiOpenAiListener.kt:30) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:467) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:51) ... 31 more Caused by: java.lang.ClassNotFoundException: io.ktor.client.plugins.contentnegotiation.ContentNegotiation at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at net.mamoe.mirai.console.internal.plugin.JvmPluginClassLoaderN.loadClass(JvmPluginClassLoader.kt:440) ... 39 more 2023-03-03 14:29:58 W/mirai-api-http: Linked class net.mamoe.yamlkt.YamlElement in MiraiPythonPlugin-1.0-RELEASE-jar-with-dependencies.jar but plugin not depend on it. 2023-03-03 14:29:58 W/mirai-api-http: Class loading logic may change in feature.
-
-
@cssxsh 还有一个问题,聊天,gpt-3.5-turbo-0301:
2023-03-03 15:05:54 V/Bot.*: Group(*) <- [mirai:quote:[mirai:source:ids=[2519], internalIds=[167958381], from group * to * at 1677827153], content=/lc]聊天将开始 2023-03-03 15:05:56 V/Bot.*: [*(*)] aaa(*) -> 你好 2023-03-03 15:05:57 W/MiraiOpenAiListener: MiraiOpenAiListener with GroupMessageEvent(group=*, senderName=aaa, sender=*, permission=OWNER, message=[mirai:source:ids=[2519], internalIds=[167958381], from group * to * at *]/lc) java.lang.IllegalArgumentException: message is empty at net.mamoe.mirai.internal.contact.AbstractUserKt.sendMessageImpl(AbstractUser.kt:258) at net.mamoe.mirai.internal.contact.CommonGroupImpl.sendMessage$suspendImpl(GroupImpl.kt:219) at net.mamoe.mirai.internal.contact.CommonGroupImpl.sendMessage(GroupImpl.kt) at mirai-openai-plugin-1.2.0.mirai2.jar//xyz.cssxsh.mirai.openai.MiraiOpenAiListener$chat$4$2.invokeSuspend(MiraiOpenAiListener.kt:206) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) 2023-03-03 15:05:57 V/Bot.*: Group(*) <- [mirai:quote:[mirai:source:ids=[2519], internalIds=[167958381], from group * to * at *], content=/lc]聊天已终止
-
此回复已被删除! -
proxy:"127.0.0.1:7890" 这样配置不对吗,请问该如何正确填写
-
api的返回改了,我忘记吧回复的内容也变一下,下个版本修复
-
@cssxsh OK,我试了下最新版,用了代理,可以了,感谢
-
@yuanbolin proxy 代理 协议支持 socks 和 http, 例如 socks://127.0.0.1:7890
-
正在试验黑魔法,避免使用代理
下个版本在没有代理的情况下会开启以解决java.net.SocketException: Connection reset
-
@cssxsh 可是为什么我把机器人部署到了漂亮国的服务器上还是会出现同样的提示呢?
-
?日志呢
-
2023-03-04 15:00:38 I/Bot.2102586642: Bot login successful. root (2102586642) Login successful 2023-03-04 15:00:40 V/Bot.2102586642: root(2799940199) -> chat 2023-03-04 15:00:40 V/Bot.2102586642: Friend(2799940199) <- [mirai:quote:[mirai:source:ids=[29691], internalIds=[-17556028], from friend 2799940199 to 2102586642 at 1677942039], content=chat]聊天将开始 2023-03-04 15:00:43 W/MiraiOpenAiListener: MiraiOpenAiListener with FriendMessageEvent(sender=2799940199, message=[mirai:source:ids=[29691], internalIds=[-17556028], from friend 2799940199 to 2102586642 at 1677942039]chat) java.net.SocketException: Connection refused at java.base/java.net.SocksSocketImpl.connect(Unknown Source) at java.base/java.net.Socket.connect(Unknown Source) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at mirai-openai-plugin-1.2.1.mirai2.jar[private]//okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) 2023-03-04 15:00:43 V/Bot.2102586642: root(2799940199) -> whoami
-
@Night1918 在 Mirai Console OpenAI ChatBot 插件 中说:
Connection refused
这和
Connection reset
不一样请尝试使用
curl
或者其他工具检测对https://api.openai.com/
的连通性 -
@cssxsh
应该是我的网络出了问题。。。
奇怪,curl google都能正常返回,openai就不行,甚至不能ping通 -
你这个返回是正常的
至于为什么Connection refused
就不知道了
也许只是单纯的网络波动 -
@cssxsh
奇怪,我换了几个海外vps都是这样 -
我大概知道怎么回事了
你打开openai.yml
看一下 proxy 配置项
看看是不是 有内容,如果有改成''
也就是置空我之前好像搞了一个默认的代理配置 (省的老是有人问代理的格式)
-
@cssxsh 成功了,感谢🌹