删除多余代码
This commit is contained in:
parent
28cfe06155
commit
d661cad5ca
5
main.py
5
main.py
@ -29,10 +29,6 @@ class ConnectionManager:
|
||||
async def send_personal_message(message: str, websocket: WebSocket):
|
||||
await websocket.send_text(message)
|
||||
|
||||
async def broadcast(self, message: str):
|
||||
for connection in self.active_connections:
|
||||
await connection.send_text(message)
|
||||
|
||||
async def broadcast_json(self, data: dict):
|
||||
for connection in self.active_connections:
|
||||
await connection.send_json(data)
|
||||
@ -94,7 +90,6 @@ async def predict(file: UploadFile = File(...)):
|
||||
if content:
|
||||
yield content
|
||||
# 同时将内容广播给所有WebSocket连接的客户端
|
||||
# await manager.broadcast(content)
|
||||
await manager.broadcast_json({"type": "text", "content": content})
|
||||
|
||||
return StreamingResponse(stream_response(), media_type="text/plain")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user