codeBOKER commited on
Commit
70e9894
Β·
1 Parent(s): d5e3877

switch to driver immediately if account exists; only ask name on first time

Browse files

- prompts/system_new_user.md: try switch_to_driver first, only collect
name on error (no account yet)
- prompts/system_passenger.md: same fix β€” previously told AI to always
ask for name before switching

prompts/system_new_user.md CHANGED
@@ -1,3 +1,3 @@
1
  Welcome new sender. Ask: travel as passenger (search/book) or work as driver (publish trips)?
2
  - To travel: switch_to_passenger (name optional, ask only if offered). Don't ask name before switching.
3
- - To drive: collect full name -> create_driver_account(name) -> switch_to_driver. Never call switch_to_driver before account exists.
 
1
  Welcome new sender. Ask: travel as passenger (search/book) or work as driver (publish trips)?
2
  - To travel: switch_to_passenger (name optional, ask only if offered). Don't ask name before switching.
3
+ - To drive: try switch_to_driver. If no account exists (error), collect full name -> create_driver_account(name) -> switch_to_driver.
prompts/system_passenger.md CHANGED
@@ -1,6 +1,6 @@
1
  - search_trips as soon as the user mentions a departure or destination. You do not need all details β€” the tool accepts partial info. Only ask a follow-up if neither departure nor destination was mentioned.
2
  - When search_trips finds matches, trip cards are sent to the user automatically along with a prompt to choose one. Do NOT add any text after calling search_trips β€” the tool will handle the response.
3
- - When the user replies to a trip card, immediately call create_booking_lead β€” trip_id is auto-detected and seats default to 1. Do not ask for seat count or other details.
4
- - Booking leads are pending β€” seats not reserved.
5
- - After successful create_booking_lead, tell the passenger the driver's phone number from driver_phone so they can contact the driver directly.
6
- - To drive: switch_to_driver. If no account: name -> create_driver_account -> switch_to_driver. Never before account exists.
 
1
  - search_trips as soon as the user mentions a departure or destination. You do not need all details β€” the tool accepts partial info. Only ask a follow-up if neither departure nor destination was mentioned.
2
  - When search_trips finds matches, trip cards are sent to the user automatically along with a prompt to choose one. Do NOT add any text after calling search_trips β€” the tool will handle the response.
3
+ - When the user replies to a trip card, immediately call select_trip β€” trip_id is auto-detected and seats default to 1. Do not ask for seat count or other details.
4
+ - Selections are not reservations β€” seats are not held.
5
+ - After successful select_trip, tell the passenger the driver's phone number from driver_phone so they can contact the driver directly to arrange the booking.
6
+ - To drive: try switch_to_driver. If no account exists (error), collect full name -> create_driver_account(name) -> switch_to_driver.
supabase/migrations/202607060001_rename_booking_to_selections.sql ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- rename booking_leads table to trip_selections
2
+ alter table if exists public.booking_leads
3
+ rename to trip_selections;
4
+
5
+ -- drop old check constraint
6
+ alter table public.trip_selections
7
+ drop constraint if exists booking_leads_status_check;
8
+
9
+ -- migrate existing 'confirmed' rows to 'pending' (no confirmation flow anymore)
10
+ update public.trip_selections
11
+ set status = 'pending'
12
+ where status = 'confirmed';
13
+
14
+ -- add new constraint without 'confirmed'
15
+ alter table public.trip_selections
16
+ add constraint trip_selections_status_check
17
+ check (status in ('pending', 'cancelled'));
18
+
19
+ -- rename indexes
20
+ drop index if exists public.idx_booking_leads_customer;
21
+ create index idx_trip_selections_customer
22
+ on public.trip_selections(customer_id, created_at desc);
23
+
24
+ drop index if exists public.idx_booking_leads_trip;
25
+ create index idx_trip_selections_trip
26
+ on public.trip_selections(trip_id, created_at desc);
27
+
28
+ -- rename trigger
29
+ drop trigger if exists set_booking_leads_updated_at on public.trip_selections;
30
+ create trigger set_trip_selections_updated_at
31
+ before update on public.trip_selections
32
+ for each row execute function public.set_updated_at();
33
+
34
+ -- rename rls
35
+ alter table public.trip_selections enable row level security;