mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-11-28 05:00:26 +08:00
Massive PR, over 13k LOC updated, 128 commits to implement the first pass at the new Wave AI panel. Two backend adapters (OpenAI and Anthropic), layout changes to support the panel, keyboard shortcuts, and a huge focus/layout change to integrate the panel seamlessly into the UI. Also fixes some small issues found during the Wave AI journey (zoom fixes, documentation, more scss removal, circular dependency issues, settings, etc)
1.4 KiB
1.4 KiB
For just text streaming, you only need to handle these 3 core events:
Essential Events
1. response.created
{
"type": "response.created",
"response": {
"id": "resp_abc123",
"created_at": 1640995200,
"model": "gpt-5"
}
}
Purpose: Initialize response tracking (like Anthropic's message_start)
2. response.output_text.delta
{
"type": "response.output_text.delta",
"item_id": "msg_abc123",
"delta": "Hello, how can I"
}
Purpose: Stream text chunks (like Anthropic's text_delta)
3. response.completed
{
"type": "response.completed",
"response": {
"usage": {
"input_tokens": 100,
"output_tokens": 200
}
}
}
Purpose: Finalize response (like Anthropic's message_stop)
Optional but Recommended
4. error
{
"type": "error",
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded"
}
Purpose: Handle errors gracefully
That's it for basic text streaming! You can ignore all the response.output_item.added/done, tool calling, reasoning, and annotation events if you just want simple text responses.
Your Go implementation would be:
- Parse SSE stream
- Switch on
event.type - Handle these 4 event types
- Accumulate text from
deltafields - Emit to your existing SSE handler
Much simpler than the full implementation.