feat: 设置 ws_max_size 为 100MB,支持大消息转发

pull/1477/head
墨梓柒 2026-01-03 14:33:05 +08:00
parent 5ecdf1c53d
commit 25a44cc065
No known key found for this signature in database
GPG Key ID: 4A65B9DBA35F7635
1 changed files with 9 additions and 1 deletions

View File

@ -50,7 +50,15 @@ class Server:
async def run(self):
"""启动服务器"""
# 禁用 uvicorn 默认日志和访问日志
config = Config(app=self.app, host=self._host, port=self._port, log_config=None, access_log=False)
# 设置 ws_max_size 为 100MB支持大消息如包含多张图片的转发消息
config = Config(
app=self.app,
host=self._host,
port=self._port,
log_config=None,
access_log=False,
ws_max_size=104_857_600, # 100MB
)
self._server = UvicornServer(config=config)
try:
await self._server.serve()