I am Roitium (or yanyao2333, whatever), a self taught developer.
Coding with ❤
bilibili人形自走bot
License: MIT License
requirements.txt中bilibili-api-python依赖替换成bilibili-api-dev就可以了。这个项目分支解决了这个问题,开发者的代码少了个右括号
收不到@以及私信的触发方式是什么
最近闲下来了,看下下代码,好多都重构了,是还在重构中嘛?
把代码clone下来,好几个地方都在报错。好几处bug。
针对 gpt3.5 和 gpt4单独优化 prompt,尽可能达到更高准确率
提示:ModuleNotFoundError: No module named 'whisper'
发现两个问题:
1-同一个视频要第二次at才会发送评论、首次at只会写进缓存不会发送评论,第二次之后的at就去缓存读取数据发送了。
2-评论发送成功,调用发送评论接口成功了,拿到正确的响应,但是视频的评论中没有这条评论,不知道是不是阿b秒删,还是程序问题。
目前遇到几个问题:
第一个报错:
Job "Session.run.<locals>.qurey (trigger: interval[0:00:06], next run at: 2024-02-17 14:49:17 CST)" raised an exception Traceback (most recent call last): File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\apscheduler\executors\base_py3.py", line 30, in run_coroutine_job retval = await job.func(*job.args, **job.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\session.py", line 502, in qurey js: dict = await new_sessions(self.credential, self.maxTs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\session.py", line 79, in new_sessions return await Api(**api, credential=credential).update_params(**params).result ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\utils\network.py", line 273, in result self.__result = await self.request() ^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\utils\network.py", line 173, in inner return await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\bilibili_api\utils\network.py", line 553, in request async with session.request(**config) as resp: File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\client.py", line 1194, in __aenter__ self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\client.py", line 605, in _request await resp.start(conn) File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\client_reqrep.py", line 966, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "E:\biliGPT\v3\BiliGPTHelper\venv\Lib\site-packages\aiohttp\streams.py", line 622, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。
项目启动之后会一直循环报这个错,疑似新版bilibiliapi的问题?
第二个报错:bili_linsten.py文件中
for item in reversed(data["items"]): if item["at_time"] > self.last_at_time: _LOGGER.debug(f"at_time{item['at_time']}大于last_at_time{self.last_at_time},放入新消息队列") item["user"] = data["items"]["user"] new_items.append(item)
item["user"] = data["items"]["user"] 这行代码应该注释掉吧?不然逻辑不通,不注释也会报错。
第三个报错:bili_linsten.py文件中
原代码:
`async def build_task_from_at_msg(self, msg: dict) -> BiliGPTTask | None:
try:
event = deepcopy(msg)
if msg["type"] != "reply" or msg["business_id"] != 1:
_LOGGER.warning("不是回复消息,跳过")
return None
elif msg["item"]["root_id"] == 0 and msg["item"]["target_id"] == 0:
_LOGGER.warning("该消息是楼中楼消息,暂时不受支持,跳过处理")
return None
event["source_type"] = "bili_comment"
event["raw_task_data"] = deepcopy(msg)
event["source_extra_attr"] = BiliAtSpecialAttributes.model_validate(event)
event["sender_id"] = event["user"]["mid"]
event["video_url"] = event["uri"]
event["source_command"] = event["source_content"]
event["video_id"] = await BiliVideo(url=event["uri"]).bvid
task_metadata = BiliGPTTask.model_validate(event)
except Exception:
traceback.print_exc()
_LOGGER.error("在验证任务数据结构时出现错误,跳过处理!")
return None
return task_metadata`
本地修改后:
` async def build_task_from_at_msg(self, msg: dict) -> BiliGPTTask | None:
try:
event = deepcopy(msg)
if msg["item"]["type"] != "reply" or msg["item"]["business_id"] != 1:
_LOGGER.warning("不是回复消息,跳过")
return None
elif msg["item"]["root_id"] != 0 or msg["item"]["target_id"] != 0:
_LOGGER.warning("该消息是楼中楼消息,暂时不受支持,跳过处理")
return None
event["source_type"] = "bili_comment"
event["raw_task_data"] = deepcopy(msg)
event["source_extra_attr"] = BiliAtSpecialAttributes.model_validate(event["item"])
event["sender_id"] = str(event["user"]["mid"])
event["video_url"] = event["item"]["uri"]
event["source_command"] = event["item"]["source_content"]
event["video_id"] = await BiliVideo(credential=self.credential, url=event["item"]["uri"]).bvid
task_metadata = BiliGPTTask.model_validate(event)
except Exception as e:
traceback.print_exc()
_LOGGER.error(e)
_LOGGER.error("在验证任务数据结构时出现错误,跳过处理!")
return None
return task_metadata`
这个是我本地修改之后的代码,第二个问题的循环结束后会调用这个方法,参数是new_items循环的item
结合上面的逻辑所以好几处的值都是在event['item']中,楼中楼的判断值不等0才是。
但是修改完后执行到event["video_id"] = await BiliVideo(credential=self.credential, url=event["item"]["uri"]).bvid的时候直接捕获异常了,提示请求超时。
以上是遇到的几个问题,能启动,但是跑不通。都是在调用bilibliapi时报错,不知道是新版本的api问题还是账号问题,晚些换个账号再测试下。不清楚你的逻辑,上述问题是否存在我所说的bug,如是,我晚些提个PR
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.