Spaces:
Sleeping
Sleeping
OnlyBiggg
commited on
Commit
·
5cc7ddc
1
Parent(s):
aa8057a
fix: seat
Browse files
app/dialogflow/api/v1/dialogflow.py
CHANGED
@@ -378,6 +378,7 @@ async def seats_trip(request: Request) -> Response:
|
|
378 |
trip_id = int(trip["id"]) if trip else None
|
379 |
seats = await dialog_service.seats_trip(route_id, trip_id, departure_date, departure_time, kind)
|
380 |
seats_empty = [ seat for seat in seats if seat["bookStatus"] == 0 ]
|
|
|
381 |
text=["Vui lòng chọn ghế"]
|
382 |
payload={
|
383 |
"richContent": [
|
@@ -591,7 +592,21 @@ async def response_ticket_info(request: Request) -> Response:
|
|
591 |
Tổng tiền lượt đi {price} VND
|
592 |
"""
|
593 |
]
|
594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
|
596 |
|
597 |
@router.get("/")
|
|
|
378 |
trip_id = int(trip["id"]) if trip else None
|
379 |
seats = await dialog_service.seats_trip(route_id, trip_id, departure_date, departure_time, kind)
|
380 |
seats_empty = [ seat for seat in seats if seat["bookStatus"] == 0 ]
|
381 |
+
seats_empty.sort(key=lambda x: x["chair"])
|
382 |
text=["Vui lòng chọn ghế"]
|
383 |
payload={
|
384 |
"richContent": [
|
|
|
592 |
Tổng tiền lượt đi {price} VND
|
593 |
"""
|
594 |
]
|
595 |
+
|
596 |
+
payload={
|
597 |
+
"richContent": [
|
598 |
+
[
|
599 |
+
{
|
600 |
+
"type": "chips",
|
601 |
+
"options": [
|
602 |
+
{"text": "Đặt vé"},
|
603 |
+
{"text": "Không, cảm ơn"}
|
604 |
+
]
|
605 |
+
}
|
606 |
+
]
|
607 |
+
]
|
608 |
+
}
|
609 |
+
return DialogFlowResponseAPI(text=text, payload=payload)
|
610 |
|
611 |
|
612 |
@router.get("/")
|
app/dialogflow/services/dialog_service.py
CHANGED
@@ -113,7 +113,7 @@ class DialogService:
|
|
113 |
pickup_list = []
|
114 |
|
115 |
for pickup in data:
|
116 |
-
if pickup["type"] == 0 or
|
117 |
pickup_list.append(pickup)
|
118 |
return pickup_list
|
119 |
|
|
|
113 |
pickup_list = []
|
114 |
|
115 |
for pickup in data:
|
116 |
+
if pickup["type"] == 0 or pickup["type"] == -1:
|
117 |
pickup_list.append(pickup)
|
118 |
return pickup_list
|
119 |
|