joshcho / ChatGPT.el

ChatGPT in Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't Install on Spacemacs

erichlf opened this issue · comments

When I attempt to install via quelpa I get the following:

(Spacemacs) --> installing package: ChatGPT@dotfile... [6/6]
Fetcher: github
Source: joshcho/ChatGPT.el

Updating REDACTED/.emacs.d/.cache/quelpa/build/ChatGPT/
Skipping rebuild of REDACTED/.emacs.d/.cache/quelpa/packages/ChatGPT-20221213.43350.el
  INFO     Scraping files for chatgpt-autoloads.el... 
Generating autoloads for chatgpt.el...done
  INFO     Scraping files for chatgpt-autoloads.el...done
Wrote REDACTED/.emacs.d/elpa/28.1/develop/chatgpt-20221213.43350/chatgpt-autoloads.el [2 times]
Wrote REDACTED/.emacs.d/.cache/undo-tree-history/REDACTED!.emacs.d!elpa!28.1!develop!chatgpt-20221213.43350!chatgpt-autoloads.el.~undo-tree~
Loading async...done
(Spacemacs) Error: 
An error occurred while installing ChatGPT (error: (scan-error Unbalanced parentheses 271 6478))

My install code looks like:

      (ChatGPT :location (recipe
                           :fetcher github
                           :repo "joshcho/ChatGPT.el"
                           :bind ("C-c q" . chatgpt-query) )
        )

Chaning the above to

 (ChatGPT :location (recipe
                           :fetcher github
                           :repo "joshcho/ChatGPT.el"
                           :init
                           (setq chatgpt-repo-path (expand-file-name "chatgpt/" quelpa-build-dir))
                           :bind ("C-c q" . chatgpt-query) )
)

results in the following:

(Spacemacs) --> installing package: ChatGPT@dotfile... [6/6]
Fetcher: github
Source: joshcho/ChatGPT.el

Updating REDACTED/.emacs.d/.cache/quelpa/build/ChatGPT/
Skipping rebuild of REDACTED/.emacs.d/.cache/quelpa/packages/ChatGPT-20221213.43350.el
  INFO     Scraping files for chatgpt-autoloads.el... 
Generating autoloads for chatgpt.el...done
  INFO     Scraping files for chatgpt-autoloads.el...done
Wrote REDACTED/.emacs.d/elpa/28.1/develop/chatgpt-20221213.43350/chatgpt-autoloads.el [2 times]
Wrote REDACTED/.emacs.d/.cache/undo-tree-history/REDACTED!.emacs.d!elpa!28.1!develop!chatgpt-20221213.43350!chatgpt-autoloads.el.~undo-tree~
Loading async...done
(Spacemacs) --> deleting chatgpt... [1/1]
Package ‘chatgpt-20221213.43350’ deleted.

I am not a spacemacs user, so I will be a bit unfamiliar. But I got the following to work on spacemacs with Emacs 28.2.

In dotspacemacs/user-config

  (setq chatgpt-repo-path (expand-file-name "chatgpt/" quelpa-build-dir))
  (global-set-key (kbd "C-c q") #'chatgpt-query)

In dotspacemacs/layers

   dotspacemacs-additional-packages
   '(
     (chatgpt :location (recipe
                         :fetcher github
                         :repo "joshcho/ChatGPT.el"
                         ))
     )

Let me know if that works for you.

So oddly, changing ChatGPT->chatgpt fixed things. However, however now I get:

chatgpt--query: Symbol’s value as variable is void: python-interpreter

It looks like this is suppose to be a variable that describes the location of the python interpreter?

Can you try (require 'python) before loading the package (or the spacemacs equivalent)? python-interpreter is available then. I will make appropriate changes to the repo in the next coming days.

Otherwise, you can try (setq python-interpreter "python")

or (setq python-interpreter "python3")

in your user-config for a temporary solution. Your choice of python should depend on what's installed on your system.

I set the python-interpreter to python3 however:

epc:start-server: Server may raise an error. Use "M-x epc:pop-to-last-server-process-buffer RET" to see full traceback:
Traceback (most recent call last):
  File "REDACTED/.emacs.d/.cache/quelpa/build/chatgpt/chatgpt.py", line 3, in <module>
    from epc.server import EPCServer
ModuleNotFoundError: No module named 'epc'

And before all of this I had already done

pip3 install git+https://github.com/mmabrouk/chatgpt-wrapper

Fixed the above with pip3 install epc.

Sorry about that. I will add all the relevant dependencies.

However, now it just seems to sit there querying forever.

Can you try the main troubleshooting method?

pkill ms-playwright/firefox && chatgpt install

Followed by chatgpt-reset... hopefully works.

I had to run chatgpt install and login again, then I had to do M-x chatgpt-reset and things seem to be working now. Thanks.

Great. It's a bit unstable, for now. Hopefully it gets better. Please reopen this issue if there are any more issues.

Maybe I don't understand how this works, but I selected an elisp function and the did C-c q and asked ChatGPT to help find the bug in the code and I got the following:

chatgpt--query-by-type: No format string associated with ’query-type’ Find the bug in the given function. Please customize ’chatgpt-query-format-string-map’

Can you take a look at https://youtu.be/4oUrm4CnIjo? You want to select bug, or just type bug then enter, instead of Find the bug in the given function. If you want your own prepend prompt, then select custom, then type Find the bug in the given function.

You can also customize these selections as per README. I recommend a package like https://github.com/minad/vertico to choose between selections.

Your workflow should be supported in 862c5b3