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