danielgross / whatsapp-gpt Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
is there a way to upload this to the cloud so i dont have to leave my pc on? this is for my personal use for me and my family. also its fine if its paid, just tell me the steps
so is there a way where it can answer multiple people at once? because it does it one by one. and it takes long. is there a way where it can use duplicate tabs to handle te messages?
If we look at this code
Lines 52 to 57 in d126932
there is unnecessary process with the bytes.Buffer.ReadFrom then buf.String() then string(newMsg) but really it can be trivially done with
newMsg, err := io.ReadAll(resp.Body)
if err != nil {
...
return
}
response := &waProto.Message{Conversation: proto.String(string(newMsg))}
and even more, resp.Body is never closed. We need a defer resp.Body.Close() or resp.Body.Close() right after the read.
getting the following error:
...Downloads/whatsapp-gpt-main/server.py", line 10, in
from playwright.sync_api import sync_playwright
ModuleNotFoundError: No module named 'playwright'
playwright was installed. Any assistance will be appreciated
How can I fix it so that this error no longer occurs after a long period of inactivity?
I'm getting this error after some time when I send a message.
<!doctype html>
<title>500 Internal Server Error</title>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
I don't have any go-lang experience, but can't we rather than running it in firefox or chromium using playwright, can't directly integrate with the OpenAI API key?
Hello, thanks a lot for taking the time to build something and open source it!
I've come across this repo via the GitHub trending repos section.
I think I can roughly guess what it does - but I'm really not sure.
Golang isn't my language of choice, and I'm not much of a developer but I would probably like to consider using ChatGPT with Whatsapp.
It would really, really help to just have one sentence at the top of the readme stating what this tool does.
Encountered below error when running python3 server.py. Any advise?
playwright._impl._api_types.Error: Browser closed.
If you are running the script from Windows 11 (as is my case) you may encounter the error I attached. For this you will have to install MinGW to get the gcc file, which is needed to run sqllite.
hey thanks to the script
working demo plz cheak https://wa.me/+917778941445
Two terminals are executed OK. I don't receive anything on whatsapp though, do I need another command?
hi there! thanks for creating this.
I am total noob. I used the fork created by zlenner and somehow managed to run the whole thing.
By that I mean I connected to my whatsapp and also ran the server.
However It just started sending messages I receive from my existing contacts to the openai and the openai started replying to them.
How do I create a specific openai contact which is the only one that would interact with the openai?
Also again total noob question, but I guess this will all die if I close my PC? How can I make it a permanent thing?
I found that the go sdk library dedicated to whatsapp messenger makes your project life much easier..
how about creating one with telegram? any chances to contribute then?
Hello guys,
Totally noob so excuse me to ask in advance. I have been looking for hours and can't find how to successfully run the main.go I have the following error.
whatsapp-gpt-main/main.go:13:2: no required module provides package github.com/mattn/go-sqlite3: go.mod file not found in current directory or any parent directory; see 'go help modules'
Of course all the files including the go.mod are in the directory whatsapp-gpt-main. I have put this directory in my desktop so that might be the reason. I need to put it somewhere else ? In a dedicated "go folder"...?
Any help would be much appreciated :)
Having some trouble getting past cloudflare. Doing some research on how to bypass it (although it looks complicated). Anyone had some luck?
So far I tried using regular chrome instead of chromium, but that didn't work out (using channel='chrome'
). I'm logged in successfully on my regular chrome.
I have no idea what Golang Library is? or how to get a phone number on there. is it US only? like I feel like the ReadMe..needs more of in-depth step-by-step explanation
Installed everything, and was able to launch go run main.go in the env.
When i try to run python3 server.py it always gives me the error:
from playwright.sync_api import sync_playwright
ModuleNotFoundError: No module named 'playwright'
Could we make it work by passing the bearer token directly instead of using the browser ?
This would allow us to launch the code on a server without any interface.
I didn't tried it myself but I am wondering and asking here as you might have tried yourself.
I'm trying to use Whisper to make it a vocal interface and see how it goes, so all brainstorming and other things are welcomed.
Thanks for your work man, and long live GPT !
(base) sk@SKs-MacBook-Pro ~ % /Users/sk/Downloads/whatsapp-gpt-main/server.py
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 1: Make some requests to OpenAI's chatbot: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 3: import: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 4: import: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 5: import: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 6: import: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 8: from: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 10: from: command not found
/Users/sk/Downloads/whatsapp-gpt-main/server.py: line 12: syntax error near unexpected token (' /Users/sk/Downloads/whatsapp-gpt-main/server.py: line 12:
PROFILE_DIR = "/tmp/playwright" if '--profile' not in sys.argv else sys.argv[sys.argv.index('--profile') + 1]'
(base) sk@SKs-MacBook-Pro ~ % /Users/sk/Downloads/whatsapp-gpt-main/main.go
/Users/sk/Downloads/whatsapp-gpt-main/main.go: line 1: package: command not found
/Users/sk/Downloads/whatsapp-gpt-main/main.go: line 3: syntax error near unexpected token newline' /Users/sk/Downloads/whatsapp-gpt-main/main.go: line 3:
import ('
<!doctype html>
<title>500 Internal Server Error</title>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
output chat
Error making request: Get "http://localhost:5001/chat?q=Halo": dial tcp 127.0.0.1:5001: connect: connection refused
Is anyone having this issue?
Currently if the HTTP call to Whatsapp fails with a non-2XX code e.g. 502 or 403, this condition won't be caught and that data will just be serialized to the database and sent to GPT :-( as per
Lines 47 to 61 in d126932
We should catch this problem by doing this
if resp.StatusCode/100 != 2 { // Non-2XX HTTP response
When someone sends me a message, everything works fine, the message is sent to GPT which responds very well, but when someone responds to a specific message,
Nothing works, the message is not displayed in the go console and is not sent to gpt.
I think the events are not getting the specific responses, does anyone have any idea what is going on and can help please ?
Calculator code in C++
The code in
Lines 110 to 112 in d126932
Traceback (most recent call last):
File "server.py", line 5, in
import flask
ModuleNotFoundError: No module named 'flask'
Hey I've been working through dependancies on my termux instances, main.go is running fine but derver.py depends on playwright which isn't available on termux's reduced version of pip (which can't be upgraded), only npm that I've found so far and it doesnt recognise the install by that means.
Any advice?
This isn't an issue.
whatsapp-gpt hasn't worked since OpenAI put their site under Cloudflare, so here's an alternative I've been using privately for a bit and am now making public.
It supports different threads for each person as well as voice notes.
Hey thanks for writing these scripts!
I got it mostly installed, up to the point where it tries to launch the browser, but the browser only pops up for a split second and then goes away.
This is the error in the terminal:
┌──(flask)─(kali㉿kali)-[~/whatsapp-gpt/flask]
└─$ python /home/kali/whatsapp-gpt/server.py
Traceback (most recent call last):
File "/home/kali/whatsapp-gpt/server.py", line 61, in
start_browser()
File "/home/kali/whatsapp-gpt/server.py", line 52, in start_browser
if not is_logged_in():
File "/home/kali/whatsapp-gpt/server.py", line 25, in is_logged_in
return get_input_box() is not None
File "/home/kali/whatsapp-gpt/server.py", line 21, in get_input_box
return PAGE.query_selector("div[class*='PromptTextarea__TextareaWrapper']").query_selector("textarea")
AttributeError: 'NoneType' object has no attribute 'query_selector'
Any help would be appreciated.
Edit: I started to edit the files with the support by ChatGPT - as said, I have no idea about coding - to get better results. Except of issues 1,2,3, I was able to find solutions. I plan to publish a fork, as soon as I know how to. :D - Issue 5 is not under control, WhatsApp-API does not provide messages after changing the messages to auto-delete (disappearing messages, even it's changed back to "off").
First of all, "whatsapp-gpt" is a fantastic and powerful project! Thank you so much for your work. I tested it extensively and some things came up:
I discovered that the scripts work best with the legacy model. With all other models, I encounter many server error 500 messages.
1. mixture of mixtures
Every WhatsApp chat is combined into the same ChatGPT chat. As a result, the context is mixed up due to multiple different user inputs. Is it possible to have the script open new conversations for new participants and keep them in their chat window? I discovered that every participant already receives only their reply, so this idea came up.
2. WhatsUp Reply Action
If users use the reply button in WhatsApp, the request is not recognized by whatsapp-gpt. It could be helpful to transmit the full context to ChatGPT with the new text so that the reply can be more accurate. Is this a feature request or a bug?
3. Group-Messages
If users are part of a group, the reply from the bot is submitted privately and not inside the group. Is there a way to prevent replies in general or to populate replies for questions in groups directly in groups?
4. general prompt / prompt as message injections
I experimented with priming by submitting an initial prompt to prompt ChatGPT to act as a German teacher. That works fine. Is there any way to ensure that certain prompts will be added to every message from a user? I want to avoid users having to re-prompt themselves. For instance: $user_message + "\n\nREMEMBER: 1. start your reply with "(KI-BOT): " and use only the German language for your reply (except if I asked you to do it differently), 2. please correct my input. 3. answer my question."
5a. auto-deletion function avoids reply?
5b. non-latin-charset-account avoids reply?
Further, sometimes it simply does not work to reply automatically to some of the WhatsApp-accounts. It worked before, but suddenly it stopped. Whereas it works for other accounts. I think this may have something to do with the auto-deletion of messages after a period of time. Once this was set - even for a very short period of time - it never works again. Maybe this needs special handling at the API of WhatsApp? I dunno. Maybe this has something to do with non-latin-charset-accounts?
6. auto-split of messages longer than X words?
I also search for a way to split up to long prompts from the user in multiple parts, so that ChatGPT can reply in summary. It then should also say something as "please type 'continue' to get the next part". I'd have an idea how to prompt something like this to ChatGPT that it does not get confused by other requests between, but I have no idea how to code this.
7. Cursor must be set to the input field
The Cursor must be inside the field. So the focus must be inside the textfield at ChatGPT. Otherwise it does not work. Maybe the focus can be set by the script before submitting anything?
**8. "Dead token" error. (If this issue... contact OpenAI) **
After some days, even after a restart of every thing, it started to produce troubles after some messages and a longer break between the messages.
This project is so helpful and clever. Unfortunately, I have no experience in programming. But I can read code, and I think that I can copy and paste things to specific locations. In this case, I don't want to ask ChatGPT for this, as it could warn me about the use of ChatGPT, and it could also harm this beautiful project.
Thank you so much for your guidance and/or tips and/or consideration of some of the possible feature requests.
Have a happy day,
Johannes
Get @danielgross , giving back in the spirit of giving.
they changed the website and previous selectors are broken
https://github.com/altryne/chatGPT-telegram-bot/releases/tag/0.1.1
Here I updated them to work
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.