if text_content.strip(): # If text is found, append it. text += text_content # Close the document # TODO add context fixing by replacing "you" with "I" in user messages, and "your" with "my" in user ...