codeBOKER commited on
Commit
7629a0e
·
1 Parent(s): fcf2812

block drivers from editing trip departure_date

Browse files

- remove departure_date from update_trip_field enum
- remove departure_date handling in _build_trip_field_update
- update tool descriptions to warn model date is immutable

Files changed (2) hide show
  1. app/ai/tool_schemas.py +3 -4
  2. app/tools/handlers.py +0 -6
app/ai/tool_schemas.py CHANGED
@@ -275,7 +275,7 @@ _UPDATE_TRIP_FIELD = {
275
  "type": "function",
276
  "function": {
277
  "name": "update_trip_field",
278
- "description": "Update one field on the trip the driver is editing. trip_id from active session.",
279
  "parameters": {
280
  "type": "object",
281
  "properties": {
@@ -284,7 +284,6 @@ _UPDATE_TRIP_FIELD = {
284
  "enum": [
285
  "departure",
286
  "destination",
287
- "departure_date",
288
  "departure_time",
289
  "pickup_time",
290
  "vehicle_type",
@@ -292,11 +291,11 @@ _UPDATE_TRIP_FIELD = {
292
  "total_seats",
293
  "price",
294
  ],
295
- "description": "Trip field to update.",
296
  },
297
  "value": {
298
  "type": "string",
299
- "description": "New value. Dates YYYY-MM-DD, time HH:MM, routes Arabic, seats/price digits.",
300
  },
301
  },
302
  "required": ["field", "value"],
 
275
  "type": "function",
276
  "function": {
277
  "name": "update_trip_field",
278
+ "description": "Update one field on the trip the driver is editing. trip_id from active session. Note: departure_date cannot be changed once the trip is created.",
279
  "parameters": {
280
  "type": "object",
281
  "properties": {
 
284
  "enum": [
285
  "departure",
286
  "destination",
 
287
  "departure_time",
288
  "pickup_time",
289
  "vehicle_type",
 
291
  "total_seats",
292
  "price",
293
  ],
294
+ "description": "Trip field to update. departure_date is not allowed.",
295
  },
296
  "value": {
297
  "type": "string",
298
+ "description": "New value. time HH:MM, routes Arabic, seats/price digits. Do NOT include date — departure_date cannot be changed.",
299
  },
300
  },
301
  "required": ["field", "value"],
app/tools/handlers.py CHANGED
@@ -772,12 +772,6 @@ class FalsaToolHandlers:
772
  if field in {"departure", "destination"}:
773
  return {field: value}, None
774
 
775
- if field == "departure_date":
776
- parsed_date = _parse_date_value(value)
777
- if not parsed_date:
778
- return {}, "departure_date must be YYYY-MM-DD"
779
- return {"departure_date": parsed_date.isoformat()}, None
780
-
781
  if field in {"departure_time", "pickup_time"}:
782
  bucket = normalize_departure_bucket(value)
783
  if not bucket:
 
772
  if field in {"departure", "destination"}:
773
  return {field: value}, None
774
 
 
 
 
 
 
 
775
  if field in {"departure_time", "pickup_time"}:
776
  bucket = normalize_departure_bucket(value)
777
  if not bucket: