Conversation
- 改用 ResultMessage.result 替代手动收集 AssistantMessage 的 TextBlock - 符合 SDK 设计意图,ResultMessage.result 包含完整聚合响应 - 移除不再需要的 AssistantMessage 和 TextBlock 导入 - 添加 SDK 响应结构测试用于验证消息类型
There was a problem hiding this comment.
Pull request overview
This PR refactors the response handling in the Claude Agent SDK integration to use ResultMessage.result for the final aggregated response instead of manually collecting text from AssistantMessage content blocks. This aligns with the SDK's intended design pattern.
Key changes:
- Replaced manual text collection from
AssistantMessage.contentwith direct use ofResultMessage.result - Removed unnecessary imports of
AssistantMessageandTextBlockfrom the main code - Added a test file to verify SDK message structure and response handling
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| agent-sdk-server/agent_session.py | Simplified response handling by using ResultMessage.result directly; removed handling of AssistantMessage and associated imports |
| tests/test_sdk_response.py | New test file to verify SDK message structure and validate the response format from both AssistantMessage and ResultMessage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- handler.py: 删除 `/` 开头命令拦截,支持 Agent Skill 调用 - .gitignore: 移除通配符规则,保留 samconfig.toml.example
Code reviewFound 1 issue:
Suggestion: Consider filtering standard Telegram commands ( 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Summary
ResultMessage.result替代手动收集AssistantMessage的TextBlockResultMessage.result包含完整聚合响应AssistantMessage和TextBlock导入Test plan
tests/test_sdk_response.py验证 SDK 消息结构/hello-world确认响应正常