2个不稳定版本
0.2.0 | 2023年3月5日 |
---|---|
0.1.0 | 2023年3月4日 |
#72 in #ChatGPT
11KB
202 行
gptask
一个用于与chatGPT交互的CLI工具
安装
cargo install gptask
export OPENAI_API_KEY=sk-WEz... # from https://platform.openai.com/account/api-keys
使用方法
您需要一个OpenAI API密钥,并设置环境变量 OPENAI_API_KEY
。
>>> gptask Who won the world series of poker in 1989?
The winner of the World Series of Poker in 1989 was Phil Hellmuth.
>>> gptask and who did he play against?
In the final heads-up match of the 1989 World Series of Poker Main
Event, Phil Hellmuth played against the legendary poker player
Johnny Chan. The two players battled for several hours before Phil
Hellmuth was able to defeat Chan to win the championship.
对话的上下文将被记住15分钟,因此您可以继续之前的聊天。将环境变量 GPTASK_TTL_SECONDS
设置为0可以禁用此功能。
与mdcat结合使用以格式化Markdown和代码片段
ask() { gptask "$@" | mdcat }
依赖项
~4–18MB
~244K SLoC