lss233 / chatgpt-mirai-qq-bot Goto Github PK
View Code? Open in Web Editor NEW🚀 一键部署!真正的 AI 聊天机器人!支持ChatGPT、文心一言、讯飞星火、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送 | 支持 QQ、Telegram、Discord、微信 等平台
License: GNU Affero General Public License v3.0
🚀 一键部署!真正的 AI 聊天机器人!支持ChatGPT、文心一言、讯飞星火、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送 | 支持 QQ、Telegram、Discord、微信 等平台
License: GNU Affero General Public License v3.0
Traceback (most recent call last):
File "D:\wx\chatgpt\bot.py", line 18, in
import chatbot
File "D:\wx\chatgpt\chatbot.py", line 14, in
bot = AsyncChatbot(config.openai.dict(exclude_none=True, by_alias=False), conversation_id=None, base_url=config.openai.base_url)
File "D:\wx\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 116, in init
self.refresh_session()
File "D:\wx\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 295, in refresh_session
asyncio.run(self.get_cf_cookies())
File "asyncio\runners.py", line 44, in run
File "asyncio\base_events.py", line 647, in run_until_complete
File "D:\wx\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 370, in get_cf_cookies
browser = await p.chromium.launch(headless=False)
File "D:\wx\chatgpt\python3.9\lib\site-packages\playwright\async_api_generated.py", line 12809, in launch
await self._impl_obj.launch(
File "D:\wx\chatgpt\python3.9\lib\site-packages\playwright_impl_browser_type.py", line 93, in launch
Browser, from_channel(await self._channel.send("launch", params))
File "D:\wx\chatgpt\python3.9\lib\site-packages\playwright_impl_connection.py", line 44, in send
return await self._connection.wrap_api_call(
File "D:\wx\chatgpt\python3.9\lib\site-packages\playwright_impl_connection.py", line 419, in wrap_api_call
return await cb()
File "D:\wx\chatgpt\python3.9\lib\site-packages\playwright_impl_connection.py", line 79, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.Error: Executable doesn't exist at C:\Users\Administrator\AppData\Local\ms-playwright\chromium-1033\chrome-win\chrome.exe
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ playwright install ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════╝
D:\wx\chatgpt>
File "bot.py", line 17
async def to_thread(func, /, *args, **kwargs):
^
SyntaxError: invalid syntax
ChatGPT 看起来已经被玩坏了。
兼容 OpenAI API, 可用性会更高一些。
config.json更换了最新的session_key,镜像重新pull了,容器rm掉之后重新run,报错如下:
azure_root@UbuntuVM:~/mirai-api-http/chatgpt-mirai-qq-bot$ sudo docker run --name mirai-chatgpt-bot -v /home/azure_root/mirai-api-http/chatgpt-mirai-qq-bot/config.json:/app/config.json --network host lss233/chatgpt-mirai-qq-bot:latest
Traceback (most recent call last):
File "/app/bot.py", line 14, in <module>
import chatbot
File "/app/chatbot.py", line 7, in <module>
bot = Chatbot(config_data["openai"], conversation_id=None, base_url=config_data["base_url"] if "base_url" in config_data else "https://chat.openai.com/")
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 96, in __init__
self.refresh_session()
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 308, in refresh_session
raise Exception("Wrong response code")
Exception: Wrong response code
`> python bot.py
Traceback (most recent call last):
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen
self._prepare_proxy(conn)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 996, in _prepare_proxy
conn.connect()
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 364, in connect
self.sock = conn = self._connect_tls_proxy(hostname, conn)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 499, in connect_tls_proxy
socket = ssl_wrap_socket(
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl.py", line 453, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\ssl.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1122)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='chat.openai.com', port=443): Max retries exceeded with url: /api/auth/session (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\robot\HuaxixiNew\chatgpt-mirai-qq-bot\bot.py", line 11, in
import chatbot
File "F:\robot\HuaxixiNew\chatgpt-mirai-qq-bot\chatbot.py", line 7, in
bot = Chatbot(config_data["openai"], conversation_id=None)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\revChatGPT\revChatGPT.py", line 83, in init
self.refresh_session()
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\revChatGPT\revChatGPT.py", line 268, in refresh_session
response = s.get(
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Huaxidesu\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='chat.openai.com', port=443): Max retries exceeded with url: /api/auth/session (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)')))`
chat-chatgpt-1 | Traceback (most recent call last):
chat-chatgpt-1 | File "/app/bot.py", line 11, in <module>
chat-chatgpt-1 | import chatbot
chat-chatgpt-1 | File "/app/chatbot.py", line 4, in <module>
chat-chatgpt-1 | config_data = json.load(jsonfile)
chat-chatgpt-1 | File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
chat-chatgpt-1 | return loads(fp.read(),
chat-chatgpt-1 | File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
chat-chatgpt-1 | return _default_decoder.decode(s)
chat-chatgpt-1 | File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
chat-chatgpt-1 | obj, end = self.raw_decode(s, idx=_w(s, 0).end())
chat-chatgpt-1 | File "/usr/local/lib/python3.9/json/decoder.py", line 353, in raw_decode
chat-chatgpt-1 | obj, end = self.scan_once(s, idx)
chat-chatgpt-1 | json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 3 column 27 (char 43)
****
昨天上午部署之后没什么问题功能也正常,但从昨晚晚上突然就开始这个Not a JSON response报错,重置会话没有作用,到现在一直是这个错误。
已经排查chatgpt账号网络等问题,也尝试过更新重写部署,但未能解决。
能提供更多的错误信息报告或者相关排查错误措施吗?
E/main: net.mamoe.mirai.network.WrongPasswordException: Error(bot=Bot(3072257520), code=45, title=禁止登录, message=您好,您当前使用的版本过低,前往QQ官网im.qq.com下载新版QQ。, errorInfo=)
2022-12-23 23:22:12.497 | INFO | chatbot::17 - 登录 OpenAI 中……
2022-12-23 23:22:12.498 | INFO | chatbot::18 - 请在新打开的浏览器窗口中完成验证
2022-12-23 23:23:01.916 | ERROR | chatbot::36 - cf challenge fail
Traceback (most recent call last):
File "D:\Game\ChatGPT\chatgpt\bot.py", line 19, in
import chatbot
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "D:\Game\ChatGPT\chatgpt\chatbot.py", line 22, in
bot = AsyncChatbot(config=config.openai.dict(exclude_none=True, by_alias=False), conversation_id=None, base_url=config.openai.base_url)
│ │ │ │ │ │ └ 'https://chat.openai.com/'
│ │ │ │ │ └ OpenAISessionTokenAuth(Authorization=None, proxy=None, base_url='https://chat.openai.com/', cf_clearance=None, user_agent=Non...
│ │ │ │ └ Config(mirai=Mirai(qq=603488136, api_key='1234567890', http_url='http://localhost:8080', ws_url='http://localhost:8080'), ope...
│ │ │ └ <cyfunction BaseModel.dict at 0x000001A3920DF860>
│ │ └ OpenAISessionTokenAuth(Authorization=None, proxy=None, base_url='https://chat.openai.com/', cf_clearance=None, user_agent=Non...
│ └ Config(mirai=Mirai(qq=603488136, api_key='1234567890', http_url='http://localhost:8080', ws_url='http://localhost:8080'), ope...
└ <class 'revChatGPT.revChatGPT.AsyncChatbot'>
File "D:\Game\ChatGPT\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 116, in init
self.refresh_session()
│ └ <function AsyncChatbot.refresh_session at 0x000001A3939F1AF0>
└ <revChatGPT.revChatGPT.AsyncChatbot object at 0x000001A393A0C4C0>
File "D:\Game\ChatGPT\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 324, in refresh_session
self.refresh_session(running_in_async=running_in_async)
│ │ └ False
│ └ <function AsyncChatbot.refresh_session at 0x000001A3939F1AF0>
└ <revChatGPT.revChatGPT.AsyncChatbot object at 0x000001A393A0C4C0>
File "D:\Game\ChatGPT\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 323, in refresh_session
asyncio.run(self.get_cf_cookies())
│ │ │ └ <function AsyncChatbot.get_cf_cookies at 0x000001A3939F1B80>
│ │ └ <revChatGPT.revChatGPT.AsyncChatbot object at 0x000001A393A0C4C0>
│ └ <function run at 0x000001A38F86B4C0>
└ <module 'asyncio' from 'D:\Game\ChatGPT\chatgpt\python3.9\python39.zip\asyncio\init.pyc'>
File "asyncio\runners.py", line 44, in run
File "asyncio\base_events.py", line 647, in run_until_complete
File "D:\Game\ChatGPT\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 390, in get_cf_cookies
raise Exception("cf challenge fail")
Exception: cf challenge fail
2022-12-23 23:23:01.944 | ERROR | chatbot::37 - OpenAI 登录失败,可能是 session_token 过期或无法通过 CloudFlare 验证,建议歇息一下再重试。
是用最新版的,网页已经登录进chatgpt了,然后网页就被关掉,重新登陆,两次后报错
半自动、手动登陆都试过,一样结果
在发送消息后,openai响应时间将近一分钟,延迟非常高,很难进行交互。我是部署在国内服务器上的。有什么解决方案吗?
部署后给机器人发消息一直显示下面的文字。
寄了!
('Response is not in the correct format', 'Incorrect API key provided: Bearer. You can find your API key at https://beta.openai.com.')
登上chatgpt后发现
要用的token过十几秒就会换
换了token再运行bot.py也一直得到Wrong response code
可以根据关键词来判断是否回复,这样其他插件在私聊或者群里被at的时候也不会产生冲突
Traceback (most recent call last):
File "D:\OpenAiQQBot\chatgpt\bot.py", line 15, in
import chatbot
File "D:\OpenAiQQBot\chatgpt\chatbot.py", line 7, in
bot = Chatbot(config_data["openai"], conversation_id=None, base_url=config_data["base_url"] if "base_url" in config_data else "https://chat.openai.com/")
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 100, in init
self.refresh_session()
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 310, in refresh_session
self.get_cf_cookies()
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 390, in get_cf_cookies
driver.get("https://chat.openai.com/chat")
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\undetected_chromedriver_init_.py", line 656, in get
return super().get(url)
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 455, in get
self.execute(Command.GET, {"url": url})
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_PROXY_CONNECTION_FAILED
(Session info: chrome=108.0.5359.99)
Stacktrace:
Backtrace:
(No symbol) [0x0097F243]
(No symbol) [0x00907FD1]
(No symbol) [0x007FD04D]
(No symbol) [0x007F9152]
(No symbol) [0x007F044D]
(No symbol) [0x007F12EF]
(No symbol) [0x007F071D]
(No symbol) [0x007EFB0B]
(No symbol) [0x007EFA5C]
(No symbol) [0x007EE7E8]
(No symbol) [0x007EEDC2]
(No symbol) [0x007FEA5B]
(No symbol) [0x0085D187]
(No symbol) [0x0084858C]
(No symbol) [0x0085C9EB]
(No symbol) [0x00848386]
(No symbol) [0x0082163C]
(No symbol) [0x0082269D]
GetHandleVerifier [0x00C19A22+2655074]
GetHandleVerifier [0x00C0CA24+2601828]
GetHandleVerifier [0x00A28C0A+619850]
GetHandleVerifier [0x00A27830+614768]
(No symbol) [0x009105FC]
(No symbol) [0x00915968]
(No symbol) [0x00915A55]
(No symbol) [0x0092051B]
BaseThreadInitThunk [0x76517BA9+25]
RtlInitializeExceptionChain [0x770EBB9B+107]
RtlClearBits [0x770EBB1F+191]
按照了通过 Docker 部署 (适合已经有 Mirai 的用户)
root@UbuntuVM:~/mirai-api-http/chatgpt-mirai-qq-bot$ sudo docker run --name mirai-chatgpt-bot -v /home/root/mirai-api-http/chatgpt-mirai-qq-bot/config.json:/app/config.json --network host lss233/chatgpt-mirai-qq-bot:latest
Traceback (most recent call last):
File "/app/bot.py", line 11, in <module>
import chatbot
File "/app/chatbot.py", line 4, in <module>
config_data = json.load(jsonfile)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 3 column 27 (char 43)
从 Issue 和 交流群 的反馈情况来看,跑通本项目的步骤还是比较复杂,可以探索更简便的方法。
Traceback (most recent call last): File "I:\quickstart-windows-amd64\chatgpt\bot.py", line 19, in <module> import chatbot File "I:\quickstart-windows-amd64\chatgpt\chatbot.py", line 1, in <module> from revChatGPT.revChatGPT import AsyncChatbot, generate_uuid File "I:\quickstart-windows-amd64\chatgpt\python3.9\lib\site-packages\revChatGPT\revChatGPT.py", line 14, in <module> from playwright.async_api import async_playwright File "I:\quickstart-windows-amd64\chatgpt\python3.9\lib\site-packages\playwright\async_api\__init__.py", line 25, in <module> import playwright.async_api._generated File "I:\quickstart-windows-amd64\chatgpt\python3.9\lib\site-packages\playwright\async_api\_generated.py", line 25, in <module> from playwright._impl._accessibility import Accessibility as AccessibilityImpl File "I:\quickstart-windows-amd64\chatgpt\python3.9\lib\site-packages\playwright\_impl\_accessibility.py", line 17, in <module> from playwright._impl._connection import Channel File "I:\quickstart-windows-amd64\chatgpt\python3.9\lib\site-packages\playwright\_impl\_connection.py", line 23, in <module> from greenlet import greenlet File "I:\quickstart-windows-amd64\chatgpt\python3.9\lib\site-packages\greenlet\__init__.py", line 29, in <module> from ._greenlet import _C_API # pylint:disable=no-name-in-module ImportError: DLL load failed while importing _greenlet: 找不到指定的模块。
Waiting for cookies...
2022-12-13 08:21:59.883 | INFO | launart.manager:launch_blocking:446 - Starting launart main task...
2022-12-13 08:21:59.885 | INFO | launart.manager:launch:313 - Launching 5 components as async task...
2022-12-13 08:21:59.941 | INFO | graia.ariadne.service:base_telemetry:142 -
_ _ _
/ \ _ _(_) __ _ | | __ ___
/ _ \ | '| |/ |/ _
| ' \ / _
/ ___ | | | | (| | (| | | | | /
// __| ||_,|_,|| ||_|
graia-amnesia: 0.7.0
graia-ariadne: 0.10.0
graia-broadcast: 0.19.0
launart: 0.6.1
statv: 0.3.2
2022-12-13 08:21:59.946 | INFO | launart.manager:_launchable_task_done_callback:59 - [elizabeth.connection.1510834862.http_client_connection] completed.
2022-12-13 08:21:59.947 | SUCCESS | launart.manager:launch:351 - Layer #1:[http.client/aiohttp, cache.client/memcache] preparation completed.
2022-12-13 08:21:59.948 | SUCCESS | launart.manager:launch:351 - Layer #3:[elizabeth.service] preparation completed.
2022-12-13 08:21:59.950 | INFO | launart.manager:launch:356 - All components prepared, start blocking phase.
2022-12-13 08:22:02.106 | ERROR | graia.amnesia.builtins.aiohttp:connection_manage:231 - 404, message='Invalid response status', url=URL('http://localhost:8080/all?qq=1510834862&verifyKey=1234567890')
Traceback (most recent call last):
File "D:\OpenAiQQBot\chatgpt\bot.py", line 94, in
app.launch_blocking()
│ └ <classmethod object at 0x000001EDD26A7D00>
└ <graia.ariadne.app.Ariadne object at 0x000001EDFA0AA4C0>
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\graia\ariadne\app.py", line 298, in launch_blocking
cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals)
│ │ │ │ │ │ └ (<Signals.SIGINT: 2>,)
│ │ │ │ │ └ <property object at 0x000001EDD26AECC0>
│ │ │ │ └ <graia.ariadne.service.ElizabethService object at 0x000001EDFA0AAE80>
│ │ │ └ <class 'graia.ariadne.app.Ariadne'>
│ │ └ <function Launart.launch_blocking at 0x000001EDD172E8B0>
│ └ <launart.manager.Launart object at 0x000001EDFA162EB0>
└ <class 'graia.ariadne.app.Ariadne'>
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\launart\manager.py", line 461, in launch_blocking
loop.run_until_complete(launch_task)
│ │ └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\laun...
│ └ <function BaseEventLoop.run_until_complete at 0x000001EDD139DA60>
└
File "asyncio\base_events.py", line 634, in run_until_complete
File "asyncio\windows_events.py", line 321, in run_forever
File "asyncio\base_events.py", line 601, in run_forever
File "asyncio\base_events.py", line 1905, in _run_once
File "asyncio\events.py", line 80, in _run
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\graia\amnesia\builtins\aiohttp.py", line 217, in connection_manage
await self._start_conn()
│ └ <function AiohttpClientConnectionRider._start_conn at 0x000001EDD256D1F0>
└ <graia.amnesia.builtins.aiohttp.AiohttpClientConnectionRider object at 0x000001EDFA189AC0>
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\graia\amnesia\builtins\aiohttp.py", line 180, in _start_conn
self.response = await self.conn_func(**self.call_param)
│ │ │ │ │ └ {'url': 'http://localhost:8080/all?qq=1510834862&verifyKey=1234567890', 'heartbeat': 30.0}
│ │ │ │ └ <graia.amnesia.builtins.aiohttp.AiohttpClientConnectionRider object at 0x000001EDFA189AC0>
│ │ │ └ <bound method ClientSession.ws_connect of <aiohttp.client.ClientSession object at 0x000001EDFA181FA0>>
│ │ └ <graia.amnesia.builtins.aiohttp.AiohttpClientConnectionRider object at 0x000001EDFA189AC0>
│ └ None
└ <graia.amnesia.builtins.aiohttp.AiohttpClientConnectionRider object at 0x000001EDFA189AC0>
File "D:\OpenAiQQBot\chatgpt\python3.9\lib\site-packages\aiohttp\client.py", line 795, in _ws_connect
raise WSServerHandshakeError(
└ <class 'aiohttp.client_exceptions.WSServerHandshakeError'>
aiohttp.client_exceptions.WSServerHandshakeError: 404, message='Invalid response status', url=URL('http://localhost:8080/all?qq=1510834862&verifyKey=1234567890')
2022-12-13 08:22:02.145 | WARNING | graia.ariadne.connection.ws::75 - Websocket reconnecting in 5s...
2022-12-13 08:22:07.163 | WARNING | graia.ariadne.connection.ws::77 - Websocket reconnecting...
ModuleNotFoundError: No module named 'revChatGPT.revChatGPT'
报错如下:
Traceback (most recent call last):
File "/app/bot.py", line 11, in <module>
import chatbot
File "/app/chatbot.py", line 7, in <module>
bot = Chatbot(config_data["openai"], conversation_id=None)
KeyError: 'openai'
config.json配置:
{
"mirai": {
"qq": ______,
"api_key": "______",
"http_url": "http://localhost:8080",
"ws_url": "http://localhost:8080"
},
"openai": {
"email": "________",
"password": "_______"
},
"text_to_image": {
"font_size": 30,
"width": 700,
"font_path": "fonts/sarasa-mono-sc-regular.ttf",
"offset_x": 50,
"offset_y": 50
}
}
终端输出:
`Waiting for xpra to start
Warning: running as root
2022-12-18 02:40:43,340 Warning: cannot enable SSH socket upgrades
2022-12-18 02:40:43,340 No module named 'paramiko'
2022-12-18 02:40:43,340 created tcp socket '0.0.0.0:14500'
2022-12-18 02:40:43,343 no uinput module (not usually needed)
2022-12-18 02:40:44,555 pointer device emulation using XTest
2022-12-18 02:40:44,605 Error: cannot find the html web root
2022-12-18 02:40:44,605 '/usr/local/share/xpra/www' does not exist
2022-12-18 02:40:44,605 install thexpra-html5
package
2022-12-18 02:40:44,606 wrote pid 7 to '/tmp/99/server.pid'
2022-12-18 02:40:44,625 Warning: socket directory '/tmp/99'
2022-12-18 02:40:44,625 expected permissions 700 but found 750
2022-12-18 02:40:44,626 created unix domain socket '/run/user/1000/xpra/iznyaku-99'
2022-12-18 02:40:44,626 created unix domain socket '/tmp/99/socket'
2022-12-18 02:40:44,626 xvfb pid=12
2022-12-18 02:40:44,689 Warning: cannot watch for application menu changes without pyinotify:
2022-12-18 02:40:44,691 No module named 'pyinotify'
2022-12-18 02:40:44,701 Warning: cannot load menu data
2022-12-18 02:40:44,701 No module named 'xdg'
2022-12-18 02:40:44,706 Warning: webcam forwarding is disabled
2022-12-18 02:40:44,706 the virtual video directory '/sys/devices/virtual/video4linux' was not found
2022-12-18 02:40:44,706 make sure that the 'v4l2loopback' kernel module is installed and loaded
2022-12-18 02:40:44,706 or use the 'webcam=no' option
2022-12-18 02:40:44,706 found 0 virtual video devices for webcam forwarding
2022-12-18 02:40:44,817 1.8GB of system memory
2022-12-18 02:40:45,012 Warning: OpenGL support check failed:
2022-12-18 02:40:45,012 unknown error
2022-12-18 02:40:45,014 xpra is ready.
2022-12-18 02:40:45,015 xpra X11 seamless version 4.4.3-r0 64-bit
2022-12-18 02:40:45,015 uid=0 (root), gid=0 (root)
2022-12-18 02:40:45,015 running with pid 7 on Linux Debian 11 bullseye
2022-12-18 02:40:45,015 connected to X11 display :99 with 24 bit colors
2022-12-18 02:40:53.881 | INFO | chatbot::18 - 登录 OpenAI 中……
2022-12-18 02:40:53.881 | INFO | chatbot::19 - 请在新打开的浏览器窗口中完成验证
2022-12-18 02:40:53.881 | INFO | chatbot::21 - 如果您使用 xpra,请使用自己的浏览器访问 xpra 程序的端口,以访问到本程序启动的浏览器。`
F:\OpenAI\chatgpt-mirai-qq-bot-1.2>python bot.py
Traceback (most recent call last):
File "F:\OpenAI\chatgpt-mirai-qq-bot-1.2\bot.py", line 11, in
import chatbot
File "F:\OpenAI\chatgpt-mirai-qq-bot-1.2\chatbot.py", line 4, in
config_data = json.load(jsonfile)
File "F:\Python\lib\json_init_.py", line 293, in load
return loads(fp.read(),
File "F:\Python\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "F:\Python\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "F:\Python\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
json本身格式应该没问题,只是改了用token登陆。
无论是文字方式,还是图片方式,有时机器人回复的答案不完整。
嗨,我是 Ariadne
的主要开发者。
Ariadne
使用的是 GNU AGPL-3.0
开源许可证,该许可证要求依赖它的项目使用 AGPL-3.0
(及以后版本)的许可证。
麻烦更改项目的许可证至 AGPL-3.0
,谢谢。
您好,我是 GraiaProject 成员、Ariadne 贡献者 @ProgramRipper。
由于 Ariadne 0.9.0 中的修改 对好友,群,群成员和版本等信息使用缓存 (@ProgramRipper)
引入的 bug,Ariadne 会缓存全部好友、群、群成员、消息和版本信息,并且不会过期,导致严重的内存泄露。
这一问题已在 GraiaProject/Ariadne#206 和 GraiaProject/Ariadne@3ad9a61 (0.9 backport) 中修复,并随后发布了修复版本 Ariadne 0.10.2 和 Ariadne 0.9.10。
这一问题波及使用了 Ariadne 0.9.0~0.9.8, 0.10.0 的所有应用(只要接收消息就有内存泄露风险)。很遗憾,此仓库正受到此问题影响。您可以通过升级 Ariadne 来修复这一问题:
pip install --upgrade graia-ariadne
poetry update graia-ariadne
pdm update graia-ariadne
# pyproject.toml
## poetry
[tool.poetry.dependencies]
graia-ariadne = "^0.10.2"
### or backport...
graia-ariadne = "^0.9.10"
## pdm
dependencies = [
"graia-ariadne>=0.10.2",
# ...
]
### or backport...
dependencies = [
"graia-ariadne>=0.9.10",
# ...
]
# requirements.txt
graia-ariadne==0.10.2
### or backport...
graia-ariadne==0.9.10
如果您的仓库中有 poetry.lock 或 pdm.lock 文件,也请不要忘记通过 poetry lock
或 pdm lock
更新它们。
在此,我对此问题已造成的损失,以及因为此问题而耽误您的宝贵时间和精力而感到抱歉。如果您有更多问题,可以在此议题下回复,我将尽我所能提供解答、协助。
操作系统:ubuntu20
config.json配置文件:
{
"mirai": {
"qq": "qq账号",
"api_key": "1234567",
"http_url": "http://localhost:8080",
"ws_url": "http://localhost:8080"
},
"openai": {
"email": "邮箱",
"password": "密码"
},
"text_to_image": {
"font_size": 30,
"width": 700,
"font_path": "fonts/sarasa-mono-sc-regular.ttf",
"offset_x": 50,
"offset_y": 50
}
}
是不是docker中 api_key 有默认值?
通过 Docker Compose 部署的
使用的是apt安装的docker-compose
首先,运行sudo docker-compose run mirai
时(看到你刚刚在中间加了个横杠lol)有一个这样的错误,我自行解决了:
Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/home/azure_root/chatgpt-mirai-qq-bot/mirai/config.json" to rootfs at "/mirai/config.json": mount /home/azure_root/chatgpt-mirai-qq-bot/mirai/config.json:/mirai/config.json (via /proc/self/fd/7), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
原因是部署时~/chatgpt-mirai-qq-bot/mirai/config.json
错误的创建为了文件夹,而非mcl-installer的config.json。替换后解决。
但是再次run时出现以下错误:
2022-12-10 09:09:32 I/main: Backend: version 2.13.2, built on 2022-12-04 17:50:53.
2022-12-10 09:09:32 I/main: Frontend Terminal: version 2.13.2, provided by Mamoe Technologies
2022-12-10 09:09:32 I/main: Welcome to visit https://mirai.mamoe.net/
2022-12-10 09:09:33 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-12-10 09:09:33 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-12-10 09:09:33 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.2
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin Chat Command v0.5.0
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.2
2022-12-10 09:09:34 I/plugin: Successfully loaded plugin MCL Addon v2.1.1
2022-12-10 09:09:35 I/main: Prepared built-in commands: autoLogin, help, login, logout, permission, status, stop
2022-12-10 09:09:35 I/Mirai HTTP API: ********************************************************
2022-12-10 09:09:35 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-12-10 09:09:35 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-12-10 09:09:35 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-12-10 09:09:36 E/net.mamoe.mirai-api-http: kotlinx.coroutines.JobCancellationException: LazyStandaloneCoroutine is cancelling; job=LazyStandaloneCoroutine{Cancelling}@28f154cc
kotlinx.coroutines.JobCancellationException: LazyStandaloneCoroutine is cancelling; job=LazyStandaloneCoroutine{Cancelling}@28f154cc
Caused by: java.net.SocketException: Unresolved address
at java.base/sun.nio.ch.Net.translateToSocketException(Unknown Source)
at java.base/sun.nio.ch.Net.translateException(Unknown Source)
at java.base/sun.nio.ch.Net.translateException(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.ConnectUtilsJvmKt.bind(ConnectUtilsJvm.kt:32)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:46)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:30)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind$default(TcpSocketBuilder.kt:26)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.server.cio.backend.HttpServerKt$httpServer$acceptJob$1.invokeSuspend(HttpServer.kt:46)
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)
Caused by: java.nio.channels.UnresolvedAddressException
at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
... 12 more
2022-12-10 09:09:36 E/MahKtorAdapter[http,ws]: java.net.SocketException: Unresolved address
java.net.SocketException: Unresolved address
at java.base/sun.nio.ch.Net.translateToSocketException(Unknown Source)
at java.base/sun.nio.ch.Net.translateException(Unknown Source)
at java.base/sun.nio.ch.Net.translateException(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.ConnectUtilsJvmKt.bind(ConnectUtilsJvm.kt:32)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:46)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind(TcpSocketBuilder.kt:30)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.network.sockets.TcpSocketBuilder.bind$default(TcpSocketBuilder.kt:26)
at mirai-api-http-v2.6.2.jar[shared]//io.ktor.server.cio.backend.HttpServerKt$httpServer$acceptJob$1.invokeSuspend(HttpServer.kt:46)
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)
Caused by: java.nio.channels.UnresolvedAddressException
at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
... 12 more
2022-12-10 09:09:36 E/main: Failed to init MiraiConsole.
net.mamoe.mirai.console.plugin.loader.PluginLoadException: Exception while enabling net.mamoe.mirai-api-http
at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:311)
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:175)
at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:336)
at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:508)
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(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
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: net.mamoe.mirai.console.permission.PermissionRegistryConflictException: Conflicting Permission registry. new: PermissionImpl(id=net.mamoe.mirai-api-http:*, description='The base permission', parent=PermissionImpl(id=*:*, description='The root permission', parent=<self>)), existing: PermissionImpl(id=net.mamoe.mirai-api-http:*, description='The base permission', parent=PermissionImpl(id=*:*, description='The root permission', parent=<self>))
at net.mamoe.mirai.console.internal.permission.AbstractConcurrentPermissionService.register(AbstractConcurrentPermissionService.kt:29)
at net.mamoe.mirai.console.permission.PermissionService.register$default(PermissionService.kt:101)
at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal$parentPermission$2.invoke(JvmPluginInternal.kt:52)
at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal$parentPermission$2.invoke(JvmPluginInternal.kt:51)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.getParentPermission(JvmPluginInternal.kt:51)
at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.internalOnEnable$mirai_console(JvmPluginInternal.kt:126)
at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:305)
... 23 more
请问该如何解决?
2022-12-09 16:58:31.983 | ERROR | graia.amnesia.transport.rider:trigger_callbacks:37 - 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
File "C:\Python39\lib\site-packages\graia\amnesia\transport\common\websocket\shortcut.py", line 20, in wrapper
return await func(self, io, data)
│ │ │ └ '{"post_method":2,"meta_event_type":"lifecycle","post_type":"meta_event","self_id":2771689516,"sub_type":"connect","time":16...
│ │ └ <graia.amnesia.builtins.aiohttp.AiohttpClientWebsocketIO object at 0x000001DFF0702F40>
│ └ <WebsocketClientConnection with 2 callbacks>
└ <function WebsocketConnectionMixin. at 0x000001DFCAF88790>
File "C:\Python39\lib\site-packages\graia\ariadne\connection\ws.py", line 55, in _
data = validate_response(data, raising=False)
│ └ None
└ <function validate_response at 0x000001DFCAE55EE0>
File "C:\Python39\lib\site-packages\graia\ariadne\connection\util.py", line 57, in validate_response
return data.get("data", data)
│ └ None
└ None
按照这两篇文章安装了chrome,chromewebdriver,selenium和xvfb。
【避坑 超详细】Ubuntu使用python的selenium以及chrome模拟真实浏览器访问网页
在Ubuntu中使用Selenium Webdriver
但是启动docker报错如下:
rm: cannot remove '/tmp/.X11-unix/X1': No such file or directory
rm: cannot remove '/tmp/.X1': No such file or directory
Invalid screen configuration -nolisten
use: X [:<display>] [option]
-a # default pointer acceleration (factor)
-ac disable access control restrictions
-audit int set audit trail level
-auth file select authorization file
-br create root window with black background
+bs enable any backing store support
-bs disable any backing store support
-c turns off key-click
c # key-click volume (0-100)
-cc int default color visual class
-nocursor disable the cursor
-core generate core dump on fatal error
-displayfd fd file descriptor to write display number to when ready to connect
-dpi int screen resolution in dots per inch
-dpms disables VESA DPMS monitor control
-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs
-f # bell base (0-100)
-fc string cursor font
-fn string default font name
-fp string default font path
-help prints message with these options
+iglx Allow creating indirect GLX contexts
-iglx Prohibit creating indirect GLX contexts (default)
-I ignore all remaining arguments
-ld int limit data space to N Kb
-lf int limit number of open files to N
-ls int limit stack space to N Kb
-nolock disable the locking mechanism
-maxclients n set maximum number of clients (power of two)
-nolisten string don't listen on protocol
-listen string listen on protocol
-noreset don't reset after last client exists
-background [none] create root window with no background
-reset reset after last client exists
-p # screen-saver pattern duration (minutes)
-pn accept failure to listen on all ports
-nopn reject failure to listen on all ports
-r turns off auto-repeat
r turns on auto-repeat
-render [default|mono|gray|color] set render color alloc policy
-retro start with classic stipple and cursor
-s # screen-saver timeout (minutes)
-seat string seat to run on
-t # default pointer threshold (pixels/t)
-terminate terminate at server reset
-to # connection time out
-tst disable testing extensions
ttyxx server started from init on /dev/ttyxx
v video blanking for screen-saver
-v screen-saver without video blanking
-wm WhenMapped default backing-store
-wr create root window with white background
-maxbigreqsize set maximal bigrequest size
+xinerama Enable XINERAMA extension
-xinerama Disable XINERAMA extension
-dumbSched Disable smart scheduling and threaded input, enable old behavior
-schedInterval int Set scheduler interval in msec
-sigstop Enable SIGSTOP based startup
+extension name Enable extension
-extension name Disable extension
-query host-name contact named host for XDMCP
-broadcast broadcast for XDMCP
-multicast [addr [hops]] IPv6 multicast for XDMCP
-indirect host-name contact named host for indirect XDMCP
-port port-num UDP port number to send messages to
-from local-address specify the local address to connect from
-once Terminate server after one session
-class display-class specify display class to send in manage
-cookie xdm-auth-bits specify the magic cookie for XDMCP
-displayID display-id manufacturer display ID for request
[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]
enable/disable accessx key sequences
-ardelay set XKB autorepeat delay
-arinterval set XKB autorepeat interval
-screen scrn WxHxD set screen's width, height, depth
-pixdepths list-of-int support given pixmap depths
+/-render turn on/off RENDER extension support(default on)
-linebias n adjust thin line pixelization
-blackpixel n pixel value for black
-whitepixel n pixel value for white
-fbdir directory put framebuffers in mmap'ed files in directory
-shmem put framebuffers in shared memory
(EE)
Fatal server error:
(EE) Invalid screen configuration -nolisten for -screen 0
(EE)
Traceback (most recent call last):
File "/app/bot.py", line 18, in <module>
import chatbot
File "/app/chatbot.py", line 17, in <module>
bot = AsyncChatbot(config.openai.dict(exclude_none=True, by_alias=False), conversation_id=None, base_url=config.openai.base_url)
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 100, in __init__
self.refresh_session()
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 310, in refresh_session
self.get_cf_cookies()
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 392, in get_cf_cookies
driver = uc.Chrome(enable_cdp_events=True, options=options)
File "/usr/local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 429, in __init__
super(Chrome, self).__init__(
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
super().__init__(
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
super().__init__(
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 715, in start_session
super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:41857
from chrome not reachable
Stacktrace:
#0 0x556db87942a3 <unknown>
#1 0x556db8552dfd <unknown>
#2 0x556db854114b <unknown>
#3 0x556db857f843 <unknown>
#4 0x556db8576f89 <unknown>
#5 0x556db85b80b7 <unknown>
#6 0x556db85b7a5f <unknown>
#7 0x556db85af903 <unknown>
#8 0x556db8582ece <unknown>
#9 0x556db8583fde <unknown>
#10 0x556db87e463e <unknown>
#11 0x556db87e7b79 <unknown>
#12 0x556db87ca89e <unknown>
#13 0x556db87e8a83 <unknown>
#14 0x556db87bd505 <unknown>
#15 0x556db8809ca8 <unknown>
#16 0x556db8809e36 <unknown>
#17 0x556db8825333 <unknown>
#18 0x7fd4567b6ea7 start_thread
root@iznyaku:~# docker run --name mirai-chatgpt-bot -e XPRA_PASSWORD=xxxxxx -v /home/yaziapps/chatgpt/config.json:/app/config.json --network host lss233/chatgpt-mirai-qq-bot:latest
Waiting for xpra to startWarning: running as root
2022-12-20 01:20:44,832 Warning: cannot enable SSH socket upgrades
2022-12-20 01:20:44,832 No module named 'paramiko'
2022-12-20 01:20:44,833 created tcp socket '0.0.0.0:14500'
2022-12-20 01:20:44,838 no uinput module (not usually needed)
2022-12-20 01:20:46,144 pointer device emulation using XTest
2022-12-20 01:20:46,228 Error: cannot find the html web root
2022-12-20 01:20:46,228 '/usr/local/share/xpra/www' does not exist
2022-12-20 01:20:46,228 install thexpra-html5
package
2022-12-20 01:20:46,230 wrote pid 7 to '/tmp/99/server.pid'
2022-12-20 01:20:46,259 Warning: socket directory '/tmp/99'
2022-12-20 01:20:46,259 expected permissions 700 but found 750
2022-12-20 01:20:46,260 created unix domain socket '/run/user/1000/xpra/iznyaku-99'
2022-12-20 01:20:46,260 created unix domain socket '/tmp/99/socket'
2022-12-20 01:20:46,260 xvfb pid=12
2022-12-20 01:20:46,322 Warning: cannot watch for application menu changes without pyinotify:
2022-12-20 01:20:46,322 No module named 'pyinotify'
2022-12-20 01:20:46,330 Warning: cannot load menu data
2022-12-20 01:20:46,330 No module named 'xdg'
2022-12-20 01:20:46,394 Warning: webcam forwarding is disabled
2022-12-20 01:20:46,395 the virtual video directory '/sys/devices/virtual/video4linux' was not found
2022-12-20 01:20:46,396 make sure that the 'v4l2loopback' kernel module is installed and loaded
2022-12-20 01:20:46,396 or use the 'webcam=no' option
2022-12-20 01:20:46,397 found 0 virtual video devices for webcam forwarding
2022-12-20 01:20:46,604 1.8GB of system memory
2022-12-20 01:20:46,791 Warning: OpenGL support check failed:
2022-12-20 01:20:46,791 unknown error
2022-12-20 01:20:46,794 xpra is ready.
2022-12-20 01:20:46,794 xpra X11 seamless version 4.4.3-r0 64-bit
2022-12-20 01:20:46,795 uid=0 (root), gid=0 (root)
2022-12-20 01:20:46,795 running with pid 7 on Linux Debian 11 bullseye
2022-12-20 01:20:46,796 connected to X11 display :99 with 24 bit colors
2022-12-20 01:20:55,546 New tcp connection received
2022-12-20 01:20:55,548 from 'xxx.xxx.xxx.xxx:5920'
2022-12-20 01:20:55,548 on '0.0.0.0:14500'
2022-12-20 01:20:55.679 | INFO | chatbot::18 - 登录 OpenAI 中……
2022-12-20 01:20:55.679 | INFO | chatbot::19 - 请在新打开的浏览器窗口中完成验证
2022-12-20 01:20:55.679 | INFO | chatbot::21 - 如果您使用 xpra,请使用自己的浏览器访问 xpra 程序的端口,以访问到本程序启动的浏览器。
2022-12-20 01:21:01,186 Error: tcp connection failed:
2022-12-20 01:21:01,186 packet from xxx.xxx.xxx.xxx:5875
2022-12-20 01:21:01,186 received on 0.0.0.0:14500
2022-12-20 01:21:01,186 this packet looks like a 'http' packet
2022-12-20 01:21:01,186 http upgrades are not enabled
2022-12-20 01:21:16,550 Error: connection timed out: tcp socket: 172.24.79.186:14500 <- xxx.xxx.xxx.xxx:5920
2022-12-20 01:21:16,550 after 21 seconds
2022-12-20 01:21:16,550 sent 0 bytes
2022-12-20 01:21:16,550 received 0 bytes
无法在浏览器打开http://ip:14500,无法使用VNCviewer连接
端口已开放
部署方法:使用了第二种部署方法(已安装mirai)
登录方式:OpenAI 半自动登录
(如果用手动登录就会直接报错)
/usr/lib/python3/dist-packages/gi/overrides/Gtk.py:1649: Warning: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
return _Gtk_main(*args, **kwargs)
2022-12-20 01:26:15.340 | ERROR | chatbot::38 - cf challenge fail
Traceback (most recent call last):File "/app/bot.py", line 19, in
import chatbotFile "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removedFile "/app/chatbot.py", line 23, in
bot = AsyncChatbot(config=config.openai.dict(exclude_none=True, by_alias=False), conversation_id=None, base_url=config.openai.base_url)
│ │ │ │ │ │ └ 'https://chat.openai.com/'
│ │ │ │ │ └ OpenAISessionTokenAuth(Authorization=None, proxy=None, base_url='https://chat.openai.com/', cf_clearance=None, user_agent=Non...
│ │ │ │ └ Config(mirai=Mirai(qq=2841125587, api_key='INITKEYNR1v34o3', http_url='http://39.103.142.157:2345', ws_url='http://39.103.142...
│ │ │ └ <cyfunction BaseModel.dict at 0x7ff0a1496790>
│ │ └ OpenAISessionTokenAuth(Authorization=None, proxy=None, base_url='https://chat.openai.com/', cf_clearance=None, user_agent=Non...
│ └ Config(mirai=Mirai(qq=2841125587, api_key='INITKEYNR1v34o3', http_url='http://39.103.142.157:2345', ws_url='http://39.103.142...
└ <class 'revChatGPT.revChatGPT.AsyncChatbot'>File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 116, in init
self.refresh_session()
│ └ <function AsyncChatbot.refresh_session at 0x7ff0a02d0ee0>
└ <revChatGPT.revChatGPT.AsyncChatbot object at 0x7ff0a03ade20>
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 295, in refresh_session
asyncio.run(self.get_cf_cookies())
│ │ │ └ <function AsyncChatbot.get_cf_cookies at 0x7ff0a02d0f70>
│ │ └ <revChatGPT.revChatGPT.AsyncChatbot object at 0x7ff0a03ade20>
│ └ <function run at 0x7ff0a298bc10>
└ <module 'asyncio' from '/usr/local/lib/python3.9/asyncio/init.py'>
File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
│ │ └ <coroutine object AsyncChatbot.get_cf_cookies at 0x7ff0a05946c0>
│ └ <function BaseEventLoop.run_until_complete at 0x7ff0a21d8790>
└ <_UnixSelectorEventLoop running=False closed=True debug=False>
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
│ └ <method 'result' of '_asyncio.Task' objects>
└ <Task finished name='Task-1' coro=<AsyncChatbot.get_cf_cookies() done, defined at /usr/local/lib/python3.9/site-packages/revC...
File "/usr/local/lib/python3.9/site-packages/revChatGPT/revChatGPT.py", line 390, in get_cf_cookies
raise Exception("cf challenge fail")Exception: cf challenge fail
2022-12-20 01:26:15.346 | ERROR | chatbot::39 - OpenAI 登录失败,可能是 session_token 过期或无法通过 CloudFlare 验证,建议歇息一下再重试。
net.mamoe.mirai.network.WrongPasswordException: Error(bot=Bot(389554489), code=237, title=安全提醒, message=当前网络不稳定,登录失败。推荐使用常用设备或通过手机号登录。, errorInfo=)
at net.mamoe.mirai.internal.network.components.SsoProcessorImpl$SlowLoginImpl.doLogin(SsoProcessor.kt:309)
at net.mamoe.mirai.internal.network.components.SsoProcessorImpl$SlowLoginImpl$doLogin$1.invokeSuspend(SsoProcessor.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
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)
2022-12-12 05:18:15 I/Bot.389554489: Bot cancelled: Bot closed
2022-12-12 05:18:15 I/main: mirai-console started successfully.
这个怎么解决????
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.