Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Sep 21, 2024
1 parent 8eec616 commit a19007f
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 6 deletions.
Empty file modified .github/ISSUE_TEMPLATE/bug_report.md
100644 → 100755
Empty file.
Empty file modified .github/workflows/moodle-ci.yml
100644 → 100755
Empty file.
Empty file modified .idea/.gitignore
100644 → 100755
Empty file.
Empty file modified .idea/modules.xml
100644 → 100755
Empty file.
Empty file modified .idea/moodle-tool_aiconnect.iml
100644 → 100755
Empty file.
Empty file modified .idea/php.xml
100644 → 100755
Empty file.
Empty file modified .idea/vcs.xml
100644 → 100755
Empty file.
3 changes: 1 addition & 2 deletions classes/ai/ai.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ private function make_request(array $data, string $apikey, $multipart = null): a
}

if (isset($response['error'])) {
throw new moodle_exception('endpointerror', 'tool_aiconnect', '', null,
$response['error']['message']);
throw new moodle_exception($response['error']['message']);
}

$end = microtime(true);
Expand Down
Empty file modified classes/event/make_request.php
100644 → 100755
Empty file.
Empty file modified classes/privacy/provider.php
100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions db/install.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="admin/tool/aiconnect/db" VERSION="20240623" COMMENT="XMLDB file for Moodle admin/tool/aiconnect"
<XMLDB PATH="admin/tool/aiconnect/db" VERSION="20240824" COMMENT="XMLDB file for Moodle admin/tool/aiconnect"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="tool_aiconnect_queue" COMMENT="queue requestst to AI System (LLM)">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="activity" TYPE="char" LENGTH="64" NOTNULL="false" SEQUENCE="false" COMMENT="The module or activity that is making the request e.g. qtype_aitext"/>
<FIELD NAME="prompttext" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="respose" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="response" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="actiondata" TYPE="char" LENGTH="64" NOTNULL="false" SEQUENCE="false" COMMENT="Data that relates to this transaction e.g. quiz question attempt"/>
<FIELD NAME="status" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Status of processing. 0 pending, 1, processed, 2, retrieved, -1 failed"/>
<FIELD NAME="tries" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="number of times this item has attempted to be processed"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Timestamp this item was added to the queue"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time this item was last modifief"/>
<FIELD NAME="executiontime" TYPE="int" LENGTH="15" NOTNULL="false" SEQUENCE="false" COMMENT="optional execution time."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
28 changes: 28 additions & 0 deletions db/upgrade.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,33 @@ function xmldb_tool_aiconnect_upgrade($oldversion) {
// Aiconnect savepoint reached.
upgrade_plugin_savepoint(true, 2024032006, 'tool', 'aiconnect');
}
if ($oldversion < 2024032011) {

// Define field response to be added to tool_aiconnect_queue.
$table = new xmldb_table('tool_aiconnect_queue');
$field = new xmldb_field('response', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timecreated');

// Conditionally launch add field response.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Aiconnect savepoint reached.
upgrade_plugin_savepoint(true, 2024032011, 'tool', 'aiconnect');
}
if ($oldversion < 2024032012) {

// Define field actiondata to be added to tool_aiconnect_queue.
$table = new xmldb_table('tool_aiconnect_queue');
$field = new xmldb_field('actiondata', XMLDB_TYPE_CHAR, '64', null, null, null, null, 'response');

// Conditionally launch add field actiondata.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Aiconnect savepoint reached.
upgrade_plugin_savepoint(true, 2024032012, 'tool', 'aiconnect');
}
return true;
}
Empty file modified lang/en/tool_aiconnect.php
100644 → 100755
Empty file.
Empty file modified readme.md
100644 → 100755
Empty file.
Empty file modified settings.php
100644 → 100755
Empty file.
Empty file modified test.php
100644 → 100755
Empty file.
Empty file modified tests/test_aiconnect.php
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion version.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'tool_aiconnect';
$plugin->version = 2024032006;
$plugin->version = 2024032012;
$plugin->requires = 2022112800;
$plugin->release = '4.1.1';

0 comments on commit a19007f

Please sign in to comment.