sfolador/ai-avatar-suggest
最新稳定版本:1.2
Composer 安装命令:
composer require sfolador/ai-avatar-suggest
包简介
Create avatar for your users with openai
README 文档
README
Use this library to generate avatars for your users by letting them insert a short description about themselves.
Installation
You can install the package via composer:
composer require sfolador/ai-avatar-suggest
You can publish the config file with:
php artisan vendor:publish --tag="ai-avatar-suggest-config"
This is the contents of the published config file:
return [ 'openai_key' => env('OPENAI_KEY'), 'default_size' => '256x256', 'default_route' => 'ai-avatar-suggest', 'use_cache' => true, 'throttle' => [ 'enabled' => false, 'max_attempts' => 60, 'prefix' => 'ai-avatar-suggest', ], ];
Remember to set your OpenAI key in your .env file.
If the use_cache option is set to true, the package will use the default cache driver to prevent
unnecessary calls to the OpenAI API. You can change the cache driver in your config/cache.php file.
Usage
$aiAvatarSuggest = new Sfolador\AiAvatarSuggest(); echo $aiAvatarSuggest->suggest('A developer with a red beard and a cool hat'); //or if you want to use the facade echo AiAvatarSuggest::suggest('A developer with a red beard and a cool hat');
You can also invoke the generation by calling the route ai-avatar-suggest with a prompt parameter.
The response will be a JSON with the suggested email, such as:
{
"suggestion": "https://www.example.com/link/to/avatar"
}
Cache clear
If you use a Cache driver that supports tags, you can clear the cache by invoking the command:
php artisan ai-avatar-suggest:clear-cache
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.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-29