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 # Send the reply(s) with language 589 if len(reply_messages) == 1: 590 # Single reply - use existing function 591 - logger.info(f"Sending single reply: {reply_messages[0][:50]}... (lang: {reply_lang})") 592 response = bsky_utils.reply_to_notification( 593 client=atproto_client, 594 notification=notification_data, 595 - reply_text=reply_messages[0], 596 lang=reply_lang 597 ) 598 else: 599 # Multiple replies - use new threaded function 600 - logger.info(f"Sending threaded reply with {len(reply_messages)} messages (lang: {reply_lang})") 601 response = bsky_utils.reply_with_thread_to_notification( 602 client=atproto_client, 603 notification=notification_data, 604 - reply_messages=reply_messages, 605 lang=reply_lang 606 ) 607
··· 588 # Send the reply(s) with language 589 if len(reply_messages) == 1: 590 # Single reply - use existing function 591 + cleaned_text = bsky_utils.remove_outside_quotes(reply_messages[0]) 592 + logger.info(f"Sending single reply: {cleaned_text[:50]}... (lang: {reply_lang})") 593 response = bsky_utils.reply_to_notification( 594 client=atproto_client, 595 notification=notification_data, 596 + reply_text=cleaned_text, 597 lang=reply_lang 598 ) 599 else: 600 # Multiple replies - use new threaded function 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})") 603 response = bsky_utils.reply_with_thread_to_notification( 604 client=atproto_client, 605 notification=notification_data, 606 + reply_messages=cleaned_messages, 607 lang=reply_lang 608 ) 609
+25
bsky_utils.py
··· 253 254 return init_client(username, password) 255 256 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 """ 258 Reply to a post on Bluesky with rich text support.
··· 253 254 return init_client(username, password) 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 + 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]: 282 """ 283 Reply to a post on Bluesky with rich text support.