Please make two focused improvements to app/lia_ure.py: 1) VAGUE TIME WINDOWS – OFFER SLOTS THAT MATCH MORNING/AFTERNOON/EVENING Currently when we detect a vague time window (e.g. "Saturday morning") we always reply: "I’ve got two slots available: 1:00pm or 4:00pm." Change this so that: - If the inbound text includes "morning": offer 09:00 and 11:00. Reply body: f"No problem, {name} – that time works.\n\n" "I’ve got two slots available: 9:00am or 11:00am.\n\n" "Which would suit you better?" - If it includes "afternoon": keep 13:00 and 16:00: f"No problem, {name} – that time works.\n\n" "I’ve got two slots available: 1:00pm or 4:00pm.\n\n" "Which would suit you better?" - If it includes "evening": offer 17:30 and 19:00: f"No problem, {name} – that time works.\n\n" "I’ve got two slots available: 5:30pm or 7:00pm.\n\n" "Which would suit you better?" - If none of those words are present but it’s still a vague day/time window, fall back to the afternoon 1pm / 4pm options as today. Use body_lower to check for "morning", "afternoon", "evening". Keep the early RETURN behaviour for this branch. 2) CLEANER CONFIRMATION TEXT FOR SPECIFIC TIMES When is_specific_time(body_lower) is True, we currently echo the whole inbound_text in the confirmation, which leads to replies like: "Thanks Unknown – I’ve booked you in for What about next Wednesday at 14:00? at Lincoln Audi." Please change the confirmation message to something cleaner and future-proof, without trying to be too clever about dates yet: - Extract the raw inbound text but do NOT repeat the question words. For now, a simple and acceptable implementation is: raw_name = customer_state.get("customer_name") name = raw_name if raw_name else "there" # strip leading question words like "what about", "can i", "can do" clean_time_text = body_lower for prefix in ["what about ", "can i ", "can do ", "could i ", "how about "]: if clean_time_text.startswith(prefix): clean_time_text = clean_time_text[len(prefix):] break # re-use the original casing from inbound_text where possible by slicing, # but if that's too complex it's OK to use clean_time_text as-is. reply = ( f"Thanks {name} – I’ve booked you in for {clean_time_text.strip()} at Lincoln Audi.\n\n" "I’ll send you a reminder beforehand and let you know who your point of contact will be when you arrive.\n\n" "If anything changes, just drop me a quick message here and I’ll be happy to move it." ) Keep the existing state updates: customer_state["appointment_status"] = "BOOKED" customer_state["appointment_confirmed_text"] = inbound_text customer_state["appointment_confirmed_at"] = datetime.now(timezone.utc).isoformat() customer_state["last_message"] = inbound_text customer_state["last_reply_type"] = "APPOINTMENT_CONFIRMED" and make sure this branch still EARLY RETURNS (so no extra messages are sent after confirmation). 3) NAME FALLBACK Double-check that in both of the above branches we use: raw_name = customer_state.get("customer_name") name = raw_name if raw_name else "there" so "Unknown" never appears. After making these changes, run `python -m app.lia_ure` to ensure tests still run.