定制 iankibet/sdp-ai 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

iankibet/sdp-ai

最新稳定版本:1.0.0

Composer 安装命令:

composer require iankibet/sdp-ai

包简介

AI integration package for SDP CMS Builder

README 文档

README

A Laravel package for integrating multiple AI providers (ChatGPT, Claude, DeepSeek, Xai) using a simple, unified API.

Features

  • Easy switching between AI providers.
  • Support for ChatGPT, Claude, DeepSeek, and Xai.
  • Laravel-ready with Service Provider and Facade.
  • Extendable and customizable.

Installation

composer require iankibet/sdp-ai

Replace your-vendor-name with your actual composer namespace.

Configuration

Publish the configuration file:

php artisan vendor:publish --tag="sdpai-config"

This will publish config/sdp-ai.php where you can configure API keys and default providers.

Example config/sdp-ai.php:

return [
    'default' => 'chatgpt',
    
    'providers' => [
        'chatgpt' => [
            'api_key' => env('CHATGPT_API_KEY'),
        ],
        'claude' => [
            'api_key' => env('CLAUDE_API_KEY'),
        ],
        'deepseek' => [
            'api_key' => env('DEEPSEEK_API_KEY'),
        ],
        'xai' => [
            'api_key' => env('XAI_API_KEY'),
        ],
    ],
];

Usage

Use the provided SDPAI facade:

use SdpAi\Facades\SDPAI;

// Send a message using the default provider
$response = SDPAI::ask('Hello, how are you?');

// Switch provider dynamically
$response = SDPAI::setProvider('claude')->ask('Tell me a joke.');

Or via Dependency Injection:

use SdpAi\SdpAiManager;

class MyController
{
    public function handle(SdpAiManager $sdpAi)
    {
        $response = $sdpAi->setProvider('deepseek')->ask('Explain Quantum Physics.');
    }
}

Extending

You can create your own provider by implementing the SdpAi\Contracts\SdpAiProvider interface and binding it in the config/sdp-ai.php.

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-14