mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-04-29 03:50:06 +00:00
17 lines
519 B
Python
17 lines
519 B
Python
"""Shared text extraction utilities."""
|
|
|
|
from typing import Any
|
|
|
|
|
|
def extract_text_from_content(content: Any) -> str:
|
|
"""Extract concatenated text from message content (str or list of content blocks)."""
|
|
if isinstance(content, str):
|
|
return content
|
|
if isinstance(content, list):
|
|
parts = []
|
|
for block in content:
|
|
text = getattr(block, "text", "")
|
|
if text and isinstance(text, str):
|
|
parts.append(text)
|
|
return "".join(parts)
|
|
return ""
|