Zain-ul-din / whatsapp-ai-bot

This is a WhatsApp AI bot that uses various AI models, including Gemini, GPT, DALL-E, and StabilityAI, to generate responses to user input.
https://wa-ai-seven.vercel.app/
MIT License
161 stars 89 forks source link

Added selfMessage.skipPrefix #46

Closed MikelCalvo closed 3 weeks ago

MikelCalvo commented 3 weeks ago

So that users can skip adding the prefix when they are messaging themselves

Zain-ul-din commented 3 weeks ago

What was the previous behavior? i can't remember. i think you also need to add if(modelToUse == undefined && ...) what if a user is sending a message to themself using a prefix.

image

MikelCalvo commented 3 weeks ago

@Zain-ul-din, Previously if the prefix wasn't enabled, then it would answer to any whatsapp message. What I intended to do was to set the enablePrefix to true but selfMessage.skipPrefix also to true, so that an external user would need to use the prefix, but if you are messaging yourself it wouln't be needed.

About the modelToUse == undefined, you are totally right, I'm adding a new commit with that so if a user includes a prefix it would be handled by the current logic below instead of with the defaultModel.

Zain-ul-din commented 3 weeks ago

I just added a feature send welcome message one per sessions. In this commit, I'm setting skipPrefix value default to false since the welcome message is a direct message that's why it causes a request to our bot again.

image