BorisovAI
All posts
Bug Fixbot-social-publisherGit Commit

Smart Reading, Smarter Grouping: Bot Social Publisher v2.2

Smart Reading, Smarter Grouping: Bot Social Publisher v2.2

Bot Social Publisher v2.2: When Incremental Reading Met Smart Grouping

The bot-social-publisher project had been humming along, but Pink Elephant saw the bottleneck: every restart meant re-reading entire log files from scratch. With collectors constantly ingesting data, this wasn’t just inefficient—it was wasteful. The mission for v2.2 was clear: make the system smarter about what it reads and how it organizes content.

The first breakthrough was incremental file reading. Instead of letting collectors start from the beginning every time, Pink Elephant implemented position tracking. Each collector now remembers where it left off, saving file offsets and deferred state that survive even when the bot restarts. It’s a simple idea that transforms the system: only new content gets processed. The architecture had to be rock-solid though—lose that position data, and you’re back to square one. That’s why persisting collector state became non-negotiable.

But reading smarter was only half the puzzle. The real pain point was handling multiple sessions from the same project scattered across different hours. Enter project grouping: sessions from the same project get merged within a 24-hour window. Suddenly, your social media updates from Tuesday afternoon and Wednesday morning aren’t treated as separate events—they’re stitched together as a coherent story.

Content quality came next. Pink Elephant added a content selector with a scoring algorithm that picks the 40–60 most informative lines for the LLM to work with. Then came the game-changer: a proofreading pass using a second LLM call as an editor. The first pass generates content; the second fixes punctuation, grammar, and style. It’s like having a copy editor built into your pipeline. To prevent embarrassing duplicate titles, he added auto-regeneration logic with up to 3 retry attempts.

The system also got eyes and ears. Native OS tray notifications now alert users when content publishes or when errors occur—no more checking logs manually. Under the hood, a PID lock mechanism prevents duplicate bot instances from running simultaneously, a critical safeguard for any long-running service.

One particularly elegant addition was the SearXNG news provider, weaving relevant tech news into LLM prompts. This adds context and relevance without overcomplicating the workflow. Meanwhile, daily digest aggregation buffers small events and combines them by date and project, creating digestible summaries instead of notification noise.

Pink Elephant also tackled the distribution challenge: PyInstaller support with correct path resolution for exe bundles. Whether the bot runs as Python or as a compiled executable, it finds its resources correctly. Git integration got a tune-up with configurable lookback_hours for commit searches, and thresholds shifted from line-based to character-based metrics (min_chars instead of min_lines), offering finer control.

Finally, every source file received an AGPL-v3 license header, making the project’s open-source commitments explicit. Logging infrastructure was strengthened with RotatingFileHandler for file rotation, ensuring logs don’t spiral out of control.

The achievement here isn’t one feature—it’s an entire system that now reads intelligently, groups thoughtfully, and communicates clearly. The bot went from reactive to proactive, from verbose to curated.

The generation of random numbers is too important to be left to chance.

Metadata

Branch:
main
Dev Joke
Почему Elasticsearch лучший друг разработчика? Потому что без него ничего не работает. С ним тоже, но хотя бы есть кого винить

Rate this content

0/1000