ClickerAI / AnyGPT

telegram/slack bot that posts a result on inference on model as a reply in text chats , supporting modalities of in/out: text image video + instruct text image + instruct text link + instruct text github repo/issue/org/user zip file pdf file with persistent per channel and global split on channels memory
1 stars 0 forks source link

Mock api interface #1

Open darvin opened 1 year ago

darvin commented 1 year ago

Make mock api interface for https://github.com/ClickerAI/Chat

codeautopilot[bot] commented 1 year ago

Solution:

To create a mock API interface for https://github.com/ClickerAI/Chat, we can use FastAPI to implement the REST API and Websocket API. We can start by importing the necessary modules and dependencies in the main.py file. Then, we can define the endpoints for the REST API and the WebSocket API using the FastAPI decorators. We also need to define the necessary functions and logic to handle the requests and responses for each endpoint. It is important to test the implementation thoroughly to ensure it works as expected.

For Github and Google authentication, we can use a library like python-social-auth or django-allauth. These libraries provide easy integration with various social authentication providers including Github and Google. We can install the library of our choice using pip and follow the documentation to configure the library with our Github and Google API credentials. Once configured, we can use the library's authentication views and templates to handle the authentication flow.

To summarize, we need to implement the REST API and Websocket API using FastAPI in main.py and use a library like python-social-auth or django-allauth to implement Github and Google authentication in auth.py. We also need to update the requirements.txt file with the new library and its version.

Changes on main.py To implement the REST API and Websocket API using FastAPI in this file, you can start by importing the necessary modules and dependencies. Then, define the endpoints for the REST API and the WebSocket API using the FastAPI decorators. You can also define the necessary functions and logic to handle the requests and responses for each endpoint. Make sure to test your implementation thoroughly to ensure it works as expected.
Changes on auth.py To implement Github and Google authentication in this file, you can use a library like `python-social-auth` or `django-allauth`. These libraries provide easy integration with various social authentication providers including Github and Google. First, install the library of your choice using pip. Then, follow the documentation to configure the library with your Github and Google API credentials. Once configured, you can use the library's authentication views and templates to handle the authentication flow. Make sure to update the `requirements.txt` file with the new library and its version.
darvin commented 1 year ago

use websockets instead of rest