feat: Add interactive AI bot integration#1
Conversation
- Add AI response handler using `pollinations.ai` free endpoint. - Greet users logging in with a bot-generated message asynchronously. - Reply to unrecognized private messages using the AI model asynchronously. Co-authored-by: remeliah <132663728+remeliah@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Fetch AI response async via `text.pollinations.ai`. - Add an ad stripping routine for the pollinations outputs. - Reply to dm using the AI asynchronously. - Greet users when they login using AI asynchronously. Co-authored-by: remeliah <132663728+remeliah@users.noreply.github.com>
- Wrap bot queries in asyncio.create_task() to avoid blocking synchronous operations in login and message reception flows - Remove stray ad tags from Pollinations AI responses using simple string splitting - Ensure external API queries are properly try/except-ed to prevent random crash issues - Use correct ClientPackets constants to satisfy tests - Address import locations requested in PR comments Co-authored-by: remeliah <132663728+remeliah@users.noreply.github.com>
| async def send_ai_resp() -> None: | ||
| ai_resp = await fetch_bot_response(msg) | ||
| if ai_resp: | ||
| player.send(ai_resp, sender=target) |
There was a problem hiding this comment.
Why would you create a function here.
There was a problem hiding this comment.
My mistake! I've removed the inline function and we are just awaiting it directly now.
…nction - Removed the `send_ai_resp` inline function that was used to wrap the fetch_bot_response await in an asyncio task inside SendPrivateMessage.handle. Free APIs are slow but packets handlers can yield, reducing the code complexity. Co-authored-by: remeliah <132663728+remeliah@users.noreply.github.com>
Integrates an interactive AI bot using the free text.pollinations.ai API to provide an "annoying girlfriend" persona. It replies to unrecognized commands and greets logging-in users. Free endpoints are queried asynchronously to avoid blocking concurrent events.
PR created automatically by Jules for task 3149624510181966009 started by @remeliah