1. Go to this page and download the library: Download asyntai/filament-ai-chatbot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
asyntai / filament-ai-chatbot example snippets
use Asyntai\FilamentAiChatbot\AiChatbotPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(AiChatbotPlugin::make());
}
AiChatbotPlugin::make()
// A widget ID for this panel. It wins over ASYNTAI_WIDGET_ID.
->widgetId('asyntai_1a2b3c4d5e6f')
// Data about the signed-in user that the assistant can use in its answers.
->userContext(fn ($user) => [
'name' => $user->name,
'plan' => $user->plan,
])
// Show the widget only when the closure returns true.
->visible(fn () => auth()->user()?->is_customer)
// Advanced. Load the widget from another URL.
->scriptUrl('https://widget.asyntai.com/static/js/chat-widget.js');