alphaolomi / laravel-sarufi
Sarufi for Laravel
v0.0.1
2022-10-29 00:27 UTC
Requires
- php: ^8.1
- alphaolomi/sarufi-php: ^0.0.1
- illuminate/contracts: ^9.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-10 01:52:01 UTC
README
安装
您可以通过composer安装此包
composer require alphaolomi/laravel-sarufi
php artisan vendor:publish --tag="sarufi-config"
配置
在您的 .env
文件中添加
SARUFI_USERNAME="your_nice_username" SARUFI_PASSWORD="your_nice_password"
用法
use Alphaolomi\Laravel\Sarufi\Facades\Sarufi; $bot = Sarufi::createBot( name: "Danny bot", description: "PUT DESCRIPTION HERE", industry: "YOUR BOT INDUSTRY", intents: [], flows: [] ); print_r($bot1); // Output // => [ // "intents" => [], // "user_id" => 54, // "description" => "PUT DESCRIPTION HERE", // "industry" => "YOUR BOT INDUSTRY", // "created_at" => "2022-10-20T14:24:32.862859", // "name" => "Danny bot", // "flows" => [], // "id" => 81, // "model_name" => "models/24bea90e2ad6f9d279d4fa86795c8ea0.pkl", // "visible_on_community" => false, // "updated_at" => "2022-10-20T14:24:32.862872", // ] // OR // From files with intent and metadata/ // Assume you have you file in storage/data/intents.yaml example $bot2 Sarufi::createFromFile( intents: storage_path('data/intents.yaml'), flow: storage_path('data/flow.yaml'), metadata: storage_path('data/metadata.yaml' ); print_r($bot);
API可用
createBot(string $name, null|string $description = null, string $industry = "general", $flow = [], $intents = [], bool $visibleOnCommunity = false)
createFromFile($metadata = null, $intents = null, $flow = null)
updateBot($id, $name, $industry, $description, $intents, $flow, $visibleOnCommunity)
updateFromFile( $id, $intents, $flow, $metadata)
getBot($id)
chat(int $botId, string $chatId, string $message = "Hello", string $messageType = "text", string $channel = "general")
deleteBot($id)
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志
贡献
有关详细信息,请参阅贡献指南
安全漏洞
有关如何报告安全漏洞的详细信息,请参阅我们的安全策略
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件