a digital person for bluesky

Remove outside double quotes from Bluesky responses

Add quote removal function to strip double quotes from AI responses before posting to prevent quoted text from appearing in posts. Only removes double quotes to preserve contractions and single quotes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+31 -4
+6 -4
bsky.py
··· 588 588 # Send the reply(s) with language 589 589 if len(reply_messages) == 1: 590 590 # Single reply - use existing function 591 - logger.info(f"Sending single reply: {reply_messages[0][:50]}... (lang: {reply_lang})") 591 + cleaned_text = bsky_utils.remove_outside_quotes(reply_messages[0]) 592 + logger.info(f"Sending single reply: {cleaned_text[:50]}... (lang: {reply_lang})") 592 593 response = bsky_utils.reply_to_notification( 593 594 client=atproto_client, 594 595 notification=notification_data, 595 - reply_text=reply_messages[0], 596 + reply_text=cleaned_text, 596 597 lang=reply_lang 597 598 ) 598 599 else: 599 600 # Multiple replies - use new threaded function 600 - logger.info(f"Sending threaded reply with {len(reply_messages)} messages (lang: {reply_lang})") 601 + cleaned_messages = [bsky_utils.remove_outside_quotes(msg) for msg in reply_messages] 602 + logger.info(f"Sending threaded reply with {len(cleaned_messages)} messages (lang: {reply_lang})") 601 603 response = bsky_utils.reply_with_thread_to_notification( 602 604 client=atproto_client, 603 605 notification=notification_data, 604 - reply_messages=reply_messages, 606 + reply_messages=cleaned_messages, 605 607 lang=reply_lang 606 608 ) 607 609
+25
bsky_utils.py
··· 253 253 254 254 return init_client(username, password) 255 255 256 + def remove_outside_quotes(text: str) -> str: 257 + """ 258 + Remove outside double quotes from response text. 259 + 260 + Only handles double quotes to avoid interfering with contractions: 261 + - Double quotes: "text" → text 262 + - Preserves single quotes and internal quotes 263 + 264 + Args: 265 + text: The text to process 266 + 267 + Returns: 268 + Text with outside double quotes removed 269 + """ 270 + if not text or len(text) < 2: 271 + return text 272 + 273 + text = text.strip() 274 + 275 + # Only remove double quotes from start and end 276 + if text.startswith('"') and text.endswith('"'): 277 + return text[1:-1] 278 + 279 + return text 280 + 256 281 def reply_to_post(client: Client, text: str, reply_to_uri: str, reply_to_cid: str, root_uri: Optional[str] = None, root_cid: Optional[str] = None, lang: Optional[str] = None) -> Dict[str, Any]: 257 282 """ 258 283 Reply to a post on Bluesky with rich text support.