Skip to content

Commit

Permalink
dev: Add a step to watch claim update in real time
Browse files Browse the repository at this point in the history
Plus, save more often the schema in the DB allowing these demos to be more "real-time".
  • Loading branch information
clemlesne committed Jan 16, 2024
1 parent 35e3ccb commit 840c898
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,11 @@ eventgrid-register:
--max-delivery-attempts 8 \
--name $(name) \
--source-resource-id $(source)

watch-call:
@echo "👀 Watching status of $(phone_number)..."
while true; do \
clear; \
curl -s "$(endpoint)/call?phone_number=%2B$(phone_number)" | yq --prettyPrint '.[0] | {"phone_number": .phone_number, "claim": .claim, "reminders": .reminders}'; \
sleep 3; \
done
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,16 @@ async def intelligence(call: CallModel, client: CallConnectionClient) -> None:
IndentAction.UPDATED_CLAIM,
IndentAction.NEW_OR_UPDATED_REMINDER,
):
# Answer with intermediate response
await handle_play(
call=call,
client=client,
store=False,
text=chat_res.content,
)
# Save in DB allowing demos to be more "real-time"
await save_call(call)
# Recursively call intelligence to continue the conversation
await intelligence(call, client)

else:
Expand Down

0 comments on commit 840c898

Please sign in to comment.