ソースを参照

fix progres bar and limit histry query

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

+ 2 - 2
main.py

@@ -193,9 +193,9 @@ async def websocket_endpoint(websocket: WebSocket):
 @app.get("/history_input")
 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'
+    statement = 'SELECT * FROM history_input ORDER BY timestamp DESC LIMIT 50'
     logs = []
-    for row in db.query(statement)[:50]:
+    for row in db.query(statement):
         logs.append({'id':row['id'],'name':row['name'],'text_content':row['text_content'].split(','),'image_urls':row['image_urls'].split(',')})
     return logs