Skip to content

Commit

Permalink
Merge pull request #728 from ka1bi4/update/docs-improve-and-fixes
Browse files Browse the repository at this point in the history
Update/docs improve and fixes
  • Loading branch information
dartpain authored Oct 30, 2023
2 parents ba7a8fc + 560c063 commit 0a0a6ba
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 90 deletions.
22 changes: 10 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

### 1. Clone the DocsGPT repository:

```
```bash
git clone https://github.com/arc53/DocsGPT.git
```
### 2. Navigate to the docs folder:

```
```bash
cd DocsGPT/docs
```

The docs folder contains the markdown files that make up the documentation. The majority of the files are in the pages directory. Some notable files in this folder include:

`index.mdx`: The main documentation file.
Expand All @@ -22,30 +21,29 @@ The docs folder contains the markdown files that make up the documentation. The

### 3. Verify that you have Node.js and npm installed in your system. You can check by running:

```
```bash
node --version
npm --version
```

### 4. If not installed, download Node.js and npm from the respective official websites.

### 5. Once you have Node.js and npm running, proceed to install yarn - another package manager that helps to manage project dependencies:

```
```bash
npm install --global yarn
```

### 6. Install the project dependencies using yarn:

```
```bash
yarn install
```

### 7. After the successful installation of the project dependencies, start the local server:

```
```bash
yarn dev
```

- Now, you should be able to view the docs on your local environment by visiting `http://localhost:5000`. You can explore the different markdown files and make changes as you see fit.
Expand Down
74 changes: 44 additions & 30 deletions docs/pages/Deploying/Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@
**Note**: Make sure you have Docker installed

**On macOS or Linux:**
Just run the following command::
Just run the following command:

`./setup.sh`
```bash
./setup.sh
```

This command will install all the necessary dependencies and provide you with an option to download the local model or use OpenAI.

If you prefer to follow manual steps, refer to this guide:

1. Open and download this repository with
`git clone https://github.com/arc53/DocsGPT.git`.
```bash
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 the following commands:
`docker-compose build && docker-compose up`.
4. Navigate to `http://localhost:5173/`.
```bash
docker-compose build && docker-compose up
```
4. Navigate to http://localhost:5173/.

To stop, simply press Ctrl + C.
To stop, simply press **Ctrl + C**.

**For WINDOWS:**

Expand All @@ -28,32 +34,36 @@ To run the setup on Windows, you have two options: using the Windows Subsystem f
1. Install WSL if you haven't already. You can follow the official Microsoft documentation for installation: (https://learn.microsoft.com/en-us/windows/wsl/install).
2. After setting up WSL, open the WSL terminal.
3. Clone the repository and create the `.env` file:
```
```bash
git clone https://github.com/arc53/DocsGPT.git
cd DocsGPT
echo "API_KEY=Yourkey" > .env
echo "VITE_API_STREAMING=true" >> .env
```
4. Run the following command to start the setup with Docker Compose:
`./run-with-docker-compose.sh`
5. Open your web browser and navigate to (http://localhost:5173/).
6. To stop the setup, just press `Ctrl + C` in the WSL terminal
```bash
./run-with-docker-compose.sh
```
6. Open your web browser and navigate to http://localhost:5173/.
7. To stop the setup, just press **Ctrl + C** in the WSL terminal

**Option 2: Using Git Bash or Command Prompt (CMD):**

1. Install Git for Windows if you haven't already. Download it from the official website: (https://gitforwindows.org/).
2. Open Git Bash or Command Prompt.
3. Clone the repository and create the `.env` file:
```
```bash
git clone https://github.com/arc53/DocsGPT.git
cd DocsGPT
echo "API_KEY=Yourkey" > .env
echo "VITE_API_STREAMING=true" >> .env
```
4.Run the following command to start the setup with Docker Compose:
`./run-with-docker-compose.sh`
5.Open your web browser and navigate to (http://localhost:5173/).
6.To stop the setup, just press Ctrl + C in the Git Bash or Command Prompt terminal.
4. Run the following command to start the setup with Docker Compose:
```bash
./run-with-docker-compose.sh
```
5. Open your web browser and navigate to http://localhost:5173/.
6. To stop the setup, just press **Ctrl + C** in the Git Bash or Command Prompt terminal.

These steps should help you set up and run the project on Windows using either WSL or Git Bash/Command Prompt.
**Important:** Ensure that Docker is installed and properly configured on your Windows system for these steps to work.
Expand All @@ -68,32 +78,36 @@ Option 1: Using Windows Subsystem for Linux (WSL):
1. Install WSL if you haven't already. You can follow the official Microsoft documentation for installation: (https://learn.microsoft.com/en-us/windows/wsl/install).
2. After setting up WSL, open the WSL terminal.
3. Clone the repository and create the `.env` file:
```
```bash
git clone https://github.com/arc53/DocsGPT.git
cd DocsGPT
echo "API_KEY=Yourkey" > .env
echo "VITE_API_STREAMING=true" >> .env
```
4. Run the following command to start the setup with Docker Compose:
`./run-with-docker-compose.sh`
5. Open your web browser and navigate to (http://localhost:5173/).
6. To stop the setup, just press `Ctrl + C` in the WSL terminal
```bash
./run-with-docker-compose.sh
```
5. Open your web browser and navigate to http://localhost:5173/.
6. To stop the setup, just press **Ctrl + C** in the WSL terminal.

Option 2: Using Git Bash or Command Prompt (CMD):

1. Install Git for Windows if you haven't already. You can download it from the official website: (https://gitforwindows.org/).
2. Open Git Bash or Command Prompt.
3. Clone the repository and create the `.env` file:
```
```bash
git clone https://github.com/arc53/DocsGPT.git
cd DocsGPT
echo "API_KEY=Yourkey" > .env
echo "VITE_API_STREAMING=true" >> .env
```
4.Run the following command to start the setup with Docker Compose:
`./run-with-docker-compose.sh`
5.Open your web browser and navigate to (http://localhost:5173/).
6.To stop the setup, just press Ctrl + C in the Git Bash or Command Prompt terminal.
4. Run the following command to start the setup with Docker Compose:
```bash
./run-with-docker-compose.sh
```
5. Open your web browser and navigate to http://localhost:5173/.
6. To stop the setup, just press **Ctrl + C** in the Git Bash or Command Prompt terminal.
These steps should help you set up and run the project on Windows using either WSL or Git Bash/Command Prompt. Make sure you have Docker installed and properly configured on your Windows system for this to work.
Expand All @@ -103,12 +117,12 @@ These steps should help you set up and run the project on Windows using either W
#### Installing the Chrome extension:
To enhance your DocsGPT experience, you can install the DocsGPT Chrome extension. Here's how:

1. In the DocsGPT GitHub repository, click on the "Code" button and select "Download ZIP".
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).
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.
9. To disable or remove the extension, simply turn off the toggle switch on the extension card or click the **Remove** button.
106 changes: 58 additions & 48 deletions docs/pages/Developing/API-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ This endpoint is used to request answers to user-provided questions.

**Request:**

Method: POST
Headers: Content-Type should be set to "application/json; charset=utf-8"
Request Body: JSON object with the following fields:
* **question:** The user's question
* **history:** (Optional) Previous conversation history
* **api_key:** Your API key
* **embeddings_key:** Your embeddings key
* **active_docs:** The location of active documentation
**Method**: `POST`

**Headers**: Content-Type should be set to `application/json; charset=utf-8`

**Request Body**: JSON object with the following fields:
* `question` — The user's question.
* `history` — (Optional) Previous conversation history.
* `api_key`— Your API key.
* `embeddings_key` — Your embeddings key.
* `active_docs` — The location of active documentation.

Here is a JavaScript Fetch Request example:
```js
Expand All @@ -36,7 +38,7 @@ fetch("http://127.0.0.1:5000/api/answer", {

**Response**

In response, you will get a JSON document containing the answer,query and the result:
In response, you will get a JSON document containing the `answer`, `query` and `result`:
```json
{
"answer": "Hi there! How can I help you?\n",
Expand All @@ -53,9 +55,10 @@ This endpoint will make sure documentation is loaded on the server (just run it

**Request:**

Headers: Content-Type should be set to "application/json; charset=utf-8"
Request Body: JSON object with the field:
* **docs:** The location of the documentation
**Headers**: Content-Type should be set to `application/json; charset=utf-8`

**Request Body**: JSON object with the field:
* `docs` — The location of the documentation:
```js
// answer (POST http://127.0.0.1:5000/api/docs_check)
fetch("http://127.0.0.1:5000/api/docs_check", {
Expand All @@ -71,7 +74,7 @@ fetch("http://127.0.0.1:5000/api/docs_check", {

**Response:**

In response, you will get a JSON document like this one indicating whether the documentation exists or not.:
In response, you will get a JSON document like this one indicating whether the documentation exists or not:
```json
{
"status": "exists"
Expand All @@ -86,28 +89,34 @@ This endpoint provides information about available vectors and their locations w

**Request:**

Method: GET
**Method**: `GET`

**Response:**

Response will include:
`date`, `description`, `docLink`, `fullName`, `language`, `location` (local or docshub), `model`, `name`, `version`.

* `date`
* `description`
* `docLink`
* `fullName`
* `language`
* `location` (local or docshub)
* `model`
* `name`
* `version`

Example of JSON in Docshub and local:

<img width="295" alt="image" src="https://user-images.githubusercontent.com/15183589/224714085-f09f51a4-7a9a-4efb-bd39-798029bb4273.png">


### 4. /api/upload
**Description:**

This endpoint is used to upload a file that needs to be trained, response is JSON with task ID, which can be used to check on task's progress.

**Request:**

Method: POST
Request Body: A multipart/form-data form with file upload and additional fields, including "user" and "name."
**Method**: `POST`
**Request Body**: A multipart/form-data form with file upload and additional fields, including `user` and `name`.

HTML example:

Expand All @@ -134,8 +143,8 @@ JSON response with a status and a task ID that can be used to check the task's p
This endpoint is used to get the status of a task (`task_id`) from `/api/upload`

**Request:**
Method: GET
Query Parameter: task_id (task ID to check)
**Method**: `GE`T
**Query Parameter**: `task_id` (task ID to check)

**Sample JavaScript Fetch Request:**
```js
Expand All @@ -155,33 +164,32 @@ fetch("http://localhost:5001/api/task_status?task_id=YOUR_TASK_ID", {
There are two types of responses:

1. While the task is still running, the 'current' value will show progress from 0 to 100.

```json
{
"result": {
"current": 1
},
"status": "PROGRESS"
}
```
```json
{
"result": {
"current": 1
},
"status": "PROGRESS"
}
```

2. When task is completed:
```json
{
"result": {
"directory": "temp",
"filename": "install.rst",
"formats": [
".rst",
".md",
".pdf"
],
"name_job": "somename",
"user": "local"
},
"status": "SUCCESS"
}
```
```json
{
"result": {
"directory": "temp",
"filename": "install.rst",
"formats": [
".rst",
".md",
".pdf"
],
"name_job": "somename",
"user": "local"
},
"status": "SUCCESS"
}
```

### 6. /api/delete_old
**Description:**
Expand All @@ -190,7 +198,8 @@ This endpoint is used to delete old Vector Stores.

**Request:**

Method: GET
**Method**: `GET`

```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", {
Expand All @@ -205,7 +214,8 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f
```
**Response:**

JSON response indicating the status of the operation.
JSON response indicating the status of the operation:

```json
{ "status": "ok" }
```

2 comments on commit 0a0a6ba

@vercel
Copy link

@vercel vercel bot commented on 0a0a6ba Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextra-docsgpt – ./docs

nextra-docsgpt.vercel.app
nextra-docsgpt-arc53.vercel.app
docs.docsgpt.co.uk
nextra-docsgpt-git-main-arc53.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0a0a6ba Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs-gpt – ./frontend

docs-gpt-git-main-arc53.vercel.app
docs-gpt-arc53.vercel.app
docs-gpt-brown.vercel.app

Please sign in to comment.