Addressing phpBB extension certification issues
This commit is contained in:
parent
5554ef8593
commit
13c1b6b66d
10 changed files with 84 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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 .
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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 . '" }';
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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',
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
39
privet/ailabs/migrations/v1x/release_1_0_6_schema.php
Normal file
39
privet/ailabs/migrations/v1x/release_1_0_6_schema.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* AI Labs extension
|
||||
*
|
||||
* @copyright (c) 2023, privet.fun, https://privet.fun
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace privet\ailabs\migrations\v1x;
|
||||
|
||||
class release_1_0_6_schema extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\privet\ailabs\migrations\v1x\release_1_0_5_schema');
|
||||
}
|
||||
|
||||
public function effectively_installed()
|
||||
{
|
||||
return isset($this->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')),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue