Repository navigation
Conversation
…laude importers Signed-off-by: ICE0803 <2325043156@qq.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Member
|
Merged as #2234 with your commit and authorship kept. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2230
What Changed
ChatGPT Importer (
src/basic_memory/importers/chatgpt_importer.py)_is_hidden_message()to safely checkmetadatabefore readingis_visually_hidden_from_conversation, preventingAttributeErrorwhen"metadata": nullin both message formatting and counting._get_message_content()to:content: null/ non-dictcontentandparts: null/ non-listparts."text"and"multimodal_text"content types via_extract_part_text(), preserving string parts and structured parts with string"text"fields while skippingNoneand non-text asset/quote objects.Nonevalues forcodelanguageandtextfields so"None"is not rendered into fenced blocks.Claude Conversations Importer (
src/basic_memory/importers/claude_conversations_importer.py)msg.get("text")to""whenNoneor non-string so messages withtext: nulland empty/missingcontentdo not raiseTypeErroron"\n".join(lines).msg["text"]whenmsg["content"]contains only non-text blocks (e.g.,thinking,tool_use) or empty text blocks.attachments: null, non-dict entries, missing/nullfile_name, andextracted_content: null.Tests
test_import_chatgpt_multimodal_and_null_fieldsandtest_chatgpt_get_message_content_empty_messageintests/cli/test_import_chatgpt.py.test_import_conversation_with_null_fields_and_non_text_blocksintests/cli/test_import_claude_conversations.py.Why
Real-world exports from GPT-4o (images/audio in
multimodal_text, structuredparts, explicitnullmetadata/content) and Claude (extendedthinking/tool_useblocks,nulltext/attachments/extracted_content) either crashed the entire batch import or silently dropped message content.How Tested
ruff checkandruff format --checkon all modified files: passed.ty check --python-platform linuxon all modified files: passed (0 diagnostics).pyteston new ChatGPT CLI/unit regression tests, all Claude conversation import CLI tests (tests/cli/test_import_claude_conversations.py), andtests/importers/: 53 passed, 1 skipped.