Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
6 个修改的文件
包含
80 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use Illuminate\Http\Request; | ||
| 7 | + | ||
| 8 | +class AiCommandController extends BaseController | ||
| 9 | +{ | ||
| 10 | + public $chat_url = 'v2/openai_chat'; | ||
| 11 | + /** | ||
| 12 | + * @name :ai生成 | ||
| 13 | + * @return void | ||
| 14 | + * @author :liyuhang | ||
| 15 | + * @method | ||
| 16 | + */ | ||
| 17 | + public function ai_http_post(Request $request){ | ||
| 18 | + $request->validate([ | ||
| 19 | + 'keywords'=>['required'], | ||
| 20 | + 'key'=>['required'] | ||
| 21 | + ],[ | ||
| 22 | + 'keywords.required' => '关键字不能为空', | ||
| 23 | + 'key.required' => '场景不能为空', | ||
| 24 | + ]); | ||
| 25 | + #TODO 通过key获取到ai指令对象 | ||
| 26 | + $data = $this->send_openai_msg($this->chat_url); | ||
| 27 | + $this->response('success',Code::SUCCESS,$data); | ||
| 28 | + } | ||
| 29 | +} |
| @@ -8,4 +8,5 @@ class AiCommand extends Base | @@ -8,4 +8,5 @@ class AiCommand extends Base | ||
| 8 | protected $table = 'gl_ai_command'; | 8 | protected $table = 'gl_ai_command'; |
| 9 | //自动维护create_at创建时间 updated_at修改时间 | 9 | //自动维护create_at创建时间 updated_at修改时间 |
| 10 | public $timestamps = true; | 10 | public $timestamps = true; |
| 11 | + | ||
| 11 | } | 12 | } |
| @@ -96,6 +96,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -96,6 +96,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 96 | }); | 96 | }); |
| 97 | //ai指令 | 97 | //ai指令 |
| 98 | Route::prefix('command')->group(function () { | 98 | Route::prefix('command')->group(function () { |
| 99 | + //公用ai自动生成 | ||
| 100 | + Route::any('/ai_http_post', [\App\Http\Controllers\Bside\AiCommandController::class, 'ai_http_post'])->name('ai_http_post'); | ||
| 99 | //新闻自动生成 | 101 | //新闻自动生成 |
| 100 | Route::any('/ai_news', [\App\Http\Controllers\Bside\News\NewsController::class, 'ai_news'])->name('ai_news'); | 102 | Route::any('/ai_news', [\App\Http\Controllers\Bside\News\NewsController::class, 'ai_news'])->name('ai_news'); |
| 101 | //博客自动生成 | 103 | //博客自动生成 |
-
请 注册 或 登录 后发表评论