正在显示
1 个修改的文件
包含
14 行增加
和
4 行删除
| @@ -65,10 +65,20 @@ class Gpt | @@ -65,10 +65,20 @@ class Gpt | ||
| 65 | 65 | ||
| 66 | $time = time(); | 66 | $time = time(); |
| 67 | try { | 67 | try { |
| 68 | - $result = Http::withoutVerifying()->withHeaders($this->header)->withOptions(['verify' => false])->acceptJson() | ||
| 69 | - ->withBody(json_encode($data, JSON_UNESCAPED_UNICODE), 'application/json') | ||
| 70 | - ->post($url); | ||
| 71 | - $json = $result->json(); | 68 | +// $result = Http::withHeaders($this->header)->withOptions(['verify' => false])->acceptJson() |
| 69 | +// ->withBody(json_encode($data, JSON_UNESCAPED_UNICODE), 'application/json') | ||
| 70 | +// ->post($url); | ||
| 71 | +// $json = $result->json(); | ||
| 72 | + | ||
| 73 | + $client = new \GuzzleHttp\Client(); | ||
| 74 | + $result = $client->request('POST', $url, [ | ||
| 75 | + 'proxy' => 'http://69.172.211.74:51395', // 代理服务器地址和端口号 | ||
| 76 | + 'headers' => $this->header, | ||
| 77 | + 'json' => $data, | ||
| 78 | + 'verify' => false, | ||
| 79 | + ])->getBody()->getContents(); | ||
| 80 | + $json = json_decode($result, true); | ||
| 81 | + | ||
| 72 | if (!isset($json['text']) || $json['code'] !==200) { | 82 | if (!isset($json['text']) || $json['code'] !==200) { |
| 73 | Log::error('openai_chat_qqs data:', $data); | 83 | Log::error('openai_chat_qqs data:', $data); |
| 74 | Log::error('openai_chat_qqs result:' . (time() - $time), $json === null ? ['null'] : $json); | 84 | Log::error('openai_chat_qqs result:' . (time() - $time), $json === null ? ['null'] : $json); |
-
请 注册 或 登录 后发表评论