REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.30 KB
Close
//home/nshryvcy/radiantskinclinics.org/wp-content/plugins/wpforms-lite/src/Integrations/AI/API/Choices.php
Text
Base64
<?php namespace WPForms\Integrations\AI\API; use WPForms\Integrations\AI\Helpers; /** * Choices class. * * @since 1.9.1 */ class Choices extends API { /** * Get choices from the API. * * @since 1.9.1 * * @param string $prompt Prompt to get choices for. * @param string $session_id Session ID. * * @return array */ public function choices( string $prompt, string $session_id = '' ): array { $args = [ 'userPrompt' => $this->prepare_prompt( $prompt ), 'limit' => $this->get_limit(), ]; if ( ! empty( $session_id ) ) { $args['sessionId'] = $session_id; } $endpoint = '/ai-choices'; $response = $this->request->post( $endpoint, $args ); if ( $response->has_errors() ) { $error_data = $response->get_error_data(); Helpers::log_error( $response->get_log_message( $error_data ), $endpoint, $args ); return $error_data; } $result = $response->get_body(); // Limit the number of choices. // In some cases, the API may return more choices than requested. $choices = array_slice( $result['choices'], 0, $this->get_limit() ); // Remove numeration from choices. $choices = array_map( static function ( $choice ) { return preg_replace( '/^\d+\.\s+/', '', $choice ); }, $choices ); $result['choices'] = $choices; return $result; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Http
DIR
-
drwxr-xr-x
2026-06-04 03:43:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
API.php
2.12 KB
lrw-r--r--
2026-05-28 15:16:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Choices.php
1.30 KB
lrw-r--r--
2024-11-07 17:15:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FormEditor.php
5.15 KB
lrw-r--r--
2026-05-28 15:16:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Forms.php
11.26 KB
lrw-r--r--
2025-07-31 14:13:36
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).