| @@ -171,9 +171,9 @@ | ||
| 171 | 171 | * |
| 172 | 172 | * @return mixed The result of the snippet execution. |
| 173 | 173 | * @throws Exception If the snippet cannot be executed. |
| 174 | 174 | */ |
| 175 | - public function executeSnippet( $id, $args = [], $reply = null ) { | |
| 175 | + public function executeSnippet( $id, $args = [] ) { | |
| 176 | 176 | try { |
| 177 | 177 | if ( empty( $id ) ) { |
| 178 | 178 | throw new Exception( 'The snippet ID is required.' ); |
| 179 | 179 | } |
| @@ -186,34 +186,9 @@ | ||
| 186 | 186 | $snippet = $this->snippet_module->get_function( $id ); |
| 187 | 187 | if ( empty( $snippet ) ) { |
| 188 | 188 | throw new Exception( sprintf( 'Snippet with ID %d not found.', $id ) ); |
| 189 | 189 | } |
| 190 | - | |
| 191 | - $query = $reply ? $reply->query : null; | |
| 192 | - $array_query = []; | |
| 193 | - if( $query ) { | |
| 194 | - $array_query['envId'] = $query->envId ?? 'No EnvId in Query'; | |
| 195 | - $array_query['botId'] = $query->botId ?? 'No BotId in Query'; | |
| 196 | - $array_query['customId'] = $query->customId ?? 'No CustomId in Query'; | |
| 197 | - $array_query['embeddingsEnvId'] = $query->embeddingsEnvId ?? 'No EmbeddingsEnvId in Query'; | |
| 198 | - | |
| 199 | - | |
| 200 | - $array_query['chatId'] = $query->chatId ?? 'No ChatId in Query'; | |
| 201 | - $array_query['session'] = $query->session ?? 'No Session in Query'; | |
| 202 | - $array_query['scope'] = $query->scope ?? 'No Scope in Query'; | |
| 203 | - | |
| 204 | - $array_query['instructions'] = $query->instructions ?? 'No Instructions in Query'; | |
| 205 | - $array_query['context'] = $query->context ?? 'No Context in Query'; | |
| 206 | - | |
| 207 | - $array_query['messages'] = $query->messages ? json_encode( $query->messages ) : 'No Messages in Query'; | |
| 208 | - $array_query['message'] = $query->message ?? 'No Message in Query'; | |
| 209 | - | |
| 210 | - $array_query['model'] = $query->model ?? 'No Model in Query'; | |
| 211 | - $array_query['feature'] = $query->feature ?? 'No Feature in Query'; | |
| 212 | - } | |
| 213 | - | |
| 214 | - $args['__mwai_query'] = $array_query; | |
| 215 | - | |
| 190 | + | |
| 216 | 191 | $output = $this->core->run_snippet( $id, $args ); |
| 217 | 192 | |
| 218 | 193 | if ( $this->debug ) { |
| 219 | 194 | $shortOutput = is_string( $output ) ? substr( $output, 0, 100 ) : json_encode( $output ); |