From d37885ea88bc96d750f705008d46a89286931eda Mon Sep 17 00:00:00 2001 From: Roman Zhukov Date: Thu, 5 Oct 2023 20:27:48 +0300 Subject: [PATCH 1/8] Update doc formatting and fix some spelling. --- docs/pages/Deploying/Hosting-the-app.md | 14 +++---- docs/pages/Deploying/Quickstart.md | 26 ++++++------ docs/pages/Developing/API-docs.md | 42 +++++++++---------- docs/pages/Extensions/Chatwoot-extension.md | 26 ++++++------ docs/pages/Extensions/react-widget.md | 8 ++-- docs/pages/Guides/Customising-prompts.md | 2 +- .../How-to-train-on-other-documentation.md | 7 ++-- docs/pages/Guides/How-to-use-different-LLM.md | 12 +++--- 8 files changed, 68 insertions(+), 69 deletions(-) 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..7ffc967 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. +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..1324f7a 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: image @@ -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 vecotstores: ```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= @@ -12,18 +11,19 @@ docsgpt_key= chatwoot_token= ``` -4. start with `flask run` command +5. Start with `flask run` command. -If you want for bot to stop responding to questions for a specific user or session just add label `human-requested` in your conversation +If you want for bot to stop responding to questions for a specific user or session just add label `human-requested` in your conversation. ### Optional (extra validation) -In app.py uncomment lines 12-13 and 71-75 +In `app.py` uncomment lines 12-13 and 71-75 -in your .env file add: +in your `.env` file add: -`account_id=(optional) 1 ` - -`assignee_id=(optional) 1` +``` +account_id=(optional) 1 +assignee_id=(optional) 1 +``` -Those are chatwoot values and will allow you to check if you are responding to correct widget and responding to questions assigned to specific user \ No newline at end of file +Those are chatwoot values and will allow you to check if you are responding to correct widget and responding to questions assigned to specific user. \ No newline at end of file diff --git a/docs/pages/Extensions/react-widget.md b/docs/pages/Extensions/react-widget.md index 393c736..be4d6bd 100644 --- a/docs/pages/Extensions/react-widget.md +++ b/docs/pages/Extensions/react-widget.md @@ -1,7 +1,7 @@ ### How to set up react docsGPT widget on your website: ### Installation -Got to your project and install a new dependency: `npm install docsgpt` +Got to your project and install a new dependency: `npm install docsgpt`. ### Usage Go to your project and in the file where you want to use the widget import it: @@ -14,9 +14,9 @@ import "docsgpt/dist/style.css"; Then you can use it like this: `` DocsGPTWidget takes 3 props: -- `apiHost` - url of your DocsGPT API -- `selectDocs` - documentation that you want to use for your widget (eg. `default` or `local/docs1.zip`) -- `apiKey` - usually its empty +- `apiHost` — url of your DocsGPT API. +- `selectDocs` — documentation that you want to use for your widget (eg. `default` or `local/docs1.zip`). +- `apiKey` — usually its empty. ### How to use DocsGPTWidget with [Nextra](https://nextra.site/) (Next.js + MDX) Install you widget as described above and then go to your `pages/` folder and create a new file `_app.js` with the following content: diff --git a/docs/pages/Guides/Customising-prompts.md b/docs/pages/Guides/Customising-prompts.md index b74956d..3261b7d 100644 --- a/docs/pages/Guides/Customising-prompts.md +++ b/docs/pages/Guides/Customising-prompts.md @@ -1,4 +1,4 @@ ## To customise a main prompt navigate to `/application/prompt/combine_prompt.txt` -You can try editing it to see how the model responds. +You can try editing it to see how the model responses. diff --git a/docs/pages/Guides/How-to-train-on-other-documentation.md b/docs/pages/Guides/How-to-train-on-other-documentation.md index 0aa24d1..799fa9b 100644 --- a/docs/pages/Guides/How-to-train-on-other-documentation.md +++ b/docs/pages/Guides/How-to-train-on-other-documentation.md @@ -3,14 +3,13 @@ This AI can use any documentation, but first it needs to be prepared for similar ![video-example-of-how-to-do-it](https://d3dg1063dc54p9.cloudfront.net/videos/how-to-vectorise.gif) -Start by going to -`/scripts/` folder +Start by going to `/scripts/` folder. If you open this file you will see that it uses RST files from the folder to create a `index.faiss` and `index.pkl`. -It currently uses OPEN_AI to create vector store, so make sure your documentation is not too big. Pandas cost me around 3-4$ +It currently uses OPEN_AI to create vector store, so make sure your documentation is not too big. Pandas cost me around 3-4$. -You can usually find documentation on github in docs/ folder for most open-source projects. +You can usually find documentation on github in `docs/` folder for most open-source projects. ### 1. Find documentation in .rst/.md and create a folder with it in your scripts directory Name it `inputs/` diff --git a/docs/pages/Guides/How-to-use-different-LLM.md b/docs/pages/Guides/How-to-use-different-LLM.md index 65cce50..aa5815f 100644 --- a/docs/pages/Guides/How-to-use-different-LLM.md +++ b/docs/pages/Guides/How-to-use-different-LLM.md @@ -1,10 +1,10 @@ Fortunately there are many providers for LLM's and some of them can even be ran locally There are two models used in the app: -1. Embeddings -2. Text generation +1. Embeddings. +2. Text generation. -By default we use OpenAI's models but if you want to change it or even run it locally, its very simple! +By default, we use OpenAI's models but if you want to change it or even run it locally, it's very simple! ### Go to .env file or set environment variables: @@ -18,7 +18,7 @@ By default we use OpenAI's models but if you want to change it or even run it lo `VITE_API_STREAMING=` -You dont need to provide keys if you are happy with users providing theirs, so make sure you set LLM_NAME and EMBEDDINGS_NAME +You don't need to provide keys if you are happy with users providing theirs, so make sure you set `LLM_NAME` and `EMBEDDINGS_NAME`. Options: LLM_NAME (openai, manifest, cohere, Arc53/docsgpt-14b, Arc53/docsgpt-7b-falcon) @@ -27,6 +27,6 @@ EMBEDDINGS_NAME (openai_text-embedding-ada-002, huggingface_sentence-transformer That's it! ### Hosting everything locally and privately (for using our optimised open-source models) -If you are working with important data and dont want anything to leave your premises. +If you are working with important data and don't want anything to leave your premises. -Make sure you set SELF_HOSTED_MODEL as true in you .env variable and for your LLM_NAME you can use anything that's on Hugging Face +Make sure you set `SELF_HOSTED_MODEL` as true in you `.env` variable and for your `LLM_NAME` you can use anything that's on Hugging Face. From e0882e9e04d21b4ea49835f636c7e49f91056971 Mon Sep 17 00:00:00 2001 From: ratishjain Date: Thu, 5 Oct 2023 23:16:54 +0530 Subject: [PATCH 2/8] fixed homepage --- frontend/public/lock.svg | 7 ++++ frontend/public/message-programming.svg | 6 +++ frontend/public/message-text.svg | 5 +++ frontend/src/Hero.tsx | 51 ++++++++++++++++++++++++- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 frontend/public/lock.svg create mode 100644 frontend/public/message-programming.svg create mode 100644 frontend/public/message-text.svg diff --git a/frontend/public/lock.svg b/frontend/public/lock.svg new file mode 100644 index 0000000..b85fd5f --- /dev/null +++ b/frontend/public/lock.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/frontend/public/message-programming.svg b/frontend/public/message-programming.svg new file mode 100644 index 0000000..f017810 --- /dev/null +++ b/frontend/public/message-programming.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/frontend/public/message-text.svg b/frontend/public/message-text.svg new file mode 100644 index 0000000..9228566 --- /dev/null +++ b/frontend/public/message-text.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/src/Hero.tsx b/frontend/src/Hero.tsx index 1552887..7199995 100644 --- a/frontend/src/Hero.tsx +++ b/frontend/src/Hero.tsx @@ -1,7 +1,7 @@ export default function Hero({ className = '' }: { className?: string }) { return ( -
-
+
+

DocsGPT

🦖

@@ -17,6 +17,53 @@ export default function Hero({ className = '' }: { className?: string }) { Start by entering your query in the input field below and we will do the rest!

+
+
+
+ lock +

Chat with Your Data

+

+ 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. +

+
+
+ +
+
+ lock +

Secure Data Storage

+

+ 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. +

+
+
+
+
+ lock +

Open Source Code

+

+ 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. +

+
+
+
); } From f0e87094d6c5f8e7b26fb91c9276bdd8ef02c75e Mon Sep 17 00:00:00 2001 From: ratishjain Date: Thu, 5 Oct 2023 23:24:09 +0530 Subject: [PATCH 3/8] fixed homepage --- frontend/src/conversation/Conversation.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 79e62da..ab43576 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -113,7 +113,7 @@ export default function Conversation() { }; return ( -
+
{queries.length > 0 && !hasScrolledToLast ? (