amrlotfy/laravel-ai-smart-reply 问题修复 & 功能扩展

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

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

amrlotfy/laravel-ai-smart-reply

最新稳定版本:v1.0.3

Composer 安装命令:

composer require amrlotfy/laravel-ai-smart-reply

包简介

Smart, multilingual AI-powered reply generator for any CRM / ERP / Support system built with Laravel. Supports OpenAI and OpenRouter, with Arabic and English responses.

README 文档

README

by Amr Lotfy

Smart, multilingual AI-powered reply generator for any CRM / ERP / Support system built with Laravel.
Supports OpenAI and OpenRouter, with Arabic and English responses.

⚙️ Features

  • 🧩 Provider-based architecture (OpenAI, OpenRouter)
  • 🌍 Language support: Arabic / English / Both
  • 💬 Customizable AI prompt templates
  • Plug & play: Works with any CRM, ERP, or Ticket System
  • 🪶 Lightweight & extendable — easy to add new providers

📦 Installation

You can install the package via Composer:

composer require amrlotfy/laravel-ai-smart-reply

If Laravel does not auto-discover the provider, you can manually register it in
config/app.php:

'providers' => [
    AmrLotfy\AiSmartReply\AiSmartReplyServiceProvider::class,
],

Then publish the configuration file:

php artisan vendor:publish --provider="AmrLotfy\AiSmartReply\AiSmartReplyServiceProvider" --tag=config

⚙️ Configuration

Set your environment variables in .env:

AI_SMART_REPLY_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini
OPENROUTER_API_KEY=sk-...
OPENROUTER_MODEL=gpt-4-turbo
AI_SMART_REPLY_LANG=both

🧠 Usage Example

use AmrLotfy\AiSmartReply\Services\AiReply;

// English
$reply = AiReply::generate(
    message: 'Customer: My payment failed',
    context: 'CRM Ticket #552',
    lang: 'en'
);

echo $reply;

// Arabic
$reply = AiReply::generate(
    message: 'العميل قال إن الدفع فشل',
    context: 'تذكرة رقم 552',
    lang: 'ar'
);

echo $reply;

🧩 Configuration File Overview

config/ai-smart-reply.php:

return [
    'default' => 'openai', // or openrouter
    'language' => 'both',  // en | ar | both

    'providers' => [
        'openai' => [...],
        'openrouter' => [...],
    ],

    'templates' => [
        'default' => [
            'en' => "You are a helpful support assistant. Context: {context}. Message: {message}",
            'ar' => "أنت مساعد دعم فني. السياق: {context}. الرسالة: {message}",
        ],
    ],
];

🧱 Extend It

To add another provider, just create a class implementing:

AmrLotfy\AiSmartReply\Providers\AiProviderInterface

and register it in config/ai-smart-reply.php.

🧪 Coming Soon (v1.1)

  • 🧠 Reply caching
  • 🔁 Retry & Rate Limit handling
  • 💬 Streaming responses
  • 🧪 Unit Tests
  • ⚙️ Queue support

🧑‍💻 Author

Amr Lotfy

📄 License

MIT License © 2025 Amr Lotfy

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-18