Skip to content

Commit

Permalink
Merge pull request #681 from nobunagaaa/docs/enhance
Browse files Browse the repository at this point in the history
Enhancement: Update react-widget.md docs
  • Loading branch information
dartpain authored Oct 25, 2023
2 parents fefc856 + e0dce8f commit d74d69c
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions docs/pages/Extensions/react-widget.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
### How to set up react docsGPT widget on your website:
### Setting up the DocsGPT Widget in Your React Project

### Introduction:
The DocsGPT Widget is a powerful tool that allows you to integrate AI-powered documentation assistance into your web applications. This guide will walk you through the installation and usage of the DocsGPT Widget in your React project. Whether you're building a web app or a knowledge base, this widget can enhance your user experience.

### Installation
Go to your project and install a new dependency: `npm install docsgpt`.
First, make sure you have Node.js and npm installed in your project. Then go 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:
In the file where you want to use the widget, import it and include the CSS file:
```js
import { DocsGPTWidget } from "docsgpt";
import "docsgpt/dist/style.css";
```


Then you can use it like this: `<DocsGPTWidget />`

DocsGPTWidget takes 3 props:
1. `apiHost` — URL of your DocsGPT API.
2. `selectDocs` — documentation that you want to use for your widget (e.g. `default` or `local/docs1.zip`).
3. `apiKey` — usually it's empty.
Now, you can use the widget in your component like this :
```jsx
<DocsGPTWidget
apiHost="https://your-docsgpt-api.com"
selectDocs="local/docs.zip"
apiKey=""
/>
```
DocsGPTWidget takes 3 **props**:
1. `apiHost` — The URL of your DocsGPT API.
2. `selectDocs` — The documentation source that you want to use for your widget (e.g. `default` or `local/docs1.zip`).
3. `apiKey` — Usually, it's empty.

### How to use DocsGPTWidget with [Nextra](https://nextra.site/) (Next.js + MDX)
Install your widget as described above and then go to your `pages/` folder and create a new file `_app.js` with the following content:
Expand All @@ -32,6 +41,6 @@ export default function MyApp({ Component, pageProps }) {
</>
)
}
```
```


1 comment on commit d74d69c

@vercel
Copy link

@vercel vercel bot commented on d74d69c Oct 25, 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.