作者 赵彬吉

update

... ... @@ -65,10 +65,20 @@ class Gpt
$time = time();
try {
$result = Http::withoutVerifying()->withHeaders($this->header)->withOptions(['verify' => false])->acceptJson()
->withBody(json_encode($data, JSON_UNESCAPED_UNICODE), 'application/json')
->post($url);
$json = $result->json();
// $result = Http::withHeaders($this->header)->withOptions(['verify' => false])->acceptJson()
// ->withBody(json_encode($data, JSON_UNESCAPED_UNICODE), 'application/json')
// ->post($url);
// $json = $result->json();
$client = new \GuzzleHttp\Client();
$result = $client->request('POST', $url, [
'proxy' => 'http://69.172.211.74:51395', // 代理服务器地址和端口号
'headers' => $this->header,
'json' => $data,
'verify' => false,
])->getBody()->getContents();
$json = json_decode($result, true);
if (!isset($json['text']) || $json['code'] !==200) {
Log::error('openai_chat_qqs data:', $data);
Log::error('openai_chat_qqs result:' . (time() - $time), $json === null ? ['null'] : $json);
... ...