refactor(cli-handler): improve stream handling and response processing

- Refactor CLI handler base for better stream context management
- Optimize request/response handling for Claude, OpenAI, and Gemini CLI adapters
- Enhance telemetry tracking across CLI handlers
This commit is contained in:
fawney19
2025-12-16 02:39:20 +08:00
parent ad1c8c394c
commit a3df41d63d
4 changed files with 296 additions and 244 deletions

View File

@@ -111,7 +111,7 @@ class ClaudeCliMessageHandler(CliMessageHandlerBase):
if delta.get("type") == "text_delta":
text = delta.get("text", "")
if text:
ctx.collected_text += text
ctx.append_text(text)
# 处理消息增量(包含最终 usage
elif event_type == "message_delta":