|
@@ -406,8 +406,8 @@ async def make_anchor_video_eng(req:models.request_eng):
|
|
|
x.start()
|
|
|
return {"msg":"ok"}
|
|
|
|
|
|
-@app.get("/history_input")
|
|
|
-async def history_input(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+@app.get("/history_input_old")
|
|
|
+async def history_input_old(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
Authorize.jwt_required()
|
|
|
current_user = Authorize.get_jwt_subject()
|
|
|
|
|
@@ -421,6 +421,22 @@ async def history_input(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
return logs
|
|
|
|
|
|
|
|
|
+@app.get("/history_input")
|
|
|
+async def history_input(token: str = Depends(oauth2_scheme)):
|
|
|
+ Authorize.jwt_required()
|
|
|
+ current_user = Authorize.get_jwt_subject()
|
|
|
+
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
+ user_id = get_user_id(token)
|
|
|
+ user_obj = first(db.query('SELECT * FROM users where id ="'+str(user_id)+'"'))
|
|
|
+ statement = 'SELECT * FROM history_input WHERE user_id="'+str(user_id)+'" ORDER BY timestamp DESC LIMIT 50'
|
|
|
+
|
|
|
+ logs = []
|
|
|
+ for row in db.query(statement):
|
|
|
+ logs.append({'id':row['id'],'name':row['name'],'text_content':row['text_content'].split(','),'link':row['link'],'image_urls':row['image_urls'].split(',')})
|
|
|
+ return logs
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@AuthJWT.load_config
|
|
|
def get_config():
|