mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-08-06 03:53:37 +08:00
修复错误返回时SDK对象和dict冲突
This commit is contained in:
@@ -373,4 +373,6 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
print()
|
||||
|
||||
@@ -475,4 +475,6 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
print()
|
||||
|
||||
@@ -916,6 +916,8 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
|
||||
# Check inbox for teammate results → inject into history
|
||||
inbox = BUS.read_inbox("lead")
|
||||
|
||||
@@ -868,6 +868,8 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
|
||||
# Check inbox → route protocol + inject into history
|
||||
inbox_msgs = consume_lead_inbox(route_protocol=True)
|
||||
|
||||
@@ -800,6 +800,8 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
|
||||
# Consume lead inbox: route protocol + inject into history
|
||||
inbox = consume_lead_inbox(route_protocol=True)
|
||||
|
||||
@@ -984,6 +984,8 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
|
||||
# Consume lead inbox: route protocol + inject into history
|
||||
inbox = consume_lead_inbox(route_protocol=True)
|
||||
|
||||
@@ -1013,6 +1013,8 @@ if __name__ == "__main__":
|
||||
for block in history[-1]["content"]:
|
||||
if getattr(block, "type", None) == "text":
|
||||
print(block.text)
|
||||
elif isinstance(block, dict) and block.get("type") == "text":
|
||||
print(block.get("text", ""))
|
||||
|
||||
inbox = consume_lead_inbox(route_protocol=True)
|
||||
if inbox:
|
||||
|
||||
@@ -2063,8 +2063,8 @@ def print_turn_assistants(messages: list, turn_start: int):
|
||||
if msg.get("role") != "assistant":
|
||||
continue
|
||||
for block in msg.get("content", []):
|
||||
if getattr(block, "type", None) == "text":
|
||||
terminal_print(block.text)
|
||||
if block_type(block) == "text":
|
||||
terminal_print(block["text"] if isinstance(block, dict) else block.text)
|
||||
|
||||
|
||||
def cron_autorun_loop(history: list, context: dict):
|
||||
|
||||
Reference in New Issue
Block a user