main
zc 1 month ago
parent c175830cad
commit 619a24bee5
  1. 12
      app/api/chat/ai/chat_router.py

@ -90,7 +90,7 @@ async def h5_chat_stream(request: Request, inp: ChatIn, redis_client = Depends(g
# 获取开启的前4个问题(包含标题和内容) # 获取开启的前4个问题(包含标题和内容)
questions = await QuickQuestion.filter(status="0", ischat="0").order_by("order_num").limit(4).values("title", questions = await QuickQuestion.filter(status="0", ischat="0").order_by("order_num").limit(4).values("title",
"subtitle", "subtitle",
"content") "content")
question_titles = [f"{q['subtitle']}{q['title']}" for q in questions] question_titles = [f"{q['subtitle']}{q['title']}" for q in questions]
@ -292,7 +292,7 @@ async def get_question(request: Request, req: AllScenicFlowRequest, redis_client
result = { result = {
"code": 200, "code": 200,
"message": "查询成功", "message": "查询成功",
"data": questions "data": json.loads(questions)
} }
# 将结果存入Redis缓存,过期时间10分钟 # 将结果存入Redis缓存,过期时间10分钟
@ -359,7 +359,7 @@ async def get_hot_questions(request: Request, req: AllScenicFlowRequest, redis_c
result = { result = {
"code": 200, "code": 200,
"message": "查询成功", "message": "查询成功",
"data": hot_questions "data": json.loads(hot_questions)
} }
# 将结果存入Redis缓存,过期时间10分钟 # 将结果存入Redis缓存,过期时间10分钟
@ -408,7 +408,7 @@ async def get_all_scenic_flow(request: Request, req: AllScenicFlowRequest, redis
return { return {
"code": 200, "code": 200,
"message": "查询成功", "message": "查询成功",
"data": data "data": json.loads(data)
} }
except Exception as e: except Exception as e:
print(f"查询所有景区客流数据异常: {e}") print(f"查询所有景区客流数据异常: {e}")
@ -497,7 +497,7 @@ async def get_scenic_detail(request: Request, req: ScenicDetailRequest, redis_cl
return { return {
"code": 200, "code": 200,
"message": "查询成功", "message": "查询成功",
"data": data "data": json.loads(data)
} }
except Exception as e: except Exception as e:
print(f"查询景区详情异常: {e}") print(f"查询景区详情异常: {e}")
@ -556,7 +556,7 @@ async def get_scenic_parking(request: Request, req: ScenicParkingRequest, redis_
return { return {
"code": 200, "code": 200,
"message": "查询成功", "message": "查询成功",
"data": data "data": json.loads(data)
} }
except Exception as e: except Exception as e:
print(f"查询景区停车场数据异常: {e}") print(f"查询景区停车场数据异常: {e}")

Loading…
Cancel
Save