作者 赵彬吉

update

... ... @@ -65,19 +65,19 @@ class Gpt
$time = time();
try {
// $result = Http::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://104.255.171.237:51395', // 代理服务器地址和端口号
'headers' => $this->header,
'json' => $data,
'verify' => false,
])->getBody()->getContents();
$json = json_decode($result, true);
// $client = new \GuzzleHttp\Client();
// $result = $client->request('POST', $url, [
// 'proxy' => 'http://104.255.171.237: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);
... ...