diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index ef6fe19..512b6c2 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,7 +2,7 @@ ## Our Pledge -We as members, contributors, and leaders pledge to make participation in our +We as members, contributors, and leaders, pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, @@ -10,20 +10,20 @@ nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. +diverse, inclusive, and a healthy community. ## Our Standards -Examples of behavior that contributes to a positive environment for our +Examples of behavior that contribute to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences +* Demonstrating empathy and kindness towards other people +* Being respectful and open to differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience +* Taking accountability and offering apologies to those who have been impacted by our errors, + while also gaining insights from the situation * Focusing on what is best not just for us as individuals, but for the - overall community + community as a whole Examples of unacceptable behavior include: @@ -31,7 +31,7 @@ Examples of unacceptable behavior include: advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment -* Publishing others' private information, such as a physical or email +* Publishing other's private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting @@ -74,7 +74,7 @@ the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. +unprofessional or unwelcome in the community space. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the @@ -107,7 +107,7 @@ Violating these terms may lead to a permanent ban. **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. +individual, or aggression towards or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. diff --git a/application/app.py b/application/app.py index 41b821b..e97febc 100644 --- a/application/app.py +++ b/application/app.py @@ -1,68 +1,41 @@ import platform - - import dotenv from application.celery import celery from flask import Flask, request, redirect - - from application.core.settings import settings from application.api.user.routes import user from application.api.answer.routes import answer from application.api.internal.routes import internal - - -# Redirect PosixPath to WindowsPath on Windows - if platform.system() == "Windows": import pathlib - - temp = pathlib.PosixPath pathlib.PosixPath = pathlib.WindowsPath -# loading the .env file dotenv.load_dotenv() - - app = Flask(__name__) app.register_blueprint(user) app.register_blueprint(answer) app.register_blueprint(internal) -app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER = "inputs" -app.config["CELERY_BROKER_URL"] = settings.CELERY_BROKER_URL -app.config["CELERY_RESULT_BACKEND"] = settings.CELERY_RESULT_BACKEND -app.config["MONGO_URI"] = settings.MONGO_URI +app.config.update( + UPLOAD_FOLDER="inputs", + CELERY_BROKER_URL=settings.CELERY_BROKER_URL, + CELERY_RESULT_BACKEND=settings.CELERY_RESULT_BACKEND, + MONGO_URI=settings.MONGO_URI +) celery.config_from_object("application.celeryconfig") - - @app.route("/") def home(): - """ - The frontend source code lives in the /frontend directory of the repository. - """ - if request.remote_addr in ('0.0.0.0', '127.0.0.1', 'localhost', '172.18.0.1'): - # If users locally try to access DocsGPT running in Docker, - # they will be redirected to the Frontend application. - return redirect('http://localhost:5173') - else: - # Handle other cases or render the default page - return 'Welcome to DocsGPT Backend!' - + return redirect('http://localhost:5173') if request.remote_addr in ('0.0.0.0', '127.0.0.1', 'localhost', '172.18.0.1') else 'Welcome to DocsGPT Backend!' - - -# handling CORS @app.after_request def after_request(response): response.headers.add("Access-Control-Allow-Origin", "*") response.headers.add("Access-Control-Allow-Headers", "Content-Type,Authorization") response.headers.add("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS") - # response.headers.add("Access-Control-Allow-Credentials", "true") return response - if __name__ == "__main__": app.run(debug=True, port=7091) + diff --git a/docker-compose.yaml b/docker-compose.yaml index 7535a4b..84cc568 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -19,7 +19,6 @@ services: - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/1 - MONGO_URI=mongodb://mongo:27017/docsgpt - - SELF_HOSTED_MODEL=$SELF_HOSTED_MODEL ports: - "7091:7091" volumes: diff --git a/docs/pages/Deploying/Hosting-the-app.md b/docs/pages/Deploying/Hosting-the-app.md index fe9f16f..7505f60 100644 --- a/docs/pages/Deploying/Hosting-the-app.md +++ b/docs/pages/Deploying/Hosting-the-app.md @@ -4,7 +4,7 @@ Here's a step-by-step guide on how to setup an Amazon Lightsail instance to host ## Configuring your instance -(If you know how to create a Lightsail instance, you can skip to the recommended configuration part by clicking here) +(If you know how to create a Lightsail instance, you can skip to the recommended configuration part by clicking here). ### 1. Create an account or login to https://lightsail.aws.amazon.com @@ -36,7 +36,7 @@ Your instance will be ready for use a few minutes after being created. To access #### Clone the repository -A terminal window will pop up, and the first step will be to clone the DocsGPT git repository. +A terminal window will pop up, and the first step will be to clone the DocsGPT git repository: `git clone https://github.com/arc53/DocsGPT.git` @@ -64,11 +64,11 @@ Enter the following command to access the folder in which DocsGPT docker-compose #### Prepare the environment -Inside the DocsGPT folder create a .env file and copy the contents of .env_sample into it. +Inside the DocsGPT folder create a `.env` file and copy the contents of `.env_sample` into it. `nano .env` -Make sure your .env file looks like this: +Make sure your `.env` file looks like this: ``` OPENAI_API_KEY=(Your OpenAI API key) @@ -103,10 +103,10 @@ Before you are able to access your live instance, you must first enable the port Open your Lightsail instance and head to "Networking". -Then click on "Add rule" under "IPv4 Firewall", enter 5173 as your port, and hit "Create". -Repeat the process for port 7091. +Then click on "Add rule" under "IPv4 Firewall", enter `5173` as your port, and hit "Create". +Repeat the process for port `7091`. #### Access your instance -Your instance will now be available under your Public IP Address and port 5173. Enjoy! +Your instance will now be available under your Public IP Address and port `5173`. Enjoy! diff --git a/docs/pages/Deploying/Quickstart.md b/docs/pages/Deploying/Quickstart.md index 6c0b974..2cc03c5 100644 --- a/docs/pages/Deploying/Quickstart.md +++ b/docs/pages/Deploying/Quickstart.md @@ -9,23 +9,23 @@ It will install all the dependencies and give you an option to download the loca Otherwise, refer to this Guide: -1. Open and download this repository with `git clone https://github.com/arc53/DocsGPT.git` -2. Create a .env file in your root directory and set your `API_KEY` with your openai api key -3. Run `docker-compose build && docker-compose up` -4. Navigate to `http://localhost:5173/` +1. Open and download this repository with `git clone https://github.com/arc53/DocsGPT.git`. +2. Create a `.env` file in your root directory and set your `API_KEY` with your [OpenAI api key](https://platform.openai.com/account/api-keys). +3. Run `docker-compose build && docker-compose up`. +4. Navigate to `http://localhost:5173/`. -To stop just run Ctrl + C +To stop just run `Ctrl + C`. ### Chrome Extension To install the Chrome extension: -1. In the DocsGPT GitHub repository, click on the "Code" button and select Download ZIP -2. Unzip the downloaded file to a location you can easily access -3. Open the Google Chrome browser and click on the three dots menu (upper right corner) -4. Select "More Tools" and then "Extensions" -5. Turn on the "Developer mode" switch in the top right corner of the Extensions page -6. Click on the "Load unpacked" button -7. Select the "Chrome" folder where the DocsGPT files have been unzipped (docsgpt-main > extensions > chrome) -8. The extension should now be added to Google Chrome and can be managed on the Extensions page +1. In the DocsGPT GitHub repository, click on the "Code" button and select "Download ZIP". +2. Unzip the downloaded file to a location you can easily access. +3. Open the Google Chrome browser and click on the three dots menu (upper right corner). +4. Select "More Tools" and then "Extensions". +5. Turn on the "Developer mode" switch in the top right corner of the Extensions page. +6. Click on the "Load unpacked" button. +7. Select the "Chrome" folder where the DocsGPT files have been unzipped (docsgpt-main > extensions > chrome). +8. The extension should now be added to Google Chrome and can be managed on the Extensions page. 9. To disable or remove the extension, simply turn off the toggle switch on the extension card or click the "Remove" button. diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 4109eb1..2583874 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -1,8 +1,8 @@ -App currently has two main api endpoints: +Currently, the application provides the following main API endpoints: ### /api/answer -Its a POST request that sends a JSON in body with 4 values. Here is a JavaScript fetch example -It will receive an answer for a user provided question +It's a POST request that sends a JSON in body with 4 values. It will receive an answer for a user provided question. +Here is a JavaScript fetch example: ```js // answer (POST http://127.0.0.1:5000/api/answer) @@ -29,8 +29,8 @@ In response you will get a json document like this one: ``` ### /api/docs_check -It will make sure documentation is loaded on a server (just run it every time user is switching between libraries (documentations) -Its a POST request that sends a JSON in body with 1 value. Here is a JavaScript fetch example +It will make sure documentation is loaded on a server (just run it every time user is switching between libraries (documentations)). +It's a POST request that sends a JSON in body with 1 value. Here is a JavaScript fetch example: ```js // answer (POST http://127.0.0.1:5000/api/docs_check) @@ -54,10 +54,10 @@ In response you will get a json document like this one: ### /api/combine -Provides json that tells UI which vectors are available and where they are located with a simple get request +Provides json that tells UI which vectors are available and where they are located with a simple get request. -Respsonse will include: -date, description, docLink, fullName, language, location (local or docshub), model, name, version +Response will include: +`date`, `description`, `docLink`, `fullName`, `language`, `location` (local or docshub), `model`, `name`, `version`. Example of json in Docshub and local: @@ -69,15 +69,14 @@ HTML example: ```html
+ + + + + + ``` Response: @@ -90,7 +89,7 @@ Response: ``` ### /api/task_status -Gets task status (task_id) from /api/upload +Gets task status (`task_id`) from `/api/upload`: ```js // Task status (Get http://127.0.0.1:5000/api/task_status) fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4fe2e7454d1", { @@ -105,7 +104,7 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f Responses: There are two types of responses: -1. while task it still running, where "current" will show progress from 0 - 100 +1. while task it still running, where "current" will show progress from 0 to 100 ```json { "result": { @@ -134,7 +133,7 @@ There are two types of responses: ``` ### /api/delete_old -deletes old vecotstores +Deletes old vectorstores: ```js // Task status (GET http://127.0.0.1:5000/api/docs_check) fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4fe2e7454d1", { @@ -146,7 +145,8 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f .then((res) => res.text()) .then(console.log.bind(console)) ``` -response: + +Response: ```json { "status": "ok" } diff --git a/docs/pages/Extensions/Chatwoot-extension.md b/docs/pages/Extensions/Chatwoot-extension.md index 09420f4..4dd5782 100644 --- a/docs/pages/Extensions/Chatwoot-extension.md +++ b/docs/pages/Extensions/Chatwoot-extension.md @@ -1,9 +1,8 @@ ### To start chatwoot extension: -1. Prepare and start the DocsGPT itself (load your documentation too) -Follow our [wiki](https://github.com/arc53/DocsGPT/wiki) to start it and to [ingest](https://github.com/arc53/DocsGPT/wiki/How-to-train-on-other-documentation) data -2. Go to chatwoot, Navigate to your profile (bottom left), click on profile settings, scroll to the bottom and copy Access Token -2. Navigate to `/extensions/chatwoot`. Copy .env_sample and create .env file -3. Fill in the values +1. Prepare and start the DocsGPT itself (load your documentation too). Follow our [wiki](https://github.com/arc53/DocsGPT/wiki) to start it and to [ingest](https://github.com/arc53/DocsGPT/wiki/How-to-train-on-other-documentation) data. +2. Go to chatwoot, **Navigate** to your profile (bottom left), click on profile settings, scroll to the bottom and copy **Access Token**. +3. Navigate to `/extensions/chatwoot`. Copy `.env_sample` and create `.env` file. +4. Fill in the values. ``` docsgpt_url=DocsGPT
🦖
+ DocsGPT will use your data to answer questions. Whether its + documentation, source code, or Microsoft files, DocsGPT allows you + to have interactive conversations and find answers based on the + provided data. +
++ The security of your data is our top priority. DocsGPT ensures the + utmost protection for your sensitive information. With secure data + storage and privacy measures in place, you can trust that your + data is kept safe and confidential. +
++ DocsGPT is built on open source principles, promoting transparency + and collaboration. The source code is freely available, enabling + developers to contribute, enhance, and customize the app to meet + their specific needs. +
+