joshcho / ChatGPT.el

ChatGPT in Emacs
GNU General Public License v3.0
397 stars 34 forks source link

ERROR: nil #39

Closed AXIOM-XD closed 1 year ago

AXIOM-XD commented 1 year ago

I have done everything like the instruction says. But when i try to execute a query with C-c q it says "ERROR: nil" in the chat buffer.

I tried to "pkill ms-playwright/firefox" and also "pkill ms-playwright/firefox && chatgpt install" but it did not worked out at all. I still have the same error.

I use Arch Linux. I tried to install all the needed packages with pip but then i had some problems with the path variable. It could not find the executables. So i uninstalled everything and then installed everything with "makepkg -si" from the Arch User Repository. The variables/paths are well now and i can use chatgpt in my cli but not in emacs.

What can i do?

eugene-sea commented 1 year ago

I had a working ChatGPT by using this package, but today I have run pip install git+https://github.com/mmabrouk/chatgpt-wrapper to update dependency and try GPT-4 inside Emacs. Now I'm having the same issue: ERROR: nil on every request. Looks like that dependency has a breaking change. Thus latest https://github.com/mmabrouk/chatgpt-wrapper is not compatible with current ChatGPT.el.

eugene-sea commented 1 year ago

These changes fixed the issue:

modified   .emacs.d/user/ChatGPT.el/chatgpt.py
@@ -12,7 +12,9 @@ def query(query):
     global bot
     if bot == None:
         bot = ChatGPT()
-    return bot.ask(query)
+        bot.agpt.model = 'gpt4'  # This is to try GPT-4, unrelated to the issue and requires ChatGPT Plus
+    success, response, message = bot.ask(query)
+    return response

 server.print_port()
 server.serve_forever()
tkhaos commented 1 year ago

Good fix! I got the same error, and it seems the new chatGPT-wrapper(0.6.3) returns a list instead of a string.

from epc.client import EPCClient

client = EPCClient(('localhost', <port_number>))

# query_func = client.call_sync

query = 'Hello, how are you?'
response = client.call_sync('query', [query])

print(response)
[True, "Hello! As an artificial intelligence language model, I don't have emotions, but I'm functioning properly and ready to assist you with any questions or concerns you may have. How can I assist you today?", 'Response received']
tkhaos commented 1 year ago

I had a working ChatGPT by using this package, but today I have run pip install git+https://github.com/mmabrouk/chatgpt-wrapper to update dependency and try GPT-4 inside Emacs. Now I'm having the same issue: ERROR: nil on every request. Looks like that dependency has a breaking change. Thus latest https://github.com/mmabrouk/chatgpt-wrapper is not compatible with current ChatGPT.el.

Yes, I found the breaking change since chatgpt-wrapper 0.5.0.

:fire_engine:Breaking Changes:fire_engine:

joshcho commented 1 year ago

Most likely addressed in https://github.com/joshcho/ChatGPT.el/commit/c38c9150b4f156c90c44f330aa0cd2497d66f8c5