Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zxch3n/chatgpt
https://github.com/zxch3n/chatgpt
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zxch3n/chatgpt
- Owner: zxch3n
- Created: 2023-03-07T14:43:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-03-07T14:49:13.000Z (over 1 year ago)
- Last Synced: 2024-10-04T14:40:52.063Z (about 1 month ago)
- Language: TypeScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deno CLI for ChatGPT API
> 使用该脚本需要准备好 OpenAI Key
个人用的极简的命令行工具,用来方便做一些小任务比如翻译、语法修改、生成 Git
Commit Message。需要先安装 Deno 才能使用,用下面的方法把命令安装到本地(Deno 的沙盒能有效防止越
权操作,小脚本用起来更放心例如它能够提供这样的授权提示
```
┌ ⚠️ Deno requests run access to "git".
├ Requested by `Deno.run()` API
├ Run again with --allow-run to bypass this prompt.
└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all run permissions) >
```## 安装
```
deno install -f --allow-read --allow-env=HOME --allow-net=api.openai.com https://github.com/zxch3n/chatgpt/raw/main/ai.ts
```## Example
```
> ai
输入数字选择功能,下列功能将直接从剪贴板读取文本
1. 翻译至英文
2. 翻译至中文
3. 语法修正
4. Generate Git commit message (based on git diff --cached)
请输入 Prompt 或选择功能
4✅ Granted run access to "git".
The diff content length is 4498
The message is trimmed to 3000 charactersGenerating commit message...
🤖 ChatGPT:
feat: Add Deno settings and CLI tool for ChatGPT API
This commit adds Deno settings to enable the Deno runtime and disable linting. Additionally, a new CLI tool has been added to perform tasks such as translation, syntax correction, and generating Git commit messages. The tool requires an OpenAI API key to function, which can be configured by running the installation command provided in the README file. This commit also includes a new `gitDiff` function in the `ai.ts` file to generate commit messages based on `git diff --cached`.
✅ Granted run access to "pbcopy".
✅ Commit message is copied to your clipboard.```