Skip to content

Commit

Permalink
fix: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeikang committed Mar 5, 2023
1 parent 0951dcd commit 275c14e
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 132 deletions.
102 changes: 0 additions & 102 deletions README.ja.md

This file was deleted.

46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,41 @@

# AI Tools for chatGPT

This CLI tool allows you to conveniently use chatGPT in the command line. You can chat with it, ask questions, and even have it translate text. It also supports rendering Markdown in the terminal.
This CLI tool allows you to easily use chatGPT in the command line. You can chat with it, ask it questions and get answers. It can also help you translate text and supports markdown rendering in the terminal.

[English](README.md) | [中文](README.zh.md) | [日本語](README.ja.md)
[English](README.md)| [中文](README_zh.md) | [日本語](README_ja.md)

## Dependencies

* OPENAI_API_BASE (Optional)
* OPENAI_API_BASE (optional)

If you're unable to access `https://api.openai.com` due to the Great Firewall of China, you can specify an alternate API endpoint using the `OPENAI_API_BASE` environment variable. We recommend using this method as
it is more stable than traditional proxies. Here's an article that explains how to set up a Cloudflare Workers proxy: [Using Cloudflare Workers to Proxy OpenAI
API](https://github.com/noobnooc/noobnooc/discussions/9).
If you cannot access `https://api.openai.com` because of the GFW, you can specify another API address through the `OPENAI_API_BASE` environment variable. It is recommended to use this method, which is more stable
than using a proxy. You can refer to this article on how to use Cloudflare Workers to set up an OpenAI API proxy: [Using Cloudflare Workers build OpenAI API proxy](https://github.com/noobnooc/noobnooc/discussions/9)

* OPENAI_API_KEY

You can set the `OPENAI_API_KEY` environment variable or specify it using the `--api-key` argument. You can also set it using the `ai setting` command.
You can set the `OPENAI_API_KEY` environment variable or specify it through the `--api-key` parameter. You can also set it through the `ai setting` command.

## Installation

```bash
pip install py-ai-cli
```

Or install the latest version:
Or install the latest version.

```bash
pip install git+https://github.com/yufeikang/ai-cli.git
```

## Configuration

You can use the `ai setting` command to set your `api-key` and `api-base`. You can also use environment variables and CLI arguments.
You can now set the API key and API base through the `ai setting` command. Environment variables and CLI parameters are still valid.

```bash
# view settings
# view setting
ai setting
# set settings
# set
ai setting -e
```

Expand All @@ -46,9 +45,9 @@ ai setting -e
Ask a question

```bash
ai ask "Hello"
ai ask "你好"
# no stream mode
ai --no-stream ask "Hello"
ai --no-stream ask "你好"
# help
ai ask --help
```
Expand All @@ -58,16 +57,16 @@ ai ask --help
Translation

```bash
ai translate "Hello"
ai translate "Hello" -t japanese
ai translate "你好"
ai translate "你好" -t japanese
ai translate -t english -f "file.txt"
echo "Hello" | ai translate -t english
echo "你好" | ai translate -t english
cat "file.txt" | ai translate -t english
```

![](./asset/video/translate.gif)

Chatting
Chat

```bash
ai chat
Expand All @@ -77,9 +76,10 @@ ai chat

## Proxy Support

> OPENAI_API_BASE Forward proxy is recommended.

Supports the `HTTP_PROXY` and `HTTPS_PROXY` environment variables, or the `ALL_PROXY` variable. You can also specify a proxy using the `--proxy` argument.
> Using OPENAI_API_BASE for forward proxy is more stable, which is recommended.
Support `HTTP_PROXY` and `HTTPS_PROXY` or `ALL_PROXY` environment variable. You can also specify a proxy through the `--proxy` parameter.

For example:

Expand All @@ -89,14 +89,14 @@ export HTTP_PROXY=http://x.x.x.x:xxxx
export HTTPS_PROXY=https://x.x.x.x:xxxx
```

It also supports SOCKS5 proxies, for example:
socks5 proxy is also supported, for example:

```bash
export ALL_PROXY=socks5://x.x.x.x:xxxx
```

SOCKS5 proxies require the installation of `pip install pysocks`
Socks5 proxy requires `pip install pysocks`.

## Additional Information
## Supplement

Use `ai --help` for more commands.
Please use `ai --help` to see more commands.
103 changes: 103 additions & 0 deletions README_ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@


# AIツール chatGPT

このCLIツールは、コマンドラインでchatGPTを簡単に使用できます。 彼とチャットすることも、質問に答えてもらうこともできます。
また、テキストの翻訳を行うこともできます。そして、ターミナルでマークダウンをレンダリングすることもできます。

[English](README.md) | [中文](README_zh.md) | [日本語](README_ja.md)

## 依存関係

* OPENAI_API_BASE (オプション)

GFWのために `https://api.openai.com`にアクセスできない場合は、
`OPENAI_API_BASE`環境変数を使用して別のapiアドレスを指定できます。この方法を使用することをお勧めします。これは、プロキシを使用する方法よりも安定しています。
Cloudflare Workersを使用してプロキシを設定する方法については、[Using Cloudflare Workers to Set Up OpenAI API Proxy](https://github.com/noobnooc/noobnooc/discussions/9)を参照してください。

* OPENAI_API_KEY

`OPENAI_API_KEY`環境変数を設定し、 `--api-key`でパラメータを指定するか、 `ai setting`コマンドを使用して設定できます。

## インストール

```bash
pip install py-ai-cli
```

または最新バージョンをインストールする

```bash
pip install git+https://github.com/yufeikang/ai-cli.git
```

## 設定

今、 `ai setting`コマンドを使用して API キーと API ベースを設定できます。環境変数とCLIパラメータも引き続き有効です。

```bash
# 設定の確認
ai setting
# 設定する
ai setting -e
```

## 使用方法

質問をする:

```bash
ai ask "こんにちは"
# ノーストリームモード
ai --no-stream ask "こんにちは"
# ヘルプ
ai ask --help
```

![](./asset/video/ask.gif)

翻訳する:

```bash
ai translate "こんにちは"
ai translate "こんにちは" -t japanese
ai translate -t english -f "file.txt"
echo "こんにちは" | ai translate -t english
cat "file.txt" | ai translate -t english
```

![](./asset/video/translate.gif)

おしゃべり

```bash
ai chat
```

![](./asset/video/chat.gif)

## 代理サポート

> OPENAI_API_BASE 正しいプロキシ方法はより安定しているため、お勧めします。
環境変数 `HTTP_PROXY``HTTPS_PROXY`または `ALL_PROXY`がサポートされています。 `--proxy`パラメータを使用してプロキシを指定することもできます。

例:

```bash
export HTTP_PROXY=http://x.x.x.x:xxxx
# または
export HTTPS_PROXY=https://x.x.x.x:xxxx
```

また、socks5プロキシもサポートされています。

```bash
export ALL_PROXY=socks5://x.x.x.x:xxxx
```

socks5プロキシには、 `pip install pysocks`をインストールする必要があります。

## 追加情報

より多くのコマンドを表示するには、 `ai --help`を使用してください。
2 changes: 1 addition & 1 deletion README.zh.md → README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

这个cli工具可以让你方便的在命令行中使用chatGPT。你可以和他聊天,也可以让他帮你回答问题。也可以帮你翻译文本。并且支持markdown在终端中的渲染。

[English](README.md)| [中文](README.zh.md) | [日本語](README.ja.md)
[English](README.md)| [中文](README_zh.md) | [日本語](README_ja.md)

## 依赖

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies = [
"pysocks>=1.7.1",
]
requires-python = ">=3.8"
readme = "README.zh.md"
readme = "README.md"
license = {text = "MIT"}

[project.urls]
Expand All @@ -27,9 +27,9 @@ build-backend = "pdm.pep517.api"

[tool.pdm.build]
excludes = [".git"]
package-dir = "."
includes = ["ai_cli"]
source-includes = ["tests", "CHANGELOG.md", "LICENSE", "README.md"]
package-dir = "src"
includes = ["src/ai_cli"]
source-includes = ["tests", "CHANGELOG.md", "LICENSE", "README.md", "README_*.md"]
# editables backend doesn't work well with namespace packages
editable-backend = "path"

Expand Down
4 changes: 2 additions & 2 deletions scripts/gen_doc.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ai --raw translate -f README.zh.md -t en >README.md
ai --raw translate -f README.zh.md -t ja >README.ja.md
ai --raw translate -f README_zh.md -t en >README.md
ai --raw translate -f README_zh.md -t ja >README_ja.md

0 comments on commit 275c14e

Please sign in to comment.