mirror of
https://github.com/github/awesome-copilot.git
synced 2026-03-20 08:05:12 +00:00
Fix ImportError: SessionEventType not exported from copilot public API (#1093)
* Initial plan * Fix ImportError: remove SessionEventType from copilot imports, use string comparisons Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/awesome-copilot/sessions/0c514b95-5157-4aa9-8590-cbf3fd337472 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
This commit is contained in:
@@ -36,7 +36,7 @@ python accessibility_report.py
|
||||
import asyncio
|
||||
from copilot import (
|
||||
CopilotClient, SessionConfig, MessageOptions,
|
||||
SessionEvent, SessionEventType,
|
||||
SessionEvent,
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
@@ -80,7 +80,7 @@ async def main():
|
||||
|
||||
# Set up streaming event handling
|
||||
def handle_event(event: SessionEvent):
|
||||
if event.type == SessionEventType.ASSISTANT_MESSAGE_DELTA:
|
||||
if event.type.value == "assistant.message_delta":
|
||||
print(event.data.delta_content or "", end="", flush=True)
|
||||
elif event.type.value == "session.idle":
|
||||
done.set()
|
||||
@@ -198,7 +198,7 @@ Unlike `send_and_wait`, this recipe uses streaming for real-time output:
|
||||
|
||||
```python
|
||||
def handle_event(event: SessionEvent):
|
||||
if event.type == SessionEventType.ASSISTANT_MESSAGE_DELTA:
|
||||
if event.type.value == "assistant.message_delta":
|
||||
print(event.data.delta_content or "", end="", flush=True)
|
||||
elif event.type.value == "session.idle":
|
||||
done.set()
|
||||
|
||||
Reference in New Issue
Block a user