(event: SessionEventTypeAlias)
| 1611 | first_assistant_message_logged = False |
| 1612 | |
| 1613 | def handler(event: SessionEventTypeAlias) -> None: |
| 1614 | nonlocal first_assistant_message_logged, last_assistant_message, error_event |
| 1615 | match event.data: |
| 1616 | case AssistantMessageData(): |
| 1617 | last_assistant_message = event |
| 1618 | if not first_assistant_message_logged: |
| 1619 | first_assistant_message_logged = True |
| 1620 | log_timing( |
| 1621 | logger, |
| 1622 | logging.DEBUG, |
| 1623 | "CopilotSession.send_and_wait first assistant message", |
| 1624 | total_start, |
| 1625 | session_id=self.session_id, |
| 1626 | ) |
| 1627 | case SessionIdleData(): |
| 1628 | log_timing( |
| 1629 | logger, |
| 1630 | logging.DEBUG, |
| 1631 | "CopilotSession.send_and_wait idle received", |
| 1632 | total_start, |
| 1633 | session_id=self.session_id, |
| 1634 | ) |
| 1635 | idle_event.set() |
| 1636 | case SessionErrorData() as data: |
| 1637 | error_event = Exception(f"Session error: {data.message or str(data)}") |
| 1638 | idle_event.set() |
| 1639 | |
| 1640 | unsubscribe = self.on(handler) |
| 1641 | try: |
nothing calls this directly
no test coverage detected