JSv4 / Delphic

Starter App to Build Your Own App to Query Doc Collections with Large Language Models (LLMs) using LlamaIndex, Langchain, OpenAI and more (MIT Licensed)
MIT License
303 stars 55 forks source link

Websocket Connection failure to Collection #97

Open professorDante opened 1 year ago

professorDante commented 1 year ago

Cannot open a WS connection to a newly uploaded Collection. On the frontend you see this:

Screen Shot 2023-07-16 at 2 33 57 PM

On the ASGI/WSGI dev server you see this:

Screen Shot 2023-07-16 at 2 36 03 PM

It looks like the API key being used by the WS frontend isn't available in the backend? Searching the docs gives no indication on what to do to set up an API key, aside from the OpenAI one.

marauder37 commented 1 year ago

The situation is a bit messy... first, know that the APIkey "errors" you get on the back are just logspam, they don't indicate the problem. If you want to find where the problem really is, start removing try/catch blocks until the request actually crashes out with a 500 code and a traceback.

Second, there are two token auth systems in use, both only partly implemented. What you have in the log is a JWT token. What the APIKey model expects is a "normal" opaque bearer token. JWT controls access to most of the JSON API, whereas the APIKey controls access to... nothing. If you have or suspect auth problems, rip out the APIKey stuff starting from the part of the code producing all those warnings.

In my private version I've fixed APIKey and fully implemented JWT. If this repo becomes active again maybe the author would be interested in PRs for this stuff.

professorDante commented 1 year ago

It's frustrating because I like the concepts they've used in this repo - WS to improve index load speed etc etc. I'd like to get this working and look to build from it. But it seems quite buggy and kind of half complete. Allowing the PRs to be in the master branch would help a ton. I fixed a bunch of issues pulling in your PR #85.

Where do I start to fix the JWT issue? Is there an endpoint?