Give librechat LLMs access to my local files (already implemented) #5667
ryanhulsker
started this conversation in
Feature Requests & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have written the following plugin that my team is using which turns out to be incredibly useful. I am wondering if there is interest in including it upstream and I am happy to author a pull request if so.
Problem. We use a central librechat deployment in our local k8s cluster to provide all team members with access to a variety of LLMs. I was faced with the problem that I constantly have to cut and paste code in and out of it. Providing access to our repositories does not entirely solve the problem because I often want the LLM to have access to my WIP files.
I also have to remember to ask the LLM if it wants to see any other files that might be related. So I came up with the following solution.
I wrote a plugin which I call "local-files", it provides 3 function calls.
getProjects() returns a list of projects I have allowed access to
getProjectTree() returns a JSON formatted file tree of the entire project (with regex based filtering)
getProjectFile() returns the contents of a file.
The plugin makes these requests via a websocket proxy server. It joins a room named using the librechat userid and sends the function calls there and retrieves the results.
On my workstation I run a python program which reads a config file and then joins the same room on the websocket proxy, listens for commands and responds to them appropriately.
For example I can do the following.
"I have just added a new api endpoint 'documents' to the application-backed project, can you suggest tests for it?"
LLM calls getProjects and getProject tree, locates and requests the model, serializer and viewset implementations in my working tree and makes comprehensive tests all in one step.'
I have not yet implemented "writeProjectFile()" but i think about it a lot.
Did i reinvent the wheel here or is this interesting to anyone else?
The plugin itself is quite simple.
The websocket proxy I implemented using a separate django-channels container, but it would be trivial to build it into the librechat backend, it is just a 'room chat' server where the rooms are named with the userid. The python script is also quite straight forward.
There is very little thought given to security right now.
Beta Was this translation helpful? Give feedback.
All reactions