diff --git a/includes/Jobs/RequestWikiRemoteAIJob.php b/includes/Jobs/RequestWikiRemoteAIJob.php index 93e997b018..8e2e371c2b 100644 --- a/includes/Jobs/RequestWikiRemoteAIJob.php +++ b/includes/Jobs/RequestWikiRemoteAIJob.php @@ -28,17 +28,17 @@ class RequestWikiRemoteAIJob extends Job { private string $baseApiUrl; private string $apiKey; + private bool $bio; + private bool $nsfw; + private bool $private; private int $id; + private string $category; + private string $language; + private string $nsfwtext; private string $reason; private string $sitename; private string $subdomain; private string $username; - private string $language; - private bool $bio; - private bool $private; - private string $category; - private bool $nsfw; - private string $nsfwtext; public function __construct( array $params, @@ -57,17 +57,17 @@ public function __construct( $this->baseApiUrl = 'https://api.openai.com/v1'; $this->apiKey = $this->config->get( ConfigNames::OpenAIConfig )['apikey'] ?? ''; + $this->bio = $params['bio']; + $this->category = $params['category']; $this->id = $params['id']; + $this->language = $params['language']; + $this->nsfw = $params['nsfw']; + $this->nsfwtext = $params['nsfwtext']; + $this->private = $params['private']; $this->reason = $params['reason']; $this->sitename = $params['sitename']; $this->subdomain = $params['subdomain']; $this->username = $params['username']; - $this->language = $params['language']; - $this->bio = $params['bio']; - $this->private = $params['private']; - $this->category = $params['category']; - $this->nsfw = $params['nsfw']; - $this->nsfwtext = $params['nsfwtext']; } public function run(): bool { @@ -108,16 +108,16 @@ public function run(): bool { ); $apiResponse = $this->queryOpenAI( - $this->sitename, - $this->subdomain, - $this->reason, - $this->username, - $this->language, $this->bio, - $this->private, $this->category, + $this->language, $this->nsfw, - $this->nsfwtext + $this->nsfwtext, + $this->private, + $this->reason, + $this->sitename, + $this->subdomain, + $this->username ); if ( !$apiResponse ) { @@ -272,21 +272,21 @@ private function handleLiveRun( string $outcome, string $comment ): bool { } private function queryOpenAI( - string $sitename, - string $subdomain, - string $reason, - string $username, - string $language, bool $bio, - bool $private, string $category, + string $language, bool $nsfw, - string $nsfwtext + string $nsfwtext, + bool $private, + string $reason, + string $sitename, + string $subdomain, + string $username ): ?array { try { $isBio = $bio ? "Yes" : "No"; $isPrivate = $private ? "Yes" : "No"; - $isNsfw = $nsfw ? "Yes" . $nsfwtext : "No"; + $isNsfw = $nsfw ? "Yes" : "No"; $nsfwReasonText = $nsfw ? "What type of NSFW content will it feature? '$nsfwtext'. " : ""; $sanitizedReason = "Wiki name: '$sitename'. Subdomain: '$subdomain'. Requester: '$username'. " . diff --git a/includes/Services/WikiRequestManager.php b/includes/Services/WikiRequestManager.php index 9c02a9b55c..2fb1ee5377 100644 --- a/includes/Services/WikiRequestManager.php +++ b/includes/Services/WikiRequestManager.php @@ -983,16 +983,16 @@ private function tryAutoCreate( string $reason ): void { } private function evaluateWithOpenAI( - string $sitename, - string $subdomain, - string $reason, - string $username, - string $language, bool $bio, + bool $nsfw, bool $private, string $category, - bool $nsfw, - string $nsfwtext + string $language, + string $nsfwtext, + string $reason, + string $sitename, + string $subdomain, + string $username ): void { $jobQueueGroup = $this->jobQueueGroupFactory->makeJobQueueGroup(); $jobQueueGroup->push( @@ -1000,16 +1000,16 @@ private function evaluateWithOpenAI( RequestWikiRemoteAIJob::JOB_NAME, [ 'id' => $this->ID, - 'sitename' => $sitename, - 'subdomain' => $subdomain, - 'reason' => $reason, - 'username' => $username, - 'language' => $language, 'bio' => $bio, - 'private' => $private, 'category' => $category, + 'language' => $language, 'nsfw' => $nsfw, - 'nsfwtext' => $nsfwtext + 'nsfwtext' => $nsfwtext, + 'private' => $private, + 'reason' => $reason, + 'sitename' => $sitename, + 'subdomain' => $subdomain, + 'username' => $username ] ) );