assistant.php
1 year ago
assistfeedback.php
1 year ago
base.php
1 year ago
droppedfile.php
1 year ago
embed.php
1 year ago
feedback.php
1 year ago
function.php
1 year ago
image.php
1 year ago
parameter.php
2 years ago
text.php
1 year ago
transcribe.php
1 year ago
assistfeedback.php
89 lines
| 1 | <?php |
| 2 | |
| 3 | class Meow_MWAI_Query_AssistFeedback extends Meow_MWAI_Query_Assistant implements JsonSerializable { |
| 4 | |
| 5 | public $lastReply = null; |
| 6 | public $originalQuery = null; |
| 7 | public array $blocks; |
| 8 | |
| 9 | #region Constructors, Serialization |
| 10 | |
| 11 | public function __construct( Meow_MWAI_Reply $reply, Meow_MWAI_Query_Assistant $query ) { |
| 12 | parent::__construct( $query->message ); |
| 13 | |
| 14 | $this->lastReply = $reply; |
| 15 | $this->originalQuery = $query; |
| 16 | |
| 17 | if ( !empty( $query->model ) ) { |
| 18 | $this->set_model( $query->model ); |
| 19 | } |
| 20 | if ( !empty( $query->scope ) ) { |
| 21 | $this->set_scope( $query->scope ); |
| 22 | } |
| 23 | if ( !empty( $query->session ) ) { |
| 24 | $this->set_session( $query->session ); |
| 25 | } |
| 26 | if ( !empty( $query->botId ) ) { |
| 27 | $this->set_bot_id( $query->botId ); |
| 28 | } |
| 29 | if ( !empty( $query->envId ) ) { |
| 30 | $this->set_env_id( $query->envId ); |
| 31 | } |
| 32 | if ( !empty( $query->chatId ) ) { |
| 33 | $this->setChatId( $query->chatId ); |
| 34 | } |
| 35 | if ( !empty( $query->assistantId ) ) { |
| 36 | $this->setAssistantId( $query->assistantId ); |
| 37 | } |
| 38 | if ( !empty( $query->threadId ) ) { |
| 39 | $this->setThreadId( $query->threadId ); |
| 40 | } |
| 41 | if ( !empty( $query->runId ) ) { |
| 42 | $this->setRunId( $query->runId ); |
| 43 | } |
| 44 | if ( !empty( $query->storeId ) ) { |
| 45 | $this->setStoreId( $query->storeId ); |
| 46 | } |
| 47 | if ( !empty( $query->functions ) ) { |
| 48 | $this->set_functions( $query->functions ); |
| 49 | } |
| 50 | if ( !empty( $query->instructions ) ) { |
| 51 | $this->set_instructions( $query->instructions ); |
| 52 | } |
| 53 | if ( !empty( $query->messages ) ) { |
| 54 | $this->set_messages( $query->messages ); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | public function clear_feedback_blocks() { |
| 59 | $this->blocks = []; |
| 60 | } |
| 61 | |
| 62 | public function add_feedback_block( $block ) { |
| 63 | $this->blocks[] = $block; |
| 64 | } |
| 65 | |
| 66 | #[\ReturnTypeWillChange] |
| 67 | public function jsonSerialize(): array { |
| 68 | $json = [ |
| 69 | 'message' => $this->message, |
| 70 | 'blocks' => $this->blocks, |
| 71 | |
| 72 | 'ai' => [ |
| 73 | 'model' => $this->model |
| 74 | ], |
| 75 | |
| 76 | 'system' => [ |
| 77 | 'class' => get_class( $this ), |
| 78 | 'envId' => $this->envId, |
| 79 | //'mode' => $this->mode, |
| 80 | 'scope' => $this->scope, |
| 81 | 'session' => $this->session, |
| 82 | ] |
| 83 | ]; |
| 84 | |
| 85 | return $json; |
| 86 | } |
| 87 | |
| 88 | #endregion |
| 89 | } |