yufeikang / ai-cli

This CLI tool allows you to easily use chatGPT in the command line. You can chat with it, ask it questions, and get text translations. It also supports rendering Markdown in the terminal.
MIT License
132 stars 11 forks source link

EdgeGPT should be updated #25

Open johnd0e opened 7 months ago

johnd0e commented 7 months ago

Original package is not working anymore. But EdgeGPT-fork is ok (tested with edge-gpt.exe)

Though, even after upgrading I experience an error:

Asking...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "D:\AI\ai-cli\venv\Scripts\ai.exe\__main__.py", line 7, in <module>
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\cli.py", line 494, in cli
    main()
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\cli.py", line 486, in main
    CMD[command]()
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\cli.py", line 375, in ask_cmd
    ask(args.question, stream=stream)
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\cli.py", line 292, in ask
    response = _ask(question, stream=stream)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\cli.py", line 283, in _ask
    bot: Bot = get_bot(setting=setting, bot_type=bot_type)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\bot\__init__.py", line 168, in get_bot
    bot = BingBot(setting)
          ^^^^^^^^^^^^^^^^
  File "D:\AI\ai-cli\venv\Lib\site-packages\ai_cli\bot\bing.py", line 49, in __init__
    self.bot = Chatbot(cookies=bing_cookies)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\AI\ai-cli\venv\Lib\site-packages\EdgeGPT\EdgeGPT.py", line 27, in __init__
    self.chat_hub: ChatHub = ChatHub(
                             ^^^^^^^^
  File "D:\AI\ai-cli\venv\Lib\site-packages\EdgeGPT\chathub.py", line 49, in __init__
    self.sec_access_token = conversation.struct["secAccessToken"] or None
                            ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'secAccessToken'
yufeikang commented 7 months ago

I haven't used Bing for a long time. If the modification isn't too complex, could you please test it and submit a pull request?

johnd0e commented 7 months ago

My modification was straightforward - just replacing 'EdgeGPT' package name with 'EdgeGPT-fork'.

Unfortunately, for unknown reason that is not enough for your project, see error above.