@@ -111,10 +111,9 @@ public function ask(
111111 string $ prompt ,
112112 string $ conversationId = null ,
113113 string $ parentId = null ,
114- $ account = null ,
114+ $ account = null ,
115115 bool $ stream = false
116- ): Generator
117- {
116+ ): Generator {
118117 // 如果账号为空,则随机选择一个账号
119118 if ($ account === null ) {
120119 $ account = array_rand ($ this ->accounts );
@@ -220,7 +219,7 @@ public function ask(
220219 // 流模式下,返回一个生成器
221220 if ($ stream ) {
222221 $ data = $ response ->getBody ();
223- while (!$ data ->eof ()) {
222+ while (! $ data ->eof ()) {
224223 $ raw = Psr7 \Utils::readLine ($ data );
225224 $ line = self ::formatStreamMessage ($ raw );
226225 if (self ::checkFields ($ line )) {
@@ -259,7 +258,7 @@ public function ask(
259258
260259 $ line = $ this ->formatStreamMessage ($ line );
261260
262- if (!$ this ->checkFields ($ line )) {
261+ if (! $ this ->checkFields ($ line )) {
263262 if (isset ($ line ["detail " ]) && $ line ["detail " ] === "Too many requests in 1 hour. Try again later. " ) {
264263 throw new Exception ("Rate limit exceeded " );
265264 }
@@ -322,10 +321,9 @@ public function continueWrite(
322321 string $ prompt ,
323322 string $ conversationId = null ,
324323 string $ parentId = null ,
325- $ account = null ,
324+ $ account = null ,
326325 bool $ stream = false
327- ): Generator
328- {
326+ ): Generator {
329327 if ($ account === null ) {
330328 throw new Exception ("Continue write must set account " );
331329 } else {
@@ -383,7 +381,7 @@ public function continueWrite(
383381 // 流模式下,返回一个生成器
384382 if ($ stream ) {
385383 $ data = $ response ->getBody ();
386- while (!$ data ->eof ()) {
384+ while (! $ data ->eof ()) {
387385 $ raw = Psr7 \Utils::readLine ($ data );
388386 $ line = self ::formatStreamMessage ($ raw );
389387 if (self ::checkFields ($ line )) {
@@ -422,7 +420,7 @@ public function continueWrite(
422420
423421 $ line = $ this ->formatStreamMessage ($ line );
424422
425- if (!$ this ->checkFields ($ line )) {
423+ if (! $ this ->checkFields ($ line )) {
426424 if (isset ($ line ["detail " ]) && $ line ["detail " ] === "Too many requests in 1 hour. Try again later. " ) {
427425 throw new Exception ("Rate limit exceeded " );
428426 }
@@ -509,7 +507,7 @@ public function getConversations(int $offset = 0, int $limit = 20, $account = 0)
509507 throw new Exception ('Response is not json ' );
510508 }
511509
512- if (!isset ($ data ['items ' ])) {
510+ if (! isset ($ data ['items ' ])) {
513511 throw new Exception ('Field missing ' );
514512 }
515513
@@ -873,7 +871,7 @@ public function setChatHistoryAndTraining(bool $save, $account = 0): bool
873871 'Referer ' => 'https://chat.openai.com/chat ' ,
874872 ],
875873 'query ' => [
876- 'history_and_training_disabled ' => !$ save ,
874+ 'history_and_training_disabled ' => ! $ save ,
877875 ],
878876 ])->getBody ()->getContents ();
879877 } catch (GuzzleException $ e ) {
@@ -977,7 +975,7 @@ public function getArkoseToken(): string
977975 throw new Exception ('Request arkose response is not json ' );
978976 }
979977
980- if (!isset ($ data ['token ' ])) {
978+ if (! isset ($ data ['token ' ])) {
981979 throw new Exception ('Request arkose token failed ' );
982980 }
983981
0 commit comments