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