gamalkh299/gpt-content-reviewer
最新稳定版本:1.0.0
Composer 安装命令:
composer require gamalkh299/gpt-content-reviewer
包简介
A Laravel package to review content and images using ChatGPT API
README 文档
README
This package allows you to review the content of a model using ChatGPT Moderation API.
Installation
You can install the package via composer:
composer require gamalkh299/gpt-content-reviewer
You can publish and run the migrations with:
php artisan vendor:publish --tag="gpt-content-reviewer"
php artisan migrate
This is the contents of the published config file:
return [ 'key' => env('CHAT_GPT_API_KEY'), 'queue' => env('GPT_QUEUE', 'gpt-content-reviewer'), ];
Usage
- At fisrt, you need to get an API key from ChatGPT.
- Then, you need to add the API key to your
.envfile.
CHAT_GPT_API_KEY=your-api-key
Then add the following trait to the model you want to review its content.
use gamalkh\GptContentReviewer\Traits\Reviewable;
Don't forget to implement the getReviewableColumns abstract function to specify the columns you want to review and handleReviewResult abstract function to handle the review result.
public function getReviewableColumns(): array { // return the columns you want to review return ['content']; } public function handleReviewResult($result) { // handle the review result }
before you use it you need to run the following command to create the review table.
php artisan queue:work --queue=gpt-content-reviewer
you can use the package to create a review for a model and it will be added to the queue to be reviewed.
$model = Model::find(1); $gptContentReviewer = new gamalkh\GptContentReviewer(); $gptContentReviewer->createReview($model);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-22