Lesson 6: Run & test the bot
Start the service
From the repo root:
cd medical-appointment-bot
npm run start:dev
Swagger is live at http://localhost:8000/api.
Kick off a session
curl -X POST http://localhost:8000/ai/run \
-H 'Content-Type: application/json' \
-d '{
"message": "Hi, I need to see someone about a headache",
"flowName": "MedicalFlow",
"config": {}
}'
The JSON response contains session—save it for the next turn.
Continue the conversation
SESSION=<<paste session id>>
curl -X POST http://localhost:8000/ai/run \
-H 'Content-Type: application/json' \
-H "CHAT_SESSION_ID: $SESSION" \
-d '{
"message": "It started yesterday and is pretty sharp",
"flowName": "MedicalFlow"
}'
The engine stays in SymptomsStep until capture_symptoms fires, then jumps into BookingStep with the proposed doctors and time slots.
End the chat
curl -X POST http://localhost:8000/ai/end \
-H "CHAT_SESSION_ID: $SESSION"
You should see { "success": true, "session": "..." }. The session document is marked complete and will expire based on SESSION_EXPIRATION.
Troubleshooting tips
- Config missing? Ensure
flowNameis exactlyMedicalFlowandGEMINI_KEYis set. - Persistent sessions? Point the
.envat Mongo or Cosmos; otherwise state may be in-memory only depending on your Picoflow core config. - Model tweaks? Adjust
LLM_TEMPERATUREor swap models inChatController.registerModel.