dougkusanagi/laravel-ai-chat
最新稳定版本:0.1.22
Composer 安装命令:
composer require dougkusanagi/laravel-ai-chat
包简介
A Laravel AI Chat package with database integration
README 文档
README
Installation
composer require dougkusanagi/laravel-ai-chat php artisan vendor:publish --tag=ai-chat-config php artisan vendor:publish --tag=ai-chat-assets php artisan vendor:publish --tag=ai-chat-views
Set your Gemini API key in your .env file:
GEMINI_API_KEY=your_api_key_here
Add to layout
- Add the required scripts to your layout file (
app.blade.phpor similar). Make sure to add them in this exact order:
<!DOCTYPE html> <html> <head> <!-- AI Chat JavaScript --> <script defer src="{{ asset('vendor/ai-chat/js/ai-chat.js') }}"></script> </head> <body> <!-- Your content --> <!-- Add the chat component wherever you want it to appear --> <x-ai-chat::ai-floating-chat /> </body> </html>
-
Make sure you have Tailwind CSS installed and configured in your application.
-
The chat component will appear as a floating button in the bottom-right corner of your page.
Customization
You can customize the views by publishing them:
php artisan vendor:publish --tag=ai-chat-views
The views will be published to resources/views/vendor/ai-chat/components/.
If you want to add ai-chat to filament php
Add this following code to AdminPanelProvider.php
// Makes tailwind classes being compiled ->viteTheme('resources/css/app.css') // Add assets ->assets([ Js::make('ai-chat-js', asset('vendor/ai-chat/js/ai-chat.js')), ]) // Add blade components ->renderHook( PanelsRenderHook::BODY_END, function () { if (auth()->check()) { return view('vendor.ai-chat.components.ai-floating-chat'); } } )
Todo
- Implement GeminiProvider
- Add the ability to execute constructive queries (create, update)
- Implement OpenAiProvider
- Implement AnthropicProvider
统计信息
- 总下载量: 43
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-29
