mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: Handle None text values in Claude conversations importer
- Add robust handling for None text values in content array - Filter out None values before joining text content - Ensure all text values are converted to strings - Add comprehensive test case for None text values scenario Fixes #236 Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
This commit is contained in:
@@ -153,7 +153,14 @@ class ClaudeConversationsImporter(Importer[ChatImportResult]):
|
||||
# Handle message content
|
||||
content = msg.get("text", "")
|
||||
if msg.get("content"):
|
||||
content = " ".join(c.get("text", "") for c in msg["content"])
|
||||
# Filter out None values and ensure all items are strings
|
||||
valid_content = []
|
||||
for c in msg["content"]:
|
||||
if c and isinstance(c, dict):
|
||||
text = c.get("text")
|
||||
if text is not None:
|
||||
valid_content.append(str(text))
|
||||
content = " ".join(valid_content) if valid_content else ""
|
||||
lines.append(content)
|
||||
|
||||
# Handle attachments
|
||||
|
||||
Reference in New Issue
Block a user