handoff fixes
This commit is contained in:
parent
3f4bcc26d9
commit
6c52cd19cb
8 changed files with 561 additions and 59 deletions
|
|
@ -264,13 +264,23 @@ async def get_handoff_conversation(
|
|||
sender_address = (message.get("sender") or {}).get("address", "").lower()
|
||||
role = "human" if sender_address == human_email else "agent"
|
||||
event_at = row.get("event_at") or message.get("received_at") or message.get("sent_at") or message["created_at"]
|
||||
raw_body = message.get("raw_body")
|
||||
new_reply_content = message.get("new_reply_content")
|
||||
display_body = new_reply_content or message.get("body_text", "")
|
||||
messages.append(
|
||||
HandoffMessageRead(
|
||||
id=str(message["_id"]),
|
||||
role=role,
|
||||
subject=message.get("subject", ""),
|
||||
snippet=message.get("snippet", ""),
|
||||
body_text=message.get("body_text", ""),
|
||||
snippet=message.get("snippet", "") or display_body[:240],
|
||||
body_text=display_body,
|
||||
new_reply_content=new_reply_content,
|
||||
raw_body=raw_body,
|
||||
has_quoted_text=bool(
|
||||
raw_body
|
||||
and new_reply_content
|
||||
and raw_body.strip() != new_reply_content.strip()
|
||||
),
|
||||
event_at=event_at,
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue