|
|
@@ -45,6 +45,10 @@ class AnimeService
|
|
|
public function createAnime($data) {
|
|
|
$uid = Site::getUid();
|
|
|
$input_art_style = getProp($data, 'art_style');
|
|
|
+ $file = getProp($data, 'file');
|
|
|
+ $content = getProp($data, 'content', '');
|
|
|
+ $bid = getProp($data, 'bid', 0);
|
|
|
+ $script_id = getProp($data, 'script_id', 0);
|
|
|
// 替换美术风格
|
|
|
$mappedArtStyle = $this->DeepSeekService->getArtStylePromptByInput($input_art_style);
|
|
|
|
|
|
@@ -52,11 +56,35 @@ class AnimeService
|
|
|
if ($model && !DB::table('mp_text_models')->where('model', $model)->where('is_enabled', 1)->value('id')) {
|
|
|
Utils::throwError('20003:该模型不存在!');
|
|
|
}
|
|
|
+
|
|
|
+ // 提取文件内容
|
|
|
+ if ($file) {
|
|
|
+ $content = $this->DeepSeekService->extractFileContent($file);
|
|
|
+ if (!$content) {
|
|
|
+ Utils::throwError('20003:无法提取文件内容,请检查文件格式');
|
|
|
+ }
|
|
|
+ } elseif ($script_id) {
|
|
|
+ $content = $this->DeepSeekService->getContentByScriptId($script_id);
|
|
|
+ if (!$content) {
|
|
|
+ Utils::throwError('20003:无法获取剧本内容,请检查剧本');
|
|
|
+ }
|
|
|
+ } elseif ($bid) {
|
|
|
+ $content = $this->DeepSeekService->getContentByBid($bid);
|
|
|
+ if (!$content) {
|
|
|
+ Utils::throwError('20003:无法获取书籍内容,请检查书籍');
|
|
|
+ }
|
|
|
+ } elseif ($content) {
|
|
|
+ $content = filterContent($content);
|
|
|
+ }else {
|
|
|
+ $content = '';
|
|
|
+ }
|
|
|
+
|
|
|
$anime_data = [
|
|
|
'user_id' => $uid,
|
|
|
'anime_name' => '新剧本策划',
|
|
|
'is_multi' => getProp($data, 'is_multi', 1),
|
|
|
'model' => $model,
|
|
|
+ 'content' => $content,
|
|
|
'created_at' => date('Y-m-d H:i:s'),
|
|
|
'updated_at' => date('Y-m-d H:i:s'),
|
|
|
];
|