PluginProbe
AI Engine – The Chatbot, AI Framework & MCP for WordPress / 1.6.81
AI Engine – The Chatbot, AI Framework & MCP for WordPress v1.6.81
3.7.7 3.7.6 3.7.5 3.7.4 3.7.3 3.7.2 3.7.1 3.7.0 3.6.9 3.6.8 3.6.7 3.6.6 3.6.4 3.6.5 3.6.3 3.6.2 3.6.1 3.6.0 3.5.9 3.5.8 3.5.7 3.5.6 3.5.5 3.5.4 3.5.3 All 527 releases
ai-engine / classes / queryembed.php

queryembed.php in AI Engine – The Chatbot, AI Framework & MCP for WordPress 1.6.81, at classes/queryembed.php

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Meow_MWAI_QueryEmbed extends Meow_MWAI_Query {
4
5 public function __construct( $promptOrQuery = null, ?string $model = 'text-embedding-ada-002' ) {
6
7 if ( is_a( $promptOrQuery, 'Meow_MWAI_QueryText' ) ) {
8 $lastMessage = $promptOrQuery->getLastMessage();
9 if ( !empty( $lastMessage ) ) {
10 $this->setPrompt( $lastMessage );
11 }
12 $this->setModel( $model );
13 $this->mode = 'embedding';
14 $this->session = $promptOrQuery->session;
15 $this->env = $promptOrQuery->env;
16 $this->apiKey = $promptOrQuery->apiKey;
17 $this->service = $promptOrQuery->service;
18 }
19 else {
20 parent::__construct( $promptOrQuery ? $promptOrQuery : '' );
21 $this->setModel( $model );
22 $this->mode = 'embedding';
23 }
24 }
25
26 public function injectParams( $params ) {
27 if ( isset( $params['prompt'] ) ) {
28 $this->setPrompt( $params['prompt'] );
29 }
30 if ( isset( $params['apiKey'] ) ) {
31 $this->setApiKey( $params['apiKey'] );
32 }
33 if ( isset( $params['env'] ) ) {
34 $this->setEnv( $params['env'] );
35 }
36 if ( isset( $params['session'] ) ) {
37 $this->setSession( $params['session'] );
38 }
39 if ( isset( $params['service'] ) ) {
40 $this->setService( $params['service'] );
41 }
42 if ( isset( $params['api_key'] ) ) {
43 $this->setApiKey( $params['apiKey'] );
44 }
45 if ( isset( $params['apiKey'] ) ) {
46 $this->setApiKey( $params['apiKey'] );
47 }
48 }
49 }