Download the PHP package likeabas/filament-chatgpt-agent without Composer
On this page you can find all versions of the php package likeabas/filament-chatgpt-agent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download likeabas/filament-chatgpt-agent
More information about likeabas/filament-chatgpt-agent
Files in likeabas/filament-chatgpt-agent
Package filament-chatgpt-agent
Short Description Integrate with OpenAI ChatGPT
License MIT
Homepage https://github.com/likeabas/filament-chatgpt-agent
Informations about the package filament-chatgpt-agent
ChatGPT Agent for Laravel Filament
Filament ChatGPT Agent is a Filament plugin that allows you to easily integrate ChatGPT into your Filament project, enabling ChatGPT to access context information from your project by creating GPT functions.
Preview:
Dark Mode:
Select a text to quickly insert it:
Light Mode:
ChatGPT can read the page content for extra context:
Features
I asked ChatGPT to generate a full list of the plugin features:
- Seamless ChatGPT Integration: Easily integrates OpenAI’s ChatGPT into your Filament project.
- Customizable Chat Interface: Modify bot name, button text, panel width, and more.
- Select To Insert: Select some text on the page and insert that with one click.
- Supports Laravel GPT Functions: Define and register custom GPT functions to enhance AI capabilities.
- Page Watcher: Sends the page content and URL to ChatGPT for better contextual responses.
- Configurable OpenAI Model: Choose different models like
gpt-4o
orgpt-4o-mini
and control temperature and token usage. - Custom System Message: Define how the AI should behave using a system instruction.
- Full Screen Mode: The more space the better.
- Dark Mode Support: Specially tailored to night owls.
Screenshots
Installation
You need to have Laravel GPT from Malkuhr installed to use this package. If you haven't done so, follow the installation instructions:
You can install the package via composer:
Next you need to configure your OpenAI API Key and Organization ID. You can find both in the OpenAI Dashboard.
Now install this package:
Views
Optionally, you can publish the views:
Translations
Optionally, you can publish translations:
Usage
1. Adding the Plugin to Filament Panel
Modify your Filament Panel Configuration to include the plugin:
2. You can customize the plugin using the available options:
Also see all available options below.
Other language strings can be altered in the translations file. Just publish the translations.
See the full list of available options
3. Blade Component Usage
You can embed the ChatGPT agent in any Blade file:
This works for all Livewire pages in any Laravel project, not just Filament. Ensure Tailwind CSS, Filament, and Livewire are properly imported.
Available Options
Option | Type | Default | Description |
---|---|---|---|
enabled() |
bool,Closure |
auth()->check() |
Enables or disables the ChatGPT agent. |
botName() |
string,Closure |
'ChatGPT Agent' |
Sets the displayed name of the bot. |
buttonText() |
string,Closure |
'Ask ChatGPT' |
Customizes the button text. |
buttonIcon() |
string,Closure |
'heroicon-m-sparkles' |
Defines the button icon. |
sendingText() |
string,Closure |
'Sending...' |
Text displayed while sending a message. |
model() |
string,Closure |
'gpt-4o-mini' |
Defines the ChatGPT model used. |
temperature() |
float,Closure |
0.7 |
Controls response randomness. Lower is more deterministic. 0-2. |
maxTokens() |
int,Closure |
null |
Limits the token count per response. null is no limit. |
systemMessage() |
string,Closure |
'' |
Provides system instructions for the bot. |
functions() |
array,Closure |
[] |
Defines callable GPT functions. See Using Laravel GPT Functions |
defaultPanelWidth() |
string,Closure |
'350px' |
Sets the chat panel width. |
pageWatcherEnabled() |
bool,Closure |
false |
See the Page wachter option. |
pageWatcherSelector() |
string,Closure |
'.fi-page' |
Sets the CSS selector for the page watcher. |
pageWatcherMessage() |
string,Closure,null |
null |
Message displayed when the page changes. |
startMessage() |
string,bool,Closure |
false |
Default message on panel open. Set to false to disable. |
Using Laravel GPT Functions
Laravel GPT allows you to define custom GPTFunctions that ChatGPT can call to execute tasks within your application. This is useful for integrating dynamic data retrieval, calculations, or external API calls into the ChatGPT responses.
Refer to the Laravel GPT documentation for more details.
Page Watcher
The Page Watcher feature allows the ChatGPT agent to receive additional context about the current page by including the .innerText
of a specified page element (default: .fi-page
, the Filament page container) along with the page URL in each message sent to ChatGPT. This helps provide better contextual responses based on the page content.
Privacy Considerations
Use this feature with caution. Since the entire page content (or the selected element's content) is sent to ChatGPT, users should be informed of this behavior. The pageWatcherEnabled
option supports a closure, allowing you to provide an opt-in mechanism for users.
Enabling Page Watcher
To enable the Page Watcher feature, set the pageWatcherEnabled
option to true
and define a selector for the element to monitor:
Alternatively, you can use a closure to enable the feature conditionally, such as requiring users to opt-in:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Package created by Bas Schleijpen.
- The view and livewire component structure was inspired by Martin Hwang.
- All Contributors
All versions of filament-chatgpt-agent with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^9.0|^10.0|^11.0
livewire/livewire Version ^3.0