diversen/shell-gpt-php
Composer 安装命令:
composer require diversen/shell-gpt-php
包简介
Using shell-gpt-php to generate code, system commands, or chat. Easy to extend.
README 文档
README
cat README.md | shgpt q "Summerize the above README in the style of Shakespeare"
Greeting all, 'tis time to install mine shell-gpt-php. 'Tis a wondrous treasure that can assist with thy questions and commands, thine need only download the latest release, execute thine commands, and away we go! Set thy key for the dilaog, or 'tis time to pipe thy content in and generate shell command with or one line python program. Ask a question, or show token usage from thy last ninety days, 'tis all here! Tis a goodly thing all said, so depart thou now, and enjoy thine shell-gpt-php.
Installation
Download the latest release:
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
- You may also build it yourself
- Develop commands
Set key
Set (or change) API key
shgpt key
Create a dialog
shgpt dialog
Or:
shgpt d
Something like ChatGPT (gpt-3.5-turbo model). Meaning that the answer is extrapolated from the previous questions and answers.
You: Say "hello world"
Assistant: Hello world!
You: ...
Some sub commands are available in the dialog mode:
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.
All dialogs are auto-saved on exit to the directory ~/.config/shell-gpt-php/data/
Generate a shell command:
Command optimized for shell commands.
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>
Add the -e flag to execute the command:
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]
Generating code:
Command to generate code snippets.
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!")
Ask any question
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
The shell, code, question commands will accept input from STDIN. STDIN will be added before the prompt. E.g.:
cat composer.json | shgpt q "What type of input is this?"
# -> This is a PHP package composer JSON file.
Set params
Save some model parameters that will override default params. But not parameters that exists on the command line.
E.g. if you set the temperature to 2.0 you will get kind of crazy results
shgpt params -h
Show token usage
Last 24 hours, last 7 days, last 30 days and last 90 days.
shgpt usage
Export
Export all dialogs as markdown:
shgpt export some_dir
License
MIT © Dennis Iversen
diversen/shell-gpt-php 适用场景与选型建议
diversen/shell-gpt-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 122 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「client」 「shell」 「language」 「sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 diversen/shell-gpt-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 diversen/shell-gpt-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 diversen/shell-gpt-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
Alfabank REST API integration
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
统计信息
- 总下载量: 122
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-19