|
|
@@ -8,6 +8,7 @@ use App\Libs\Utils;
|
|
|
use App\Models\MpGeneratePicTask;
|
|
|
use App\Services\AIGeneration\AIImageGenerationService;
|
|
|
use App\Services\AIGeneration\AIVideoGenerationService;
|
|
|
+use App\Services\DeepSeek\DeepSeekService;
|
|
|
use Dflydev\DotAccessData\Util;
|
|
|
use GuzzleHttp\Client;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
@@ -20,16 +21,19 @@ class AnimeService
|
|
|
{
|
|
|
protected $aiImageGenerationService;
|
|
|
protected $aiVideoGenerationService;
|
|
|
+ protected $DeepSeekService;
|
|
|
private $url;
|
|
|
private $api_key;
|
|
|
private $headers;
|
|
|
|
|
|
public function __construct(
|
|
|
AIImageGenerationService $aiImageGenerationService,
|
|
|
- AIVideoGenerationService $aiVideoGenerationService
|
|
|
+ AIVideoGenerationService $aiVideoGenerationService,
|
|
|
+ DeepSeekService $DeepSeekService
|
|
|
) {
|
|
|
$this->aiImageGenerationService = $aiImageGenerationService;
|
|
|
$this->aiVideoGenerationService = $aiVideoGenerationService;
|
|
|
+ $this->DeepSeekService = $DeepSeekService;
|
|
|
$this->url = 'https://api.deepseek.com/chat/completions';
|
|
|
$this->api_key = env('DEEPSEEK_API_KEY');
|
|
|
$this->headers = [
|
|
|
@@ -38,6 +42,30 @@ class AnimeService
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ public function createAnime($data) {
|
|
|
+ $uid = Site::getUid();
|
|
|
+ $input_art_style = getProp($data, 'art_style');
|
|
|
+ // 替换美术风格
|
|
|
+ $mappedArtStyle = $this->DeepSeekService->getArtStylePromptByInput($input_art_style);
|
|
|
+
|
|
|
+ $model = getProp($data, 'model');
|
|
|
+ if ($model && !DB::table('mp_text_models')->where('model', $model)->where('is_enabled', 1)->value('id')) {
|
|
|
+ Utils::throwError('20003:该模型不存在!');
|
|
|
+ }
|
|
|
+ $anime_data = [
|
|
|
+ 'user_id' => $uid,
|
|
|
+ 'anime_name' => '新剧本策划',
|
|
|
+ 'is_multi' => getProp($data, 'is_multi', 1),
|
|
|
+ 'model' => $model,
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+
|
|
|
+ if ($mappedArtStyle) $anime_data['art_style'] = $mappedArtStyle;
|
|
|
+
|
|
|
+ return DB::table('mp_animes')->insertGetId($anime_data);
|
|
|
+ }
|
|
|
+
|
|
|
public function chatList($data) {
|
|
|
$anime_name = getProp($data, 'anime_name');
|
|
|
|