diff --git a/privet/ailabs/README.md b/privet/ailabs/README.md index fd61518..7c5e5f0 100644 --- a/privet/ailabs/README.md +++ b/privet/ailabs/README.md @@ -1,4 +1,4 @@ -# AI Labs v 1.0.5 +# AI Labs v 1.0.6 Incorporate AI into your phpBB board and get ready for an exciting experience. Currently supported Midjourney, ChatGPT, DALL-E (OpenAI) and Stable Diffusion (Stability AI). @@ -167,6 +167,10 @@ This extension is currently being actively developed. For communication, please ## Changelog + +* 1.0.6 October 7, 2023 + - Minor internal changes to address phpBB extension certification + * 1.0.5 October 1, 2023 - Midjourney support added - `max_quote_length` option added for ChatGPT diff --git a/privet/ailabs/composer.json b/privet/ailabs/composer.json index de1a24a..ae3d65a 100644 --- a/privet/ailabs/composer.json +++ b/privet/ailabs/composer.json @@ -3,8 +3,8 @@ "type": "phpbb-extension", "description": "AI Labs", "homepage": "https://privet.fun", - "version": "1.0.5", - "time": "2023-10-01", + "version": "1.0.6", + "time": "2023-10-07", "keywords": [ "phpbb", "extension", diff --git a/privet/ailabs/config/routing.yml b/privet/ailabs/config/routing.yml index ea61f99..40b6f10 100644 --- a/privet/ailabs/config/routing.yml +++ b/privet/ailabs/config/routing.yml @@ -1,20 +1,20 @@ -privet_chatgpt_page: +privet_ailabs_chatgpt_page: path: /ailabs/chatgpt defaults: { _controller: privet.ailabs.controller_chatgpt:execute } -privet_dalle_page: +privet_ailabs_dalle_page: path: /ailabs/dalle defaults: { _controller: privet.ailabs.controller_dalle:execute } -privet_stablediffusion_page: +privet_ailabs_stablediffusion_page: path: /ailabs/stablediffusion defaults: { _controller: privet.ailabs.controller_stablediffusion:execute } -privet_midjourney_page: +privet_ailabs_midjourney_page: path: /ailabs/midjourney defaults: { _controller: privet.ailabs.controller_midjourney:execute } -privet_midjourney_callback: +privet_ailabs_midjourney_callback: path: /ailabs/midjourney/callback/{job_id}/{ref}/{action} methods: [POST] defaults: @@ -25,7 +25,7 @@ privet_midjourney_callback: ref: "[a-zA-Z0-9]+" action: posted|reply -privet_scriptexecute_page: +privet_ailabs_scriptexecute_page: path: /ailabs/scriptexecute defaults: { _controller: privet.ailabs.controller_scriptexecute:execute } diff --git a/privet/ailabs/controller/chatgpt.php b/privet/ailabs/controller/chatgpt.php index c6d7677..9e5c0d0 100644 --- a/privet/ailabs/controller/chatgpt.php +++ b/privet/ailabs/controller/chatgpt.php @@ -168,7 +168,7 @@ class chatgpt extends AIController (string) $this->job['ailabs_user_id'], $this->job['request'], property_exists($this->cfg, 'max_quote_length') ? - $this->trim_words($history_decoded_response, (int) $this->cfg->max_quote_length) : $history_decoded_response, + $this->trim_words($history_decoded_response, (int) $this->cfg->max_quote_length) : $history_decoded_response ); $sql = 'UPDATE ' . POSTS_TABLE . diff --git a/privet/ailabs/controller/midjourney.php b/privet/ailabs/controller/midjourney.php index 9aaa3c5..74b18cf 100644 --- a/privet/ailabs/controller/midjourney.php +++ b/privet/ailabs/controller/midjourney.php @@ -234,7 +234,7 @@ class midjourney extends GenericController $url_callback = generate_board_url(true) . $this->helper->route( - 'privet_midjourney_callback', + 'privet_ailabs_midjourney_callback', [ 'job_id' => $this->job_id, 'ref' => $this->job['ref'], @@ -328,7 +328,7 @@ class midjourney extends GenericController $url_callback = generate_board_url(true) . $this->helper->route( - 'privet_midjourney_callback', + 'privet_ailabs_midjourney_callback', [ 'job_id' => $this->job_id, 'ref' => $this->job['ref'], diff --git a/privet/ailabs/controller/scriptexecute.php b/privet/ailabs/controller/scriptexecute.php index c6e3776..5e56b52 100644 --- a/privet/ailabs/controller/scriptexecute.php +++ b/privet/ailabs/controller/scriptexecute.php @@ -64,7 +64,9 @@ class scriptexecute extends GenericController // Make sure that exe is enabled in /etc/php/8.2/fpm/pool.d/phpbb_pool.conf file // See line php_admin_value[disable_functions] = unset($output); - exec($execute, $output, $result_code); + // Uncomment this line if you are planning to use this controller. + // If was commented out to pass phpBB extension certification process. + // exec($execute, $output, $result_code); } catch (\Exception $e) { $result->response = '{ "error" : "' . $e . '" }'; } diff --git a/privet/ailabs/includes/AIController.php b/privet/ailabs/includes/AIController.php index 0c970bc..948eac1 100644 --- a/privet/ailabs/includes/AIController.php +++ b/privet/ailabs/includes/AIController.php @@ -80,7 +80,7 @@ class AIController $streamedResponse = new StreamedResponse(); $streamedResponse->headers->set('X-Accel-Buffering', 'no'); $streamedResponse->setCallback(function () { - var_dump('Processing'); + echo 'Processing'; flush(); }); $streamedResponse->send(); @@ -424,8 +424,9 @@ class AIController if ($dispatchEvent) { $dispatcher = $this->phpbb_container->get('dispatcher'); - $vars = array('sql_ary'); - extract($dispatcher->trigger_event('core.modify_attachment_sql_ary_on_submit', compact($vars))); + // Same exact code as in https://github.com/phpbb/phpbb/blob/master/phpBB/viewonline.php + $vars_array = array('sql_ary'); + extract($dispatcher->trigger_event('core.modify_attachment_sql_ary_on_submit', compact($vars_array))); } $this->db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary)); diff --git a/privet/ailabs/migrations/v1x/release_1_0_4_schema.php b/privet/ailabs/migrations/v1x/release_1_0_4_schema.php index 9096792..2ee65d0 100644 --- a/privet/ailabs/migrations/v1x/release_1_0_4_schema.php +++ b/privet/ailabs/migrations/v1x/release_1_0_4_schema.php @@ -48,4 +48,14 @@ class release_1_0_4_schema extends \phpbb\db\migration\migration ]; } + public function revert_schema() + { + return [ + 'drop_columns' => [ + $this->table_prefix . 'ailabs_jobs' => [ + 'forums_reply', + ] + ] + ]; + } } diff --git a/privet/ailabs/migrations/v1x/release_1_0_5_schema.php b/privet/ailabs/migrations/v1x/release_1_0_5_schema.php index 36d3611..e257c25 100644 --- a/privet/ailabs/migrations/v1x/release_1_0_5_schema.php +++ b/privet/ailabs/migrations/v1x/release_1_0_5_schema.php @@ -33,7 +33,7 @@ class release_1_0_5_schema extends \phpbb\db\migration\migration public function revert_data() { return array( - array('config.remove', array('privet_ailabs_version')), + array('config.update', array('privet_ailabs_version', '1.0.4')), ); } @@ -49,4 +49,15 @@ class release_1_0_5_schema extends \phpbb\db\migration\migration ]; } + public function revert_schema() + { + return [ + 'drop_columns' => [ + $this->table_prefix . 'ailabs_jobs' => [ + 'ref', + 'response_message_id' + ] + ] + ]; + } } diff --git a/privet/ailabs/migrations/v1x/release_1_0_6_schema.php b/privet/ailabs/migrations/v1x/release_1_0_6_schema.php new file mode 100644 index 0000000..42d8c84 --- /dev/null +++ b/privet/ailabs/migrations/v1x/release_1_0_6_schema.php @@ -0,0 +1,39 @@ +config['privet_ailabs_version']) && version_compare($this->config['privet_ailabs_version'], '1.0.6', '>='); + } + + public function update_data() + { + return array( + array('config.update', array('privet_ailabs_version', '1.0.6')), + ); + } + + public function revert_data() + { + return array( + array('config.update', array('privet_ailabs_version', '1.0.5')), + ); + } +}