|
import chainlit as cl |
|
import pandas as pd |
|
from datetime import datetime |
|
|
|
async def pose_objections(session_state): |
|
await cl.AskUserMessage( |
|
content="Are you ready?", timeout=300 |
|
).send() |
|
objection_chain = cl.user_session.get("objection_chain") |
|
|
|
objections = cl.user_session.get("objections") |
|
|
|
objection_responses = {} |
|
|
|
|
|
for i, objection in enumerate(objections): |
|
|
|
await cl.Message(content=f"Objection: {objection}").send() |
|
|
|
|
|
user_response = await cl.AskUserMessage( |
|
content="How would you respond to this objection?", timeout=600 |
|
).send() |
|
|
|
objection_responses[objection] = user_response['content'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
print (objection_responses) |
|
data = [] |
|
for objection, response in objection_responses.items(): |
|
data.append({ |
|
"timestamp": datetime.now(), |
|
"objection": objection, |
|
"response": response |
|
}) |
|
|
|
|
|
user_response = pd.DataFrame(data) |
|
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S') |
|
|
|
|
|
|