ソースを参照

fix progres bar and limit histry query

ming 3 年 前
コミット
92da35241a
1 ファイル変更3 行追加2 行削除
  1. 3 2
      main.py

+ 3 - 2
main.py

@@ -83,7 +83,7 @@ class ConnectionManager:
             await connection.send_text(message)
 
 
-manager = ConnectionManager()
+
 
 @app.get("/")
 async def root():
@@ -181,6 +181,7 @@ async def make_anchor_video_v33(req:request):
 
 @app.websocket("/progress")
 async def websocket_endpoint(websocket: WebSocket):
+    manager = ConnectionManager()
     await manager.connect(websocket)
     try:
         while True:
@@ -194,7 +195,7 @@ async def history_input():
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
     statement = 'SELECT * FROM history_input ORDER BY timestamp DESC'
     logs = []
-    for row in db.query(statement):
+    for row in db.query(statement)[:50]:
         logs.append({'id':row['id'],'name':row['name'],'text_content':row['text_content'].split(','),'image_urls':row['image_urls'].split(',')})
     return logs