sontus/laravel-support-chatbot 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sontus/laravel-support-chatbot

Composer 安装命令:

composer require sontus/laravel-support-chatbot

包简介

AI-powered support chatbot package for Laravel with direct Gemini and OpenAI integration.

README 文档

README

A production-ready, AI-powered support chatbot package for Laravel applications. This package seamlessly integrates an intelligent, context-aware chatbot into your application. It uses direct HTTP integrations without heavy dependencies.

Features

  • AI Integration: Directly supports OpenAI and Gemini models without requiring PHP 8.4 dependencies.
  • Knowledge Base (RAG): Admin panel to add FAQs and documentation, searchable via AI embeddings.
  • Context Awareness: The chatbot automatically understands the logged-in user, their orders, and tickets.
  • Frontend Widget: A sleek, customizable, floating Vanilla JS widget for real-time chat. Drop it into any site!
  • Queue System: Messages are processed asynchronously to maintain high performance.
  • Multi-channel API: Interact via frontend widget or via exposed REST APIs.
  • Multi-Tenancy Ready: Configurable database connection for tenant-specific deployments.

Installation

  1. Install via Composer:
composer require sontus/laravel-support-chatbot
  1. Run the installation command:
php artisan chatbot:install
  1. Run Migrations:
php artisan migrate
  1. Configure Environment: Add the following to your .env file:
CHATBOT_AI_API_KEY="your_api_key_here"

# For Gemini (Default)
CHATBOT_AI_PROVIDER=gemini
CHATBOT_AI_MODEL=gemini-2.0-flash

# For OpenAI
# CHATBOT_AI_PROVIDER=openai
# CHATBOT_AI_MODEL=gpt-4o-mini
  1. Start the Queue Worker: Because the chatbot processes AI requests asynchronously to ensure high performance and avoid blocking your app, you need to run a queue worker:
php artisan queue:work

Usage

1. Frontend Chat Widget

The frontend widget is pure Vanilla JavaScript and includes its own styling. It works on any Laravel site without needing a Node/Vue compilation step.

Simply add the script tag before the closing </body> tag in your layout (e.g. resources/views/layouts/app.blade.php):

<script src="{{ asset('vendor/chatbot/chatbot-widget.js') }}"></script>

Add a meta tag for CSRF and optionally User ID if authenticated (in your <head>):

<meta name="csrf-token" content="{{ csrf_token() }}">
@auth
    <meta name="user-id" content="{{ auth()->id() }}">
@endauth

2. Admin Panel

To train the chatbot and view conversations, visit the admin dashboard: URL: /admin/chatbot Ensure your admin users pass the configured middleware (web, auth).

3. Customizing Context

You can bind your own ContextResolver in your application's AppServiceProvider if you want to provide custom data (like specific tenant data) to the AI:

use Sontus\SupportChatbot\Services\ContextResolver;

$this->app->bind(ContextResolver::class, function ($app) {
    return new class extends ContextResolver {
        public function resolveForUser($user = null): array
        {
            // Return any array of data you want the AI to know about this user
            return [
                'name' => $user->name,
                'subscription_plan' => $user->plan->name,
            ];
        }
    };
});

4. API Endpoints

  • POST /api/chatbot/message (Requires message, and session_id or user_id)
  • GET /api/chatbot/history (Requires session_id or user_id)

License

MIT

sontus/laravel-support-chatbot 适用场景与选型建议

sontus/laravel-support-chatbot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sontus/laravel-support-chatbot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sontus/laravel-support-chatbot 我们能提供哪些服务?
定制开发 / 二次开发

基于 sontus/laravel-support-chatbot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 34
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-05