PHP code example of darkclow4 / filament-chatbot

1. Go to this page and download the library: Download darkclow4/filament-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/ */

    

darkclow4 / filament-chatbot example snippets


Darkclow4\FilamentChatbot\FilamentChatbotServiceProvider::class



namespace App\Providers\Filament;

use Darkclow4\FilamentChatbot\ChatbotPlugin;
use Filament\Panel;
use Filament\PanelProvider;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            ->id('admin')
            ->path('admin')
            ->plugin(ChatbotPlugin::make());
    }
}

use Darkclow4\FilamentChatbot\ChatbotPlugin;

->plugin(
    ChatbotPlugin::make()
        ->enabled(fn ($user) => $user?->hasRole('admin') ?? false)
        ->streaming(true)
        ->draggable(true)
        ->primaryColor('#10b981')
)

ChatbotPlugin::make()
    ->enabled(fn ($user) => $user?->hasRole('admin') ?? false)

ChatbotPlugin::make()
    ->streaming(true)

ChatbotPlugin::make()
    ->draggable(true)

ChatbotPlugin::make()
    ->primaryColor('#10b981')



return [
    'enabled' => true,
    'streaming' => false,
    'draggable' => false,
    'title' => 'AI Assistant',
    'description' => 'Ask anything about this app.',
    'placeholder' => 'Type your message...',
    'empty_state_heading' => 'Need a hand?',
    'empty_state_description' => 'Ask for help with data, workflow, or admin tasks.',
    'send_button_label' => 'Send',
    'new_chat_label' => 'New chat',
    'agent' => Darkclow4\FilamentChatbot\Ai\Agents\FilamentChatbotAgent::class,
    'provider' => null,
    'model' => null,
    'max_messages' => 100,
];

'agent' => App\Ai\Agents\AdminPanelAgent::class,



namespace App\Ai\Agents;

use Laravel\Ai\Concerns\RemembersConversations;
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Contracts\Conversational;
use Laravel\Ai\Promptable;

class AdminPanelAgent implements Agent, Conversational
{
    use Promptable;
    use RemembersConversations;

    public function instructions(): string
    {
        return 'You are a helpful admin assistant for our Filament panel.';
    }
}

'provider' => 'gemini',
'model' => 'gemini-2.5-flash',

Darkclow4\FilamentChatbot\Ai\Agents\FilamentChatbotAgent::class

use App\Ai\Agents\AdminPanelAgent;

AdminPanelAgent::fake(['Hello from the assistant']);
bash
php artisan vendor:publish --tag=filament-chatbot-config
bash
php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider"
php artisan migrate
bash
php artisan filament:assets