engines
3 years ago
modules
3 years ago
admin.php
3 years ago
api.php
3 years ago
core.php
3 years ago
init.php
3 years ago
query.php
3 years ago
queryembed.php
3 years ago
queryimage.php
3 years ago
querytext.php
3 years ago
querytranscribe.php
3 years ago
reply.php
3 years ago
rest.php
3 years ago
queryimage.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | class Meow_MWAI_QueryImage extends Meow_MWAI_Query { |
| 4 | |
| 5 | public function __construct( ?string $prompt = "", ?string $model = "dall-e" ) { |
| 6 | parent::__construct( $prompt ); |
| 7 | $this->model = $model; |
| 8 | $this->mode = "generation"; // could be generation, edit, variation |
| 9 | } |
| 10 | |
| 11 | public function setModel( string $model ) { |
| 12 | // Can't be changed to another model for now. |
| 13 | } |
| 14 | |
| 15 | // Based on the params of the query, update the attributes |
| 16 | public function injectParams( $params ) { |
| 17 | if ( isset( $params['model'] ) ) { |
| 18 | $this->setModel( $params['model'] ); |
| 19 | } |
| 20 | if ( isset( $params['apiKey'] ) ) { |
| 21 | $this->setApiKey( $params['apiKey'] ); |
| 22 | } |
| 23 | if ( isset( $params['maxResults'] ) ) { |
| 24 | $this->setMaxResults( $params['maxResults'] ); |
| 25 | } |
| 26 | if ( isset( $params['env'] ) ) { |
| 27 | $this->setEnv( $params['env'] ); |
| 28 | } |
| 29 | if ( isset( $params['session'] ) ) { |
| 30 | $this->setSession( $params['session'] ); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | } |
| 35 |