Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from pixkk/patch-1
Browse files Browse the repository at this point in the history
Update Bard.php
  • Loading branch information
pj8912 authored Jul 14, 2023
2 parents e2d210c + 067865d commit db5bbf9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Bard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Bard {
private $choice_id;
private $reqid;
private $SNlM0e;
private $cfb2h;

public function __construct($timeout = 6, $proxies = null, $session = null) {
$this->proxies = $proxies;
Expand All @@ -31,7 +32,7 @@ public function __construct($timeout = 6, $proxies = null, $session = null) {
if ($session === null) {
$this->session = curl_init();
curl_setopt($this->session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->session, CURLOPT_COOKIE, "__Secure-1PSID=" . $_ENV["_BARD_API_KEY"]);
curl_setopt($this->session, CURLOPT_COOKIE, "__Secure-1PSID=" . $_ENV["BARD_API_KEY_X"]."; __Secure-1PSIDTS=" . $_ENV["BARD_API_KEY_Y"]);
curl_setopt($this->session, CURLOPT_RETURNTRANSFER, true);
} else {
$this->session = $session;
Expand All @@ -54,12 +55,14 @@ private function _get_snim0e() {
throw new \Exception("Response Status: " . curl_getinfo($this->session, CURLINFO_HTTP_CODE));
}
preg_match('/"SNlM0e":"(.*?)"/', $resp, $matches);
preg_match('/"cfb2h":"(.*?)"/', $resp, $matchesCfb2h);
$this->cfb2h = $matchesCfb2h[1];
return $matches[1];
}

public function get_answer($input_text) {
$params = [
"bl" => "boq_assistant-bard-web-server_20230419.00_p1",
"bl" => $this->cfb2h,
"_reqid" => (string) $this->reqid,
"rt" => "c",
];
Expand Down

0 comments on commit db5bbf9

Please # to comment.