Skip to content

Commit

Permalink
docs: improve quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
wenfengwang committed Apr 25, 2024
1 parent 7d8eaab commit 708a7be
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 27 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,24 @@ Verify the installation by running `npi version`. If you see the output similar
}
```

#### Setting Up NPi Server with Docker
#### Setting Up NPi Server

Replace `YOUR_OAI_KEY` with your actual OpenAI API Key, then execute:

```sh
docker run -d --name npi \
docker run -d --name npi --pull always \
-p 9140:9140 \
-p 9141:9141 \
-e OPENAI_API_KEY=YOUR_OAI_KEY \
npiai/npi:v0.0.1
-e OPENAI_API_KEY=YOUR_OAI_KEY npiai/npi
```

if you run on macOS, please use:

```sh
docker run -d --name npi \
docker run -d --name npi --pull always \
-p 9140:9140 \
-p 9141:9141 \
-e OPENAI_API_KEY=YOUR_OAI_KEY \
npiai/npi-mac:v0.0.1
-e OPENAI_API_KEY=YOUR_OAI_KEY npiai/npi-mac
```

Confirm server connectivity by running `npi connect test`. If you receive a `NPi Server is operational!` message, the
Expand All @@ -72,11 +70,13 @@ to [NPi GitHub Repository](https://github.com/npi-ai/npi/issues/new).

#### Authorize NPi to access your GitHub account

Generate a new token via [GitHub Tokens Page](https://github.com/settings/tokens) for NPi, and authorize NPi's access to
your GitHub account with the following command. You may need to grant the `repo` scope so that NPi can access
Generate a new token via [GitHub Tokens Page](https://github.com/settings/tokens) for NPi, you may need to grant the `repo` scope so that NPi can access
repositories on behalf of
you. ([Read more about scopes](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps))

![img.png](docs/assets/github-token-grant-repo.png)

and authorize NPi's access to your GitHub account with the following command.
```sh
npi auth github --access-token YOUR_GITHUB_ACCESS_TOKEN
```
Expand Down
Binary file added docs/assets/github-token-grant-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/pages/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ import { Todo } from '@components/todo';

# Command line tool

This content is rolling out in the next few days. Stay back later👀.
63 changes: 46 additions & 17 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,31 @@ NPi (**N**atural-language **P**rogramming **I**nterface), pronounced as **"N π"

### Installation

<Tabs items={['arm64','amd64']}>
<Tabs items={['macOS/arm64','macOS/amd64','linux/arm64','linux/amd64']}>
<Tabs.Tab >
```sh
curl -O https://s.npi.ai/cli/v0.0.1/arm64/npi
curl -O https://s.npi.ai/cli/v0.0.1/darwin/arm64/npi
chmod +x npi
sudo mv npi /usr/local/bin
```
</Tabs.Tab>
<Tabs.Tab >
```sh
curl -O https://s.npi.ai/cli/v0.0.1/amd64/npi
curl -O https://s.npi.ai/cli/v0.0.1/darwin/amd64/npi
chmod +x npi
sudo mv npi /usr/local/bin
```
</Tabs.Tab>
<Tabs.Tab >
```sh
curl -O https://s.npi.ai/cli/v0.0.1/linux/amd64/npi
chmod +x npi
sudo mv npi /usr/local/bin
```
</Tabs.Tab>
<Tabs.Tab >
```sh
curl -O https://s.npi.ai/cli/v0.0.1/linux/amd64/npi
chmod +x npi
sudo mv npi /usr/local/bin
```
Expand All @@ -36,30 +50,45 @@ NPi (**N**atural-language **P**rogramming **I**nterface), pronounced as **"N π"

```json
{
"BuildDate": "2024-04-23_02:23:50-0700",
"GitCommit": "934739f",
"BuildDate": "2024-04-25_10:15:33-0500",
"GitCommit": "5ae9953",
"Platform": "darwin/arm64",
"Version": "v0.0.0"
"Version": "v0.0.1"
}
```

### Setting Up NPi Server with Docker
### Setting Up NPi Server

Replace `YOUR_OAI_KEY` with your actual OpenAI API Key, then execute:

<Tabs items={['macOS', 'linux']}>
<Tabs.Tab >
```sh
docker run -d --name npi --pull always \
-p 9140:9140 \
-p 9141:9141 \
-e OPENAI_API_KEY=YOUR_OAI_KEY npiai/npi-mac:latest
```
</Tabs.Tab>
<Tabs.Tab >
```sh
docker run -d --name npi --pull always \
-p 9140:9140 \
-p 9141:9141 \
-e OPENAI_API_KEY=YOUR_OAI_KEY npiai/npi:latest
```
</Tabs.Tab>
</Tabs>

Replace `{YOUR_OAI_KEY}` with your actual OpenAI API Key, then execute:

```sh
docker run -d --name npi \
-p 9140:9140 \
-p 9141:9141 \
-e OPENAI_API_KEY={YOUR_OAI_KEY} \
npiai/npi
```

Confirm server connectivity by running `npi connect test`. If you receive a `server connected` message, the setup is successful. Otherwise, consult the logs with `docker logs npi` and report issues to [NPi GitHub Repository](https://github.com/npi-ai/npi/issues/new).

### Authorize NPi to access your GitHub account

Generate a new token via [GitHub Tokens Page](https://github.com/settings/tokens) for NPi, and authorize NPi's access to your GitHub account with the following command. You may need to grant the `repo` scope so that NPi can access repositories on behalf of you. ([Read more about scopes](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps))
Generate a new token via [GitHub Tokens Page](https://github.com/settings/tokens) for NPi, you may need to grant the `repo` scope so that NPi can access repositories on behalf of you. ([Read more about scopes](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps))
![grant-repo-scope](../assets/github-token-grant-repo.png)

and authorize NPi's access to your GitHub account with the following command.
```sh
npi auth github --access-token YOUR_GITHUB_ACCESS_TOKEN
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ import { Todo } from '@components/todo';

<Todo />

# Python SDK Reference
# Python SDK Reference

This content is rolling out in the next few days. Stay back later👀.

0 comments on commit 708a7be

Please sign in to comment.