lh 3 месяцев назад
Родитель
Сommit
6c0f5b92cc
1 измененных файлов с 36 добавлено и 18 удалено
  1. 36 18
      app/Services/DeepSeek/DeepSeekService.php

+ 36 - 18
app/Services/DeepSeek/DeepSeekService.php

@@ -2265,7 +2265,6 @@ class DeepSeekService
         }
 
         dLog('deepseek')->info('完整内容: '.$fullContent);
-        exit();
 
         // 处理完整内容并返回最终结果
         $script_arr = [];
@@ -2273,6 +2272,10 @@ class DeepSeekService
             $script_arr = handleScriptContent($fullContent);
         }
 
+        if (empty($script_arr['roles'])) {
+            Utils::throwError('20003:未生成剧本相关的内容');
+        }
+
         // 替换美术风格
         $mappedArtStyle = $this->getArtStylePromptByInput($input_art_style);
         if ($mappedArtStyle !== '') {
@@ -2283,14 +2286,15 @@ class DeepSeekService
         // 新建动漫
         $anime_name = getProp($script_arr, 'script_name');
         if (!$anime_name) {
-            yield [
-                'type'  => 'done',
-                'answer' => $fullContent,
-                'reasoning' => $fullReasoningContent,
-                'usage' => $usage,
-                'error' => '未能识别到剧本名称,请确认内容是否符合要求'
-            ];
-            return;
+            Utils::throwError('20003:未能识别到剧本名称,请确认内容是否符合要求');
+            // yield [
+            //     'type'  => 'done',
+            //     'answer' => $fullContent,
+            //     'reasoning' => $fullReasoningContent,
+            //     'usage' => $usage,
+            //     'error' => '未能识别到剧本名称,请确认内容是否符合要求'
+            // ];
+            // return;
         }
 
         // 确认对话名称唯一性
@@ -2716,6 +2720,19 @@ class DeepSeekService
             $script_arr = handleScriptContent($fullContent);
         }
 
+        if (empty($script_arr['roles'])) {
+            Utils::throwError('20003:未生成剧本相关的内容');
+            // dLog('deepseek')->info('未生成剧本相关的内容');
+            // yield [
+            //     'type' => 'error',
+            //     'episode' => [],
+            //     'answer' => $fullContent,
+            //     'reasoning' => $fullReasoningContent,
+            //     'usage' => $usage
+            // ];
+            // return;
+        }
+
         // 替换美术风格
         $mappedArtStyle = $this->getArtStylePromptByInput($input_art_style);
         if ($mappedArtStyle !== '') {
@@ -3094,15 +3111,16 @@ class DeepSeekService
         // 处理完整内容并返回最终结果
         $episode_arr = handleEpisodeContent($fullContent);
         if (empty($episode_arr['acts'])) {
-            dLog('deepseek')->info('未生成分镜剧本相关的内容');
-            yield [
-                'type' => 'done',
-                'episode' => [],
-                'answer' => $fullContent,
-                'reasoning' => $fullReasoningContent,
-                'usage' => $usage
-            ];
-            return;
+            Utils::throwError('20003:未生成分镜剧本相关的内容!');
+            // dLog('deepseek')->info('未生成分镜剧本相关的内容');
+            // yield [
+            //     'type' => 'done',
+            //     'episode' => [],
+            //     'answer' => $fullContent,
+            //     'reasoning' => $fullReasoningContent,
+            //     'usage' => $usage
+            // ];
+            // return;
         }
 
         $existing_roles = $base_episode ? json_decode((string)getProp($base_episode, 'roles'), true) : [];