4个版本 (破坏性更新)
0.4.0 | 2023年11月1日 |
---|---|
0.3.0 | 2023年3月11日 |
0.2.0 | 2023年3月7日 |
0.1.0 | 2023年3月7日 |
#1 in #conversation
每月44次下载
23KB
472 行
heygpt
ChatGPT API的简单命令行界面。
- 🌟 流式输出!
- 💡 单次模式以快速获取答案
- 🤖 交互模式以进行对话
快速入门
通过Cargo安装最新版本到 $HOME/.cargo/bin/
cargo install heygpt
您需要一个OpenAI API密钥(您可以在这里获取),并将API密钥作为环境变量导出
您还可以设置OpenAI API基本环境变量,就像openai-python
export OPENAI_API_KEY=<your api key>
# export OPENAI_API_BASE="https://api.openai.com/v1"
然后您可以使用ChatGPT开始一个交互式对话
heygpt
或者通过提供提示使用单次模式
heygpt how to record screen on mac
您还可以使用bash技巧组合提示
heygpt read the code and tell me what it is doing: $(cat src/main.rs)
heygpt read the code diff and write a commit message: $(git diff)
heygpt "please translate this poem to English:
> 床前明月光,
> 疑是地上霜。
> 举头望明月,
> 低头思故乡。"
您甚至可以通过管道将heygpt
与其他CLI工具结合使用
$ echo "It's late. I should go to bed" | heygpt | cowsay
______________________________________
/ Goodnight! Sleep well and have sweet \
\ dreams. /
--------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
高级
交互模式中的命令
输入 \?
查看可用命令
user => \?
Available commands:
\?, \help: Show this help
\b, \back: Retract and back to the last user message
\h, \history: View current conversation history
配置文件
heygpt
将从$HOME/.heygpt.toml
加载配置。您还可以在此处设置API密钥和基本URL。示例
model = "gpt-4"
api_base_url = "https://some.openai.mirror/v1"
api_key = "your api key"
依赖关系
~14–31MB
~448K SLoC