├── .editorconfig ├── LICENSE ├── README.md ├── composer.json ├── publishes └── config.php └── src ├── .gitkeep └── ServiceProvider.php /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = false 10 | 11 | [*.{vue,js,scss}] 12 | charset = utf-8 13 | indent_style = space 14 | indent_size = 2 15 | end_of_line = lf 16 | insert_final_newline = true 17 | trim_trailing_whitespace = true 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 丁海军 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

腾讯AI开放平台 SDK

2 | 3 |

Tencent AI open platform sdk

4 | 5 |

6 | styleci 7 | PHP from Packagist 8 | Latest Stable Version 9 | Latest Unstable Version 10 | GitHub stars 11 | License 12 | 13 |

14 | 15 | ## Requirement 16 | 1. PHP >= 7.0 17 | 2. **[Composer](https://getcomposer.org/)** 18 | 3. ext-curl 拓展 19 | 4. ext-json 拓展 20 | 21 | ## Install 22 | in your laravel application, execute the following command: 23 | 24 | `composer require justmd5/laravel-tencent-ai` 25 | ## Configure 26 | add service provider to the app.php: 27 | 28 | ``` 29 | 'providers' => [ 30 | // Application Service Providers... 31 | Justmd5\LaravelTencentAi\ServiceProvider::class, 32 | ], 33 | ``` 34 | > if you use laravel that >= 5.5 ,the above steps are not required. 35 | 36 | publish config: 37 | ```shell 38 | php artisan vendor:publish --provider="Justmd5\LaravelTencentAi\ServiceProvider" 39 | ``` 40 | 41 | after that, you might want to change some config about tencentai: 42 | ```php 43 | // config/tencentai.php 44 | return [ 45 | 'appKey' => '', 46 | 'appSecret' => '', 47 | 'debug' => 0, 48 | ]; 49 | ``` 50 | 51 | ## Usage 52 | 53 | ```php 54 | $params = [ 55 | 'question'=>'腾讯人工智能', 56 | 'session'=>123, 57 | ]; 58 | 59 | dd(app('tencent-ai')->nlp->request('textchat', $params)); 60 | 61 | ``` 62 | 63 | ## Documentation 64 | [Tencent AI](https://ai.qq.com) · [Official Documents](https://ai.qq.com/doc/index.shtml) 65 | ### Help 66 | qq群 67 | 68 |

69 | 70 |

71 | 72 | 73 | ### Thanks 74 | 75 | - thanks to [hanson/foundation-sdk](https://github.com/Hanson/foundation-sdk) 76 | 77 | ## License 78 | 79 | MIT 80 | 81 | 82 | 83 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjustmd5%2Flaravel-tencent-ai.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjustmd5%2Flaravel-tencent-ai?ref=badge_large) -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "justmd5/laravel-tencent-ai", 3 | "description": "腾讯AI开放平台sdk.", 4 | "keywords": [ 5 | "tencent", 6 | "tencent-ai", 7 | "laravel tencent-ai", 8 | "ai-sdk", 9 | "sdk" 10 | ], 11 | "type": "library", 12 | "license": "MIT", 13 | "authors": [ 14 | { 15 | "name": "丁海军", 16 | "email": "heyjun2012@gmail.com" 17 | } 18 | ], 19 | "autoload": { 20 | "psr-4": { 21 | "Justmd5\\LaravelTencentAi\\": "src/" 22 | } 23 | }, 24 | "extra": { 25 | "laravel": { 26 | "providers": [ 27 | "Justmd5\\LaravelTencentAi\\ServiceProvider" 28 | ] 29 | } 30 | }, 31 | "require": { 32 | "php": ">=7.0", 33 | "ext-curl": "*", 34 | "ext-json": "*", 35 | "justmd5/tencent-ai": "~0.6" 36 | }, 37 | "require-dev": { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /publishes/config.php: -------------------------------------------------------------------------------- 1 | '', 10 | 'appSecret' => '', 11 | 'debug' => 0, 12 | ]; 13 | -------------------------------------------------------------------------------- /src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justmd5/laravel-tencent-ai/3f30c33afc398a952113c3f6cd3da40acabb1133/src/.gitkeep -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | publishes([realpath(__DIR__.'/../publishes/config.php') => config_path('tencentai.php')], 'laravel-tencent-ai'); 26 | } 27 | 28 | /** 29 | * Register the provider. 30 | */ 31 | public function register() 32 | { 33 | $this->app->singleton(Ai::class, function () { 34 | return new Ai(config('tencentai')); 35 | }); 36 | $this->app->alias(Ai::class, 'tencent-ai'); 37 | } 38 | 39 | /** 40 | * Get the services provided by the provider. 41 | * 42 | * @return array 43 | */ 44 | public function provides() 45 | { 46 | return [ 47 | Ai::class, 48 | 'tencent-ai', 49 | ]; 50 | } 51 | } 52 | --------------------------------------------------------------------------------