Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

required positional argument: 'authorization' #10

Open
rafpaf opened this issue Dec 9, 2022 · 6 comments
Open

required positional argument: 'authorization' #10

rafpaf opened this issue Dec 9, 2022 · 6 comments

Comments

@rafpaf
Copy link

rafpaf commented Dec 9, 2022

I'm getting this error.

error caught in notification handler '/Users/raf/dotfiles/vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py:command:ChatGPT [['testing']]'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pynvim/plugin/host.py", line 140, in _on_notification
    handler(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pynvim/plugin/host.py", line 86, in _wrap_delayed_function

    plugin = cls(self._configure_nvim_for(cls))
  File "/Users/raf/dotfiles/vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py", line 285, in __init__
    self.bot = Bot(Chatbot(Config.load().as_dict()))
  File "/Users/raf/dotfiles/vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py", line 42, in load
    return Config(**json.load(file))
TypeError: Config.__init__() missing 1 required positional argument: 'authorization'

Is the authorization field in .chatgpt-nvim.json needed? I don't think I can access an API key.

@terror
Copy link
Owner

terror commented Dec 9, 2022

Yeah it's required for now, but you can keep it blank. I'll make it optional soon since not many people may have api keys.

@rafpaf
Copy link
Author

rafpaf commented Dec 9, 2022

Thanks. And thanks for creating this plugin. Really stoked to check it out. I've set authorization to an empty string, but then I get this when I try :ChatGPT query:

image

@terror
Copy link
Owner

terror commented Dec 9, 2022

Thanks. And thanks for creating this plugin. Really stoked to check it out. I've set authorization to an empty string, but then I get this when I try :ChatGPT query:

image

Did you set your session_token? Its currently needed to make requests to ChatGPT.

@rafpaf
Copy link
Author

rafpaf commented Dec 9, 2022

Yes. I copied a 2481-character string from DevTools > Application > Cookies.

image

image

Here's my ~/.chatgpt-nvim file with the session_token changed somewhat for security reasons but with the length preserved:

{
  "authorization": "",
  "session_token": "eyJhcGciOiJkoXIiLCJlcmMiOiJcMjU2R0NNIn0..crl5HFo4F5GTWz3i.99oUCzx4C08XH3oN8NvoqcVVHPp-62yCtLiTni6-wmxNVZ7IPhSltw02rxh7hKNcfmE-i5rGr7MY79-po8IvPjn8r8zY7RitKujuHQ_iikr7r4FLYNWEEig_iei0gk3VS4lztxGNRGX8Mi4ux3ei5P5Cz1wXF7m74Hrw7oY5XM142ycoU3QnpiTlZScT2WoU16kSzio91mCroOlLtZOohPY7o_1elnLvvNgw6HcICvYhJntuU8LF7kV3lFulq0hT_90hpy146CGsCgFgI1cFgPczikF1zq5V5h9Zc_sMMYvNxQw8Zzo_rNcEiLeR3X_yxW7fhxqcnvseMo-iPI1_SQKkE5NcueS_vxM_ZyKRccC0RJP6W5SX0S0qfm0cEfj6-4UYx4qFml_qJgHG4goPucwX75nVYcc_vq3YxMwqQF2f2H8cyItcNZP_UcNC9mVlL8WZSGJlSfj5oetUcc8rgltoKmC6_EmR1xE6GPRCicLisjxugV4ii-Eooo7GoIK2Ig2VcIiYX_uGZUI2loT21gP5lhiCR8fx0oIF4Vc8IrQWe2RcZLT9Lhy7RPPCkRISVoel4w15ociXuCcMFuwO5vQOuViuKFCcLccw69TMQg9uSIqJiMy6xKHRq5gcq_6IZFclKgiZIccO5hXS0gMsiorzvp6UuXreqhQo8_cHVXn-azjxf8j1i7uijkkj0kuiciP-QOictHi7Kw25TRLcNjyceOxv3hI1F9PTsHi7eY0PcvS7oLcK0usKWvTWJ5XipoU2j5S4WiZY22Hs6Trij3HOn7cZXkihIMIJsikmEcizU9sp22PoO7O9xgpotKUgWIoCcGufiJzk61s6nvifP8MvpN9hvXzQOe6F2NMwFXTRrg-OyehSJzyp5uyqcM1pLuw-iVi9cjPruOn7UcTp5olR4lw-UoJ9zNowNicGCcil4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ycwopnc83QSJYY8v-vXJykPi6eEEXg3LtvcFQEcIo3xwomLifo20Gv9oN3L9YiMcvtKHHulElEhiGgumYiCW1TcqyYJxWsWsUiECuZK0SUKZP4sgkXmtHJYoi0c7OkHExko_tfxYyXn6LqiJ1j8QtecxFopYi5f8LvcK7R1lfootKooc-JTmp01vw23hXpOSfp5uc2YloIq34W8hc6EN4EMc-kUPigiGCvgSc96Yc-mvMnsvHMQIn3l5xe2ii2Txiy7QPkLoijCKFc2Y0ip8zo4RkRF70GqC3oe_iceKwCheZvvkZ6FZiXiLFtugi9gHqy28oCrOf7Y2rzqEC2TL2LVLI5cJ-lgeJ1CwOylShKcEtYT.wuoH-trcLZhq9hqrygtcWw"
}

I'm still getting the same error, unfortunately.

@rafpaf
Copy link
Author

rafpaf commented Dec 9, 2022

Incidentally, I can get this repo working using the access token I can see at https://chat.openai.com/api/auth/session. Is there a way of using this access token with chatgpt.nvim?

@terror
Copy link
Owner

terror commented Dec 9, 2022

Incidentally, I can get this repo working using the access token I can see at https://chat.openai.com/api/auth/session. Is there a way of using this access token with chatgpt.nvim?

Try updating the dependency pip3 install revChatGPT --upgrade, seems to be working for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants