mirror of https://github.com/itflow-org/itflow
Added AI Model to the AI settings
This commit is contained in:
parent
d9f7a2d128
commit
cb26d40090
|
|
@ -48,7 +48,7 @@ document.getElementById('rewordButton').addEventListener('click', function() {
|
|||
|
||||
// Prepare the API request payload
|
||||
const data = {
|
||||
model: "text-davinci-004", // or the latest available model
|
||||
model: "<?php echo $config_ai_model; ?>", // or the latest available model
|
||||
prompt: `Reword the following text: "${textToReword}"`,
|
||||
temperature: 0.7,
|
||||
max_tokens: 1024,
|
||||
|
|
|
|||
|
|
@ -1599,10 +1599,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.5'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.0.5') {
|
||||
// // Insert queries here required to update to DB version 1.0.6
|
||||
if (CURRENT_DATABASE_VERSION == '1.0.5') {
|
||||
//Insert queries here required to update to DB version 1.0.6
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ai_model` VARCHAR(250) DEFAULT NULL AFTER `config_ai_provider`");
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.6'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.0.6') {
|
||||
// // Insert queries here required to update to DB version 1.0.7
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.6'");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.7'");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.0.5");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.0.6");
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ $config_stripe_client_pays_fees = intval($row['config_stripe_client_pays_fees'])
|
|||
// AI Provider Details
|
||||
$config_ai_enable = intval($row['config_ai_enable']);
|
||||
$config_ai_provider = $row['config_ai_provider'];
|
||||
$config_ai_model = $row['config_ai_model'];
|
||||
$config_ai_url = $row['config_ai_url'];
|
||||
$config_ai_api_key = $row['config_ai_api_key'];
|
||||
|
||||
|
|
|
|||
|
|
@ -460,11 +460,11 @@ if (isset($_POST['edit_ai_settings'])) {
|
|||
} else {
|
||||
$ai_enable = 0;
|
||||
}
|
||||
|
||||
$model = sanitizeInput($_POST['model']);
|
||||
$url = sanitizeInput($_POST['url']);
|
||||
$api_key = sanitizeInput($_POST['api_key']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_ai_enable = $ai_enable, config_ai_provider = '$provider', config_ai_url = '$url', config_ai_api_key = '$api_key' WHERE company_id = 1");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_ai_enable = $ai_enable, config_ai_provider = '$provider', config_ai_model = '$model', config_ai_url = '$url', config_ai_api_key = '$api_key' WHERE company_id = 1");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Edit', log_description = '$session_name edited AI settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ require_once "inc_all_settings.php";
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>AI Model</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-robot"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="model" value="<?php echo nullable_htmlentities($config_ai_model); ?>" placeholder="ex gpt-4">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL</label>
|
||||
<div class="input-group">
|
||||
|
|
|
|||
Loading…
Reference in New Issue