lh 2 days ago
parent
commit
18b3076fc8

+ 4 - 0
app/Http/Controllers/DeepSeek/DeepSeekController.php

@@ -31,6 +31,10 @@ class DeepSeekController extends BaseController
      * @return mixed
      */
     public function chatWithReasoner(Request $request) {
+        // 忽略所有超时限制
+        set_time_limit(0);
+        ini_set('max_execution_time', '0');
+
         $data = $request->all();
         $result = $this->deepseekService->chatWithReasoner($data);
         return $this->success($result);

+ 1 - 3
app/Services/DeepSeek/DeepSeekService.php

@@ -23,7 +23,7 @@ class DeepSeekService
     public function __construct() {
         $this->url = 'https://api.deepseek.com/chat/completions';
         $this->api_key = env('DEEPSEEK_API_KEY');
-        $this->client = new Client();
+        $this->client = new Client(['timeout' => 1200, 'verify' => false]);
 
         $this->headers = [
             'Authorization' => 'Bearer '.$this->api_key,
@@ -33,8 +33,6 @@ class DeepSeekService
 
     // 与推理模型对话
     public function chatWithReasoner($data) {
-        set_time_limit(0);
-        ini_set('max_execution_time', 0);
         $content = getProp($data, 'content');
         $model = getProp($data, 'model', 'r1');
         $model = $model == 'r1' ? 'deepseek-reasoner' : 'deepseek-chat';