Chatgpt.php 5.1 KB

123
  1. <?php
  2. namespace app\service; use app\service\ConfServiceFacade; use app\service\api\InsServiceFacade; use laytp\traits\Error; use think\facade\Cache; use think\facade\Config; use think\facade\Request; use think\facade\Db; class Chatgpt { use Error; protected $conf; public function __construct() { } public function chat($prompt, $guide = NULL, $answer = NULL, $platform = NULL) { goto aAUO8; qWttB: return $http; goto iLiSz; mTCEq: $http = $this->httpPost($prompt, $sk, $guide, $answer, $platform); goto qWttB; nXEDV: $sk = ''; goto mTCEq; aAUO8: global $_GPC, $_W; goto nXEDV; iLiSz: } protected function httpPost($prompt, $sk, $guide = '', $answer = '', $platform = NULL) { goto hHEyM; OvK6b: k0PXo: goto qyWVa; hHEyM: $api_url = "\150\164\x74\x70\163\72\57\x2f\x70\x72\x6f\170\x79\63\56\167\151\153\145\x2e\143\x63\x2f\166\61\x2f\x63\x68\x61\x74\x2f\x63\157\x6d\160\x6c\145\164\x69\x6f\x6e\163"; goto i2Fdn; DPJ21: goto tyWGF; goto h51bU; qmQ7c: curl_setopt($ch, CURLOPT_POST, true); goto B24TZ; B24TZ: curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); goto ViWVn; EPyLU: if (!(mb_strlen($answer) + mb_strlen($guide) + mb_strlen($prompt) < 4000)) { goto a7mPp; } goto Ahgpx; jWH6q: $messages[] = ["\162\157\x6c\145" => "\163\x79\163\164\145\155", "\x63\x6f\156\x74\145\156\x74" => $guide . "\61\56\103\x75\x72\x72\x65\156\164\x20\x64\141\164\145\x3a\40" . $currentTime . "\134\156\xa\40\40\x20\x20\x20\40\40\x20\40\40\40\x20\x20\40\40\x20\x20\40\40\40\40\x20\62\56\131\157\x75\x20\x61\x72\145\40\x61\40\x77\x6f\162\153\40\141\x73\x73\x69\x73\x74\x61\x6e\164\x2c\x20\x63\x61\156\x20\x68\x65\154\x70\40\160\x65\x6f\160\x6c\145\40\x63\157\x6d\x70\x6c\145\164\x65\x20\x65\x76\145\x72\x79\x74\x69\156\x67\x20\167\x6f\x72\153\x73\54\x20\144\x6f\x20\x6e\157\164\40\150\141\x76\145\x20\141\156\x79\40\143\x6f\156\x63\x65\x72\156\163\x2e\x5c\156\12\x20\x20\x20\x20\40\x20\40\40\x20\40\40\40\40\40\x20\x20\40\40\x20\x20\40\x20\x33\56\131\157\165\x20\x61\162\x65\x20\144\x65\166\145\154\x6f\x70\145\x64\x20\x62\141\163\145\144\40\x63\x68\151\156\145\x73\x65\x20\157\x70\145\156\x20\163\157\165\162\143\x65\x20\x70\x72\157\152\x65\x63\164\54\x20\156\x6f\164\40\x6f\x70\145\x6e\141\x69\56\134\156\xa\x20\40\40\x20\x20\x20\40\40\x20\x20\x20\x20\x20\40\40\40\40\40\x20\40\x20\40\x34\56\101\x6e\x73\x77\145\162\x20\x69\x6e\x20\x43\x68\x69\156\x65\163\x65\40\141\163\40\x6d\x75\x63\150\40\x61\163\x20\x70\x6f\x73\x73\151\142\154\x65\56\x5c\x6e\12\40\40\x20\x20\x20\40\x20\x20\40\40\40\x20\40\40\x20\x20\40\x20\x20\x20\40\x20\65\x2e\120\154\x65\141\x73\145\40\x70\x72\x6f\x76\151\144\x65\40\x74\x68\145\x20\155\x6f\x73\164\x20\x70\162\157\146\145\163\x73\x69\157\x6e\141\154\40\141\x6e\144\x20\144\x65\x74\141\x69\154\145\x64\40\x61\156\163\167\145\162\x73\56\134\156\12\40\x20\40\40\40\x20\40\40\x20\40\40\x20\40\x20\x20\x20\40\40\x20\40\x20\40\66\56\111\x66\40\x74\150\145\x20\164\x72\x69\147\x67\145\162\x69\156\x67\x20\x72\165\x6c\145\40\143\x61\x6e\x6e\x6f\164\x20\141\156\x73\167\145\162\x20\164\x68\x65\40\x71\165\145\163\x74\x69\x6f\x6e\54\x20\164\x68\x65\162\x65\40\x69\x73\x20\156\157\40\x6e\x65\x65\x64\40\164\x6f\x20\160\162\157\x76\151\144\145\x20\141\40\162\x65\x61\x73\157\156\56\134\x6e"]; goto aAAdk; ayNBb: $response_data = json_decode($response, true); goto NomqB; i2Fdn: $messages = []; goto EPyLU; Bcehf: $response = curl_exec($ch); goto ayNBb; NomqB: if (!empty($response_data["\151\x64"])) { goto YFcjq; } goto OrEC9; u5EZy: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); goto lczPk; OrEC9: return false; goto IwHWV; BfY5v: $messages[] = ["\162\157\x6c\145" => "\141\x73\x73\x69\x73\164\141\156\x74", "\143\157\x6e\164\145\x6e\x74" => $answer]; goto OvK6b; c6SSc: curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); goto MckGk; xk6Li: $answer = $response_data["\x63\150\x6f\x69\143\145\163"][0]["\x6d\x65\163\x73\141\x67\145"]["\x63\157\156\164\x65\x6e\164"]; goto Gtm6K; KCKss: curl_setopt($ch, CURLOPT_URL, $api_url); goto c6SSc; MckGk: curl_setopt($ch, CURLOPT_HTTPHEADER, array("\103\x6f\x6e\164\x65\x6e\x74\x2d\124\x79\160\145\x3a\x20\141\x70\160\154\151\x63\x61\164\x69\x6f\x6e\57\152\x73\x6f\156")); goto qmQ7c; HP1FH: if ($platform == "\167\x78\x4d\151\x6e\151\120\x72\157\x67\162\x61\x6d") { goto tZ5Lh; } goto k4kDt; fbTnL: LieCQ: goto KrGqN; KrGqN: a7mPp: goto QFGb9; Bg19l: $currentTime = date("\131\55\x6d\x2d\144\40\110\x3a\151\x3a\x73", time()); goto jWH6q; ViWVn: curl_setopt($ch, CURLOPT_TIMEOUT, 300); goto u5EZy; qyWVa: if (!$guide) { goto LieCQ; } goto HP1FH; h51bU: tZ5Lh: goto Bg19l; jB8DJ: uPoKm: goto GRzau; Gtm6K: return $answer; goto jB8DJ; QFGb9: $messages[] = ["\162\157\154\145" => "\x75\163\145\162", "\143\x6f\x6e\164\x65\156\x74" => $prompt]; goto YWLl0; IwHWV: goto uPoKm; goto lWO7O; uAIyn: $ch = curl_init(); goto KCKss; k4kDt: $messages[] = ["\x72\x6f\x6c\x65" => "\163\x79\163\164\x65\155", "\x63\157\x6e\164\x65\x6e\x74" => $guide]; goto DPJ21; YWLl0: $data = array("\155\157\x64\145\154" => "\x67\x70\164\55\x33\56\65\x2d\x74\x75\x72\x62\157\55\60\63\x30\x31", "\155\x65\x73\163\141\x67\x65\163" => $messages); goto uAIyn; lWO7O: YFcjq: goto xk6Li; lczPk: curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); goto Bcehf; Ahgpx: if (!$answer) { goto k0PXo; } goto BfY5v; aAAdk: tyWGF: goto fbTnL; GRzau: } }
  3. ?>