Eigenbahn / ai-dungeon-cli

:european_castle: A cli client to play.aidungeon.io
MIT License
150 stars 34 forks source link

Is this pip package was ever working? #35

Closed MerlinTheProgramist closed 3 years ago

MerlinTheProgramist commented 3 years ago

When I install via the pip package manager I don't get the conda yml file as it is contained in the GitHub files. So I can't start the environment. The second thing that I'm experiencing is when I run ai-dungeon-cli I get some errors from the code itself about libraries not containing things, or this is not right until I install the env in conda.

(base) C:\Users\Merlin\anaconda3\Lib\site-packages\ai_dungeon_cli>ai-dungeon-cli
Traceback (most recent call last):
  File "c:\users\merlin\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\merlin\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Merlin\anaconda3\Scripts\ai-dungeon-cli.exe\__main__.py", line 4, in <module>
  File "c:\users\merlin\anaconda3\lib\site-packages\ai_dungeon_cli\__init__.py", line 6, in <module>
    from gql import gql, Client, WebsocketsTransport
ImportError: cannot import name 'WebsocketsTransport' from 'gql' (c:\users\merlin\anaconda3\lib\site-packages\gql\__init__.py)
p3r7 commented 3 years ago

Yes, this used to work but stopped due to regular API changes, see https://github.com/Eigenbahn/ai-dungeon-cli/issues/29.

As far as I know, pypi packages don’t run under conda. So if you want to use conda you’d have to git clone the repo.

If you’ve got some programming chops, we welcome contributions on adapting to the newest API. The timing might not be ideal, though, given the ongoing war around content moderation. The API is likely to change (again) as things settle down.

MerlinTheProgramist commented 3 years ago

So with the gql package import, it is some other problem, independent of that I'm trying to run it with conda? And it will be kind of hard to fix it myself?

p3r7 commented 3 years ago

So with the gql package import, it is some other problem, independent of that I'm trying to run it with conda?

Yes.

The error message you get is due to breaking changes that were made to the gql package. https://github.com/Eigenbahn/ai-dungeon-cli/commit/f3111417229db54adf8c5b913625060e7dd0b3af fixes it but we didn't publish a new release on PyPI as there are other things to fix to make it work (the idea being to not publish a non-working version).

Namely, the play.aidungeon.io API changed and we need to adapt to these changes.

This the error you should be getting when running from git cloned sources (instead of pip installed).

Traceback (most recent call last):
  File "./ai_dungeon_cli/__init__.py", line 393, in <module>
    main()
  File "./ai_dungeon_cli/__init__.py", line 356, in main
    ai_dungeon.make_user_choose_config()
  File "./ai_dungeon_cli/__init__.py", line 177, in make_user_choose_config
    prompt, settings = self.api.get_options(self.api.single_player_mode_id)
  File "/home/eigen/Documents/Code/local/ai-dungeon-cli/ai_dungeon_cli/impl/api/client.py", line 124, in get_options
    prompt = result['content']['prompt']
KeyError: 'content' 

And it will be kind of hard to fix it myself?

It's not that hard. It consists of running AI Dungeon in a web browser, inspect the exchanges in developper mode and reproduce the exchanges in impl/api/client.py.

This comment is an example of the process: https://github.com/Eigenbahn/ai-dungeon-cli/issues/23#issuecomment-663181475