xenodium / chatgpt-shell

A multi-llm Emacs shell (ChatGPT, Claude, Gemini, Ollama, Perplexity) + editing integrations
https://lmno.lol/alvaro
GNU General Public License v3.0
867 stars 77 forks source link

blank result #89

Closed arademaker closed 1 year ago

arademaker commented 1 year ago

Emacs 28.2 from http://emacsformacosx.com running on MacOS 13.3.1. I have in my .init.el

(use-package chatgpt-shell
  :ensure t
  :custom
  ((chatgpt-shell-openai-key
    (lambda ()
      (auth-source-pass-get 'secret "..."))))) <- my key here

I started with chatgpt-shell

But I got no output

ChatGPT(3.5-turbo)> Alex
<shell-maker-end-of-prompt>

<shell-maker-failed-command>ChatGPT(3.5-turbo)> 
arademaker commented 1 year ago

Emacs don't show the marks <shell-maker-end-of-prompt> and <shell-maker-failed-command>

xenodium commented 1 year ago

Try (setq shell-maker-logging t) and share the logs.

arademaker commented 1 year ago

Now it seems to be waiting response, but nothing happens

// Request

curl https://api.openai.com/v1/chat/completions --fail-with-body --no-progress-meter -m 180 -H Content-Type: application/json -H Authorization: Bearer nil -d {"stream":true,"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"Always show code snippets in markdown blocks with language labels."},{"role":"user","content":"Alex"}]}
xenodium commented 1 year ago

Try to run that command from a terminal and see if that succeeds

xenodium commented 1 year ago

-H Authorization: Bearer nil

The key is missing.

It should looks like: -H Authorization: Bearer SK-REDACTED-OPENAI-KEY

xenodium commented 1 year ago

Ensure (auth-source-pass-get 'secret "...") returns the key.

arademaker commented 1 year ago

OK, I misunderstood the README. I edited my init.el file:

(setq chatgpt-shell-openai-key
      "MY_KEY_HERE").  <= here I copied my key from open

(use-package chatgpt-shell
  :ensure t
  :custom
  ((chatgpt-shell-openai-key
    (lambda ()
      (auth-source-pass-get 'secret "openai-key")))))

In the use-package, the call to auth-source-pass-get should pass the literal string "openai-key", right? After that, the call to auth-source-pass-get still returns nil.

(auth-source-pass-get 'secret "openai-key") => nil
arademaker commented 1 year ago

OK, my mistake... sorry. Now working:

(use-package chatgpt-shell
  :ensure t
  :custom
  ((chatgpt-shell-openai-key "MY-KEY-HERE"))

So silly, I didn't pay attention properly. Now working.