Coder Social home page Coder Social logo

whatsapp-gpt's People

Contributors

danielgross avatar zlenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whatsapp-gpt's Issues

Not working and series of errors

(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 ('

500 Internal Server Error

I'm getting this error after some time when I send a message.

<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

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?

suggestion: telegram-gpt?

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?

go/connector: catch non-2XX responses e.g. a 502 or 403

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

whatsapp-gpt/main.go

Lines 47 to 61 in d126932

resp, err := http.Get(url)
if err != nil {
fmt.Println("Error making request:", err)
return
}
// Read the response
buf := new(bytes.Buffer)
buf.ReadFrom(resp.Body)
newMsg := buf.String()
// encode out as a string
response := &waProto.Message{Conversation: proto.String(string(newMsg))}
fmt.Println("Response:", response)
userJid := types.NewJID(v.Info.Sender.User, types.DefaultUserServer)
mycli.WAClient.SendMessage(context.Background(), userJid, "", response)

We should catch this problem by doing this

if resp.StatusCode/100 != 2 { // Non-2XX HTTP response

Can't get past verification on server, Cloudflare problem?

Every time I try to verify on Cloudflare, using either Chromium or Mozilla I get this error, code seems to be working and I can log in to Chat-GPT on my regular chrome.

Has anyone been able to get past this with any other solution not listed here or is the project outdated?

Screenshot 2022-12-23 122148

Screenshot 2022-12-23 121839

ModuleNotFoundError: No module named 'playwright'

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'

its not working

Traceback (most recent call last):
File "server.py", line 5, in
import flask
ModuleNotFoundError: No module named 'flask'

Readme should have a one-liner explaining what's going on here

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.

is there any solution for this

<!doctype html>

<title>500 Internal Server Error</title>

Internal Server Error

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

Getting past cloudflare?

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.

AttributeError: 'NoneType' object has no attribute 'query_selector'

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.

Passing the Bearer token

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 !

how to upload to the cloud for free?

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

Error in line 10 when running command: python3 server.py

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

Error running main.go

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.

mattn/go-sqlite3#467

image

Two people cant message at the same time

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?

very noob here, golang library?

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

noob question

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?

go/connector: redundant HTTP body reading and leaking body

If we look at this code

whatsapp-gpt/main.go

Lines 52 to 57 in d126932

// Read the response
buf := new(bytes.Buffer)
buf.ReadFrom(resp.Body)
newMsg := buf.String()
// encode out as a string
response := &waProto.Message{Conversation: proto.String(string(newMsg))}

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.

Not working

Encountered below error when running python3 server.py. Any advise?

playwright._impl._api_types.Error: Browser closed.

Specifically answered messages do not work

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 ?

no required module provides package

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 :)

can't install playwright on mobile?

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?

go/connector: potential to lose signal due to unbuffered signal channel

The code in

whatsapp-gpt/main.go

Lines 110 to 112 in d126932

// Listen to Ctrl+C (you can also do something else that prevents the program from exiting)
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
creates an unbuffered channel but unfortunately that can cause a signal to be lost. It should be have a capacity of at least 1 given that we are waiting for just 1 signal and the advisory at https://pkg.go.dev/os/signal#Notify
Screen Shot 2022-12-04 at 8 30 02 PM

Multiple issues and/or strange behaviors and/or feature requests? Not sure about

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

"too many requests in 1 hour"

caveman here, so ive been using chatgpt on whatsapp and i got that error, i know its from chatgpt, but is there a script i can use for changing my openai's account automatically?
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.