|
|
@@ -189,9 +189,10 @@ def create_claude_code_oauth_llm_call(model: str = "claude-sonnet-4-5"):
|
|
|
if isinstance(msg, AssistantMessage):
|
|
|
for block in msg.content:
|
|
|
if hasattr(block, "thinking"):
|
|
|
- _emit(f"[think] {block.thinking}")
|
|
|
+ # thinking 内容太多,跳过
|
|
|
+ continue
|
|
|
elif isinstance(block, TextBlock):
|
|
|
- _emit(f"[text] {block.text}")
|
|
|
+ _emit(f"[text] {block.text}")
|
|
|
text_parts.append(block.text)
|
|
|
elif hasattr(block, "name") and hasattr(block, "input"):
|
|
|
_emit(f"[tool_use] {block.name}({block.input})")
|
|
|
@@ -223,8 +224,20 @@ def create_claude_code_oauth_llm_call(model: str = "claude-sonnet-4-5"):
|
|
|
if info_status and info_status != "allowed":
|
|
|
rate_limit_signal = f"status={info_status!r}"
|
|
|
else:
|
|
|
- # SystemMessage 或其他未知类型
|
|
|
- _emit(f"[{msg_type}] {msg!r}")
|
|
|
+ # SystemMessage 简化为关键字段;其他未知类型 fallback
|
|
|
+ if msg_type == "SystemMessage":
|
|
|
+ data = getattr(msg, "data", {}) or {}
|
|
|
+ subtype = getattr(msg, "subtype", "?")
|
|
|
+ if subtype == "init":
|
|
|
+ _emit(
|
|
|
+ f"[init] model={data.get('model')!r} "
|
|
|
+ f"apiKeySource={data.get('apiKeySource')!r} "
|
|
|
+ f"session={data.get('session_id', '')[:8]}"
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ _emit(f"[system] subtype={subtype}")
|
|
|
+ else:
|
|
|
+ _emit(f"[{msg_type}] {msg!r}")
|
|
|
except ClaudeSDKError as e:
|
|
|
stderr_tail = "\n".join(stderr_lines[-20:])
|
|
|
raise RuntimeError(
|