PHP code example of sferra / filament-side-chat

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

    

sferra / filament-side-chat example snippets


use Sferra\FilamentSideChat\FilamentSideChatPlugin;

->plugin(
    FilamentSideChatPlugin::make()
        ->icon('heroicon-o-chat-bubble-left-right')
)

FilamentSideChatPlugin::make()
    ->icon('heroicon-o-chat-bubble-left-right')   // topbar button icon
    ->assistantIcon('heroicon-o-computer-desktop') // assistant avatar icon
    ->assistantName('Assistente')                  // modal heading title

FilamentSideChatPlugin::make()
    -> inject user identity (default true)
    ->e'),
        'Permissões'    => auth()->user()?->getAllPermissions()->pluck('name')->implode(', '),
    ])
    ->systemPromptPrefix('Responda sempre em português brasileiro.');

FilamentSideChatPlugin::make()->context(null);

FilamentSideChatPlugin::make()
    ->systemContextFile('resources/ai/system-context.md');
// ->systemContextTemplate(true)  // default — substitutes {auto_context}

FilamentSideChatPlugin::make()
    ->m assistente. Responda em PT-BR.');

// config/filament-side-chat.php
return [
    'icon'            => 'heroicon-o-chat-bubble-left-right',
    'assistant_icon'  => 'heroicon-o-computer-desktop',
    'assistant_name'  => 'Assistente',
    'render_hook'     => \Filament\View\PanelsRenderHook::TOPBAR_END,
];

use Filament\View\PanelsRenderHook;

FilamentSideChatPlugin::make()
    ->renderHook(PanelsRenderHook::USER_MENU_BEFORE)
bash
php artisan vendor:publish --tag=filament-side-chat-migrations
php artisan migrate
bash
php artisan vendor:publish --tag=filament-side-chat-stubs
bash
php artisan vendor:publish --tag=filament-side-chat-config
bash
php artisan vendor:publish --tag=filament-side-chat-views
bash
php artisan vendor:publish --tag=filament-side-chat-stubs