base.php
2 years ago
embed.php
2 years ago
function.php
2 years ago
image.php
2 years ago
parameter.php
2 years ago
text.php
2 years ago
transcribe.php
2 years ago
image.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | class Meow_MWAI_Query_Image extends Meow_MWAI_Query_Base { |
| 4 | public ?string $resolution = null; |
| 5 | |
| 6 | public function __construct( ?string $prompt = "", ?string $model = "dall-e" ) { |
| 7 | parent::__construct( $prompt ); |
| 8 | $this->model = $model; |
| 9 | $this->mode = "generation"; // could be generation, edit, variation |
| 10 | } |
| 11 | |
| 12 | public function setModel( string $model ) { |
| 13 | $this->model = $model; |
| 14 | } |
| 15 | |
| 16 | public function setResolution( string $resolution ) { |
| 17 | $this->resolution = $resolution; |
| 18 | } |
| 19 | |
| 20 | // Based on the params of the query, update the attributes |
| 21 | public function injectParams( $params ) { |
| 22 | if ( !empty( $params['model'] ) ) { |
| 23 | $this->setModel( $params['model'] ); |
| 24 | } |
| 25 | if ( !empty( $params['apiKey'] ) ) { |
| 26 | $this->setApiKey( $params['apiKey'] ); |
| 27 | } |
| 28 | if ( !empty( $params['maxResults'] ) ) { |
| 29 | $this->setMaxResults( $params['maxResults'] ); |
| 30 | } |
| 31 | if ( !empty( $params['env'] ) ) { |
| 32 | $this->setEnv( $params['env'] ); |
| 33 | } |
| 34 | if ( !empty( $params['session'] ) ) { |
| 35 | $this->setSession( $params['session'] ); |
| 36 | } |
| 37 | if ( !empty( $params['botId'] ) ) { |
| 38 | $this->setBotId( $params['botId'] ); |
| 39 | } |
| 40 | if ( !empty( $params['resolution'] ) ) { |
| 41 | $this->setResolution( $params['resolution'] ); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | } |
| 46 |