feat(flow): handle 'Choose Another Date' with AI date parsing

Added g4t (tomorrow), g4c (custom date) groups. Custom date asks
patient to type a date, AI block parses it to YYYY-MM-DD. Three
condition branches now: tomorrow, day_after, other.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 19:32:31 +05:30
parent 9ee087b898
commit 300fff25c1

View File

@@ -145,9 +145,16 @@
"type": "condition", "type": "condition",
"conditions": [ "conditions": [
{ "id": "c3", "variableId": "dateChoice", "operator": "contains", "value": "tomorrow" }, { "id": "c3", "variableId": "dateChoice", "operator": "contains", "value": "tomorrow" },
{ "id": "c4", "variableId": "dateChoice", "operator": "contains", "value": "day_after" } { "id": "c4", "variableId": "dateChoice", "operator": "contains", "value": "day_after" },
{ "id": "c7", "variableId": "dateChoice", "operator": "contains", "value": "other" }
] ]
}, }
]
},
{
"id": "g4t",
"title": "Date - Tomorrow",
"blocks": [
{ {
"id": "b14", "id": "b14",
"type": "set_variable", "type": "set_variable",
@@ -170,6 +177,33 @@
} }
] ]
}, },
{
"id": "g4c",
"title": "Date - Custom",
"blocks": [
{
"id": "b15a",
"type": "message",
"content": {
"format": "text",
"text": "Please type your preferred date (e.g., April 25 or 25/04/2026)."
}
},
{
"id": "b15b",
"type": "input",
"inputType": "text",
"variableId": "customDateText"
},
{
"id": "b15c",
"type": "ai",
"prompt": "The patient typed this date: \"{{customDateText}}\". Convert it to YYYY-MM-DD format. The current year is 2026. Reply with ONLY the date in YYYY-MM-DD format, nothing else.",
"outputVariableId": "selectedDate",
"sendToPatient": false
}
]
},
{ {
"id": "g5", "id": "g5",
"title": "Slot Selection", "title": "Slot Selection",
@@ -316,10 +350,12 @@
{ "id": "e2", "from": { "blockId": "b4", "conditionId": "c2" }, "to": { "groupId": "g10" } }, { "id": "e2", "from": { "blockId": "b4", "conditionId": "c2" }, "to": { "groupId": "g10" } },
{ "id": "e3", "from": { "blockId": "b7" }, "to": { "groupId": "g3" } }, { "id": "e3", "from": { "blockId": "b7" }, "to": { "groupId": "g3" } },
{ "id": "e4", "from": { "blockId": "b10" }, "to": { "groupId": "g4" } }, { "id": "e4", "from": { "blockId": "b10" }, "to": { "groupId": "g4" } },
{ "id": "e5", "from": { "blockId": "b13", "conditionId": "c3" }, "to": { "groupId": "g5" } }, { "id": "e5", "from": { "blockId": "b13", "conditionId": "c3" }, "to": { "groupId": "g4t" } },
{ "id": "e6", "from": { "blockId": "b13", "conditionId": "c4" }, "to": { "groupId": "g4a" } }, { "id": "e6", "from": { "blockId": "b13", "conditionId": "c4" }, "to": { "groupId": "g4a" } },
{ "id": "e6a", "from": { "blockId": "b13", "conditionId": "c7" }, "to": { "groupId": "g4c" } },
{ "id": "e7", "from": { "blockId": "b14" }, "to": { "groupId": "g5" } }, { "id": "e7", "from": { "blockId": "b14" }, "to": { "groupId": "g5" } },
{ "id": "e8", "from": { "blockId": "b15" }, "to": { "groupId": "g5" } }, { "id": "e8", "from": { "blockId": "b15" }, "to": { "groupId": "g5" } },
{ "id": "e8a", "from": { "blockId": "b15c" }, "to": { "groupId": "g5" } },
{ "id": "e9", "from": { "blockId": "b17a" }, "to": { "groupId": "g6" } }, { "id": "e9", "from": { "blockId": "b17a" }, "to": { "groupId": "g6" } },
{ "id": "e10", "from": { "blockId": "b19" }, "to": { "groupId": "g7" } }, { "id": "e10", "from": { "blockId": "b19" }, "to": { "groupId": "g7" } },
{ "id": "e11", "from": { "blockId": "b22", "conditionId": "c5" }, "to": { "groupId": "g8" } }, { "id": "e11", "from": { "blockId": "b22", "conditionId": "c5" }, "to": { "groupId": "g8" } },