diversen / shell-gpt-php
使用 shell-gpt-php 生成代码、系统命令或聊天。易于扩展。
v2.3.4
2024-02-07 21:33 UTC
Requires
- php: >=8.1
- diversen/minimal-cli-framework: ^7.0
- diversen/tiny-gpt-client: ^1.0
Requires (Dev)
- phpunit/phpunit: ^10.0
- dev-main
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.81
- v2.0.8
- v2.0.5
- v2.0.4
- v2.0.2
- v2.0.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.1
- v0.2.0
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.0
- v0.0.9
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
This package is auto-updated.
Last update: 2024-09-07 23:54:26 UTC
README
cat README.md | shgpt q "Summerize the above README in the style of Shakespeare"
大家好,现在是安装我的 shell-gpt-php 的时候了。这是一件神奇的宝藏,可以帮助你回答问题和执行命令,你只需要下载最新版本,执行你的命令,我们就可以出发了!设置对话的密钥,或者将内容导入以生成带有或单行 Python 程序的 shell 命令。提出一个问题,或显示你过去九十天的令牌使用情况,这里都有!所有这些都说得很好,现在离开,享受你的 shell-gpt-php 吧。
安装
下载最新版本
wget https://www.10kilobyte.com/shgpt/shgpt.phar sudo cp -f shgpt.phar /usr/local/bin/shgpt sudo chmod +x /usr/local/bin/shgpt rm shgpt.phar
设置密钥
设置(或更改)API 密钥
shgpt key
创建对话
shgpt dialog
或者
shgpt d
类似于 ChatGPT(gpt-3.5-turbo 模型)。这意味着答案是从先前的问题和答案中推断出来的。
You: Say "hello world"
Assistant: Hello world!
You: ...
在对话模式中可用一些子命令
Available commands:
save - Save dialog to file
exec - Execute a command and feed the output to the dialog
exit - Exit the dialog
comm - Show all commands
clear - Clear the dialog and start over
Type a message to ChatGPT. Maybe 'hello world!' You may also use above commands.
所有对话在退出时自动保存在目录 ~/.config/shell-gpt-php/data/
生成 shell 命令
针对 shell 命令优化的命令。
shgpt shell "Command to search replace in files recursive in current directory"
# -> find . -type f -exec sed -i 's/search/replace/g' {} \;
shgpt s "command to change origin of a git repo"
# -> git remote set-url origin <new url>
添加 -e 标志来执行命令
shgpt s "Command to search replace in files recursive in current directory" -e
# -> Execute command: find . -type f -exec sed -i 's/search/replace/g' {} \; ? Sure you want to continue? [Y/n]
生成代码
生成代码片段的命令。
shgpt code "Can you make a simple HTML template?" > index.html
more index.html
shgpt c "Write a one line hello world python program"
# -> print("Hello World!")
提出任何问题
shgpt question "Extract directories from this list of files: $(ls -l)"
# -> bin, src, tests, vendor
shgpt q "What is the distance to the sun? Just show me the number."
# -> 149,597,870.7 kilometers
STDIN
shell, code, question
命令将接受来自 STDIN 的输入。STDIN 将在提示符之前添加。例如。
cat composer.json | shgpt q "What type of input is this?"
# -> This is a PHP package composer JSON file.
设置参数
保存一些模型参数,这些参数将覆盖默认参数。但不包括命令行上存在的参数。
例如,如果你将温度设置为 2.0,你会得到一些疯狂的结果
shgpt params -h
显示令牌使用情况
过去 24 小时、过去 7 天、过去 30 天和过去 90 天。
shgpt usage
导出
将所有对话导出为 markdown 格式
shgpt export some_dir
许可
MIT © Dennis Iversen