chore: Update vehicle destination in calculate_route function
Browse files- kitt.py +3 -3
- skills/common.py +4 -4
- skills/poi.py +1 -1
kitt.py
CHANGED
@@ -154,7 +154,7 @@ def calculate_route_gradio(origin, destination):
|
|
154 |
|
155 |
def update_vehicle_status(trip_progress):
|
156 |
n_points = len(global_context["route_points"])
|
157 |
-
new_coords = global_context["route_points"][
|
158 |
new_coords = new_coords["latitude"], new_coords["longitude"]
|
159 |
print(f"Trip progress: {trip_progress}, len: {n_points}, new_coords: {new_coords}")
|
160 |
vehicle.location_coordinates = new_coords
|
@@ -225,10 +225,10 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
225 |
)
|
226 |
voice_character = gr.Radio(choices=voice_options, label='Choose a voice', value=voice_options[0], show_label=True)
|
227 |
origin = gr.Textbox(
|
228 |
-
value="
|
229 |
)
|
230 |
destination = gr.Textbox(
|
231 |
-
value="
|
232 |
label="Destination",
|
233 |
interactive=True,
|
234 |
)
|
|
|
154 |
|
155 |
def update_vehicle_status(trip_progress):
|
156 |
n_points = len(global_context["route_points"])
|
157 |
+
new_coords = global_context["route_points"][min(int(trip_progress / 100 * n_points), n_points - 1)]
|
158 |
new_coords = new_coords["latitude"], new_coords["longitude"]
|
159 |
print(f"Trip progress: {trip_progress}, len: {n_points}, new_coords: {new_coords}")
|
160 |
vehicle.location_coordinates = new_coords
|
|
|
225 |
)
|
226 |
voice_character = gr.Radio(choices=voice_options, label='Choose a voice', value=voice_options[0], show_label=True)
|
227 |
origin = gr.Textbox(
|
228 |
+
value="Rue Alphonse Weicker, Luxembourg", label="Origin", interactive=True
|
229 |
)
|
230 |
destination = gr.Textbox(
|
231 |
+
value="Luxembourg Gare, Luxembourg",
|
232 |
label="Destination",
|
233 |
interactive=True,
|
234 |
)
|
skills/common.py
CHANGED
@@ -54,9 +54,9 @@ def extract_func_args(text: str) -> tuple[str, dict]:
|
|
54 |
config = Settings() # type: ignore
|
55 |
|
56 |
vehicle = VehicleStatus(
|
57 |
-
location="
|
58 |
-
location_coordinates=(49.
|
59 |
-
date="2025-
|
60 |
time="08:00:20",
|
61 |
-
destination="
|
62 |
)
|
|
|
54 |
config = Settings() # type: ignore
|
55 |
|
56 |
vehicle = VehicleStatus(
|
57 |
+
location="Rue Alphonse Weicker, Luxembourg",
|
58 |
+
location_coordinates=(49.63324, 6.169),
|
59 |
+
date="2025-05-07",
|
60 |
time="08:00:20",
|
61 |
+
destination="Luxembourg Gare, Luxembourg"
|
62 |
)
|
skills/poi.py
CHANGED
@@ -43,7 +43,7 @@ def search_points_of_interests(search_query="french restaurant"):
|
|
43 |
return "No results found in the vicinity."
|
44 |
|
45 |
# Sort the results based on distance
|
46 |
-
|
47 |
# print(sorted_results)
|
48 |
|
49 |
# Format and limit to top 5 results
|
|
|
43 |
return "No results found in the vicinity."
|
44 |
|
45 |
# Sort the results based on distance
|
46 |
+
results = sorted(results, key=lambda x: x["dist"])
|
47 |
# print(sorted_results)
|
48 |
|
49 |
# Format and limit to top 5 results
|