Просмотр исходного кода

调整超时时间,调整查询zhizhen模型接口失败或异常时返回的状态为processing

lh 3 недель назад
Родитель
Сommit
c074ee4292

+ 9 - 9
app/Services/AIGeneration/AIVideoGenerationService.php

@@ -1624,7 +1624,7 @@ class AIVideoGenerationService
      */
     private function submitElementToKelingApi(AIElement $element): void
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
 
         try {
             // 生成JWT token
@@ -1723,7 +1723,7 @@ class AIVideoGenerationService
      */
     public function queryElementStatus(string $taskId, string $externalTaskId = null): array
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
 
         try {
             // 生成JWT token
@@ -1822,7 +1822,7 @@ class AIVideoGenerationService
      */
     public function queryCustomElementsList(int $pageNum = 1, int $pageSize = 30): array
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
 
         try {
             // 生成JWT token
@@ -1885,7 +1885,7 @@ class AIVideoGenerationService
      */
     public function queryOfficialElementsList(int $pageNum = 1, int $pageSize = 30): array
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
 
         try {
             // 生成JWT token
@@ -1940,7 +1940,7 @@ class AIVideoGenerationService
      */
     public function deleteElement(string $elementId): array
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
 
         try {
             // 生成JWT token
@@ -2254,7 +2254,7 @@ class AIVideoGenerationService
      */
     private function submitUnifiedApiTaskToApi(MpGenerateVideoTask $task): void
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
         try {
             // 验证环境变量配置
             $apiKey = env('ZHIZHEN_AI_SK');
@@ -2362,7 +2362,7 @@ class AIVideoGenerationService
      */
     public function queryUnifiedApiTaskStatus(MpGenerateVideoTask $task): array
     {
-        $client = new Client(['verify' => false, 'timeout' => 120]);
+        $client = new Client(['verify' => false, 'timeout' => 1200]);
         try {
             // 获取API任务UID
             $extraParams = $task->extra_params;
@@ -2504,13 +2504,13 @@ class AIVideoGenerationService
                 $errorMsg .= ': ' . $e->getMessage();
             }
             return [
-                'status' => 'failed',
+                'status' => 'processing',
                 'error_message' => $errorMsg,
                 'result_url' => null
             ];
         } catch (\Exception $e) {
             return [
-                'status' => 'failed',
+                'status' => 'processing',
                 'error_message' => $e->getMessage(),
                 'result_url' => null
             ];

+ 2 - 2
app/Services/VolcEngineService.php

@@ -13,7 +13,7 @@ class VolcEngineService
     public function __construct()
     {
         $this->client = new Client([
-            'timeout' => 120.0,
+            'timeout' => 1200,
         ]);
     }
 
@@ -136,7 +136,7 @@ class VolcEngineService
         // 发送 HTTP 请求
         $client = new Client([
             'base_uri' => 'https://'. $requestParam['host'],
-            'timeout' => 120.0,
+            'timeout' => 1200,
         ]);
         
         $response = $client->request($method, $requestParam['path'], [