Eigenbahn / ai-dungeon-cli

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

Update to latest API revision / externalized API client lib #29

Open p3r7 opened 3 years ago

p3r7 commented 3 years ago

Relying on an externalized low-level API client lib would allow:

Initial idea formulated at https://github.com/Eigenbahn/ai-dungeon-cli/issues/23#issuecomment-664392293.

Would certainly explore using 1Macho/AIDungeonAPI as proposed by https://github.com/Eigenbahn/ai-dungeon-cli/issues/23#issuecomment-664469296.

Subjects to explore:

mkualquiera commented 3 years ago

One thing to note is that using a library based on asyncio forces the use of asyncio for the project using it, since asyncio is mostly a framework. This is fine for things like Discord or Telegram bots but could not be as great for projects that already work in a different way fundamentally.

p3r7 commented 3 years ago

I've made the code more modular (split in several python modules).

On benefit is that it'll ease testing the integration of your lib.

p3r7 commented 3 years ago

I haven't tried playing for a while.

It seems that the API changed again :scream:.

I'm still using my own "dirty" API client (I haven't found time wrapping my head around python coroutines) but I assume that yours is broke as well, @mkualquiera, right?

sasha00123 commented 3 years ago

I guess that's the case, since my bot based on his library is also broken.

mkualquiera commented 3 years ago

From what I could tell, the API is the same... The thing is that they have disabled anonymous access, and now you have to login in order to play.

But I haven't looked into it a lot, I'm not really all that interested in AID anymore. If you guys want I could give you editing access to my repo in case you want to continue working on it.

p3r7 commented 3 years ago

I haven’t investigated much but the introduction of the stamina system certainly changed some stuff in the API.

I’ll redo a test ensuring I’m using credentials and not an anonymous account.

I don’t have much time to work on fixing it right now, though. Maybe next week end.

p3r7 commented 3 years ago

My code seems to fail with credentials as well.

Given how controversial the new stamina system is I anticipate changes in the weeks to come.

Let's not be too aggressive in trying to keep track with those API evolutions.

mkualquiera commented 3 years ago

I really wish they would just provide an API documentation instead of us having to reverse engineer it every time. Did the discussion of an official API yield any answers?

ochen1 commented 3 years ago

Does anything work atm or should I use a web scraper for my project?

I tried looking at the websocket communications to make my own version but they broke my brain. WAYY to lazy to reverse engineer it.

p3r7 commented 3 years ago

Does anything work atm

Nope. Hopefully, if nobody takes the plunge I'll implement it during the Christmas holidays.

I tried looking at the websocket communications to make my own version but they broke my brain.

That's how we did it in the previous iterations of this project.

I can understand, I'm not particularly partial to GQL / Apollo.

should I use a web scraper for my project?

What is your project? How a web scraper could help?

ochen1 commented 3 years ago

Sorry for the late reply, the email got drowned out in my email lol

I've already implemented a basic version of AI Dungeon for Python using selenium. Currently, it can log in and create new games with a custom prompt.

My project was to make a general purpose chatbot with GPT-3 through AI Dungeon. However, I've realized that the free model AI Dungeon provides isn't that great for this purpose. I think I'll wait for a public version of GPT-3 before attempting this.

p3r7 commented 3 years ago

@ochen1 some peeps seem to have forked this repo to target GPT-3. I don't know if they had a proper early GPT-3 access or if they used AI Dungeon as a backend.

On a related note, this just dropped: https://github.com/AetherDevSecOps/aid_adventure_vulnerability_report

Some takes: