| 1 |
<?php |
| 2 |
global $wpchatbot_pro_professional_init,$wpchatbot_pro_master_init; |
| 3 |
if((isset($wpchatbot_pro_master_init) && $wpchatbot_pro_master_init->is_valid()) || (isset($wpchatbot_pro_professional_init) && $wpchatbot_pro_professional_init->is_valid()) || (function_exists('get_openaiaddon_valid_license') && get_openaiaddon_valid_license())){ |
| 4 |
?> |
| 5 |
<div class="row"> |
| 6 |
<div class="col-md-12"> |
| 7 |
<div class="alert alert-danger my-4"> |
| 8 |
<?php esc_html_e('This feature is still experimental and development is ongoing because of the difficulties in cleaning up the multitudes of tags added by page builders'); ?> |
| 9 |
</div> |
| 10 |
<form class="file_form my-4"> |
| 11 |
<div id="wp-chatbot-post-converter"> |
| 12 |
<ul class="checkbox-list"> |
| 13 |
<?php |
| 14 |
$get_cpt_args = array( |
| 15 |
'public' => true, |
| 16 |
); |
| 17 |
$post_types = get_post_types( $get_cpt_args, 'object' ); |
| 18 |
foreach ($post_types as $post_type) { |
| 19 |
if($post_type->name != "attachment"){ |
| 20 |
?> |
| 21 |
<div class="form-check form-check-inline"> |
| 22 |
<input |
| 23 |
id="wp_chatbot_data_converter_<?php echo $post_type->name; ?>" |
| 24 |
type="checkbox" |
| 25 |
name="wp_chatbot_data_converter_list[]" |
| 26 |
value="<?php echo $post_type->name; ?>" > |
| 27 |
<label class="form-check-label" for="wp_chatbot_data_converter_<?php echo $post_type->name; ?>"> <?php echo $post_type->name; ?></label> |
| 28 |
</div> |
| 29 |
<?php |
| 30 |
} |
| 31 |
} |
| 32 |
?> |
| 33 |
</ul> |
| 34 |
</div> |
| 35 |
<a class="btn btn-default qcld_convert_data"><?php esc_html_e('Convert Data'); ?></a> |
| 36 |
</form> |
| 37 |
<h3><?php esc_html_e('Conversions Files'); ?></h3> |
| 38 |
<?php |
| 39 |
global $wpdb; |
| 40 |
$qcld_openai_files_page = isset($_GET['wpage']) && !empty($_GET['wpage']) ? sanitize_text_field($_GET['wpage']) : 1; |
| 41 |
$qcld_openai_files_per_page = 20; |
| 42 |
$qcld_openai_files_offset = ( $qcld_openai_files_page * $qcld_openai_files_per_page ) - $qcld_openai_files_per_page; |
| 43 |
$qcld_openai_files_count_sql = "SELECT COUNT(*) FROM ".$wpdb->posts." f WHERE f.post_type='qcldopenai_convert' AND f.post_status='publish'"; |
| 44 |
$qcld_openai_files_sql = "SELECT f.* FROM ".$wpdb->posts." f WHERE f.post_type='qcldopenai_convert' AND f.post_status='publish' ORDER BY f.post_date DESC LIMIT ".$qcld_openai_files_offset.",".$qcld_openai_files_per_page; |
| 45 |
$qcld_openai_files = $wpdb->get_results($qcld_openai_files_sql); |
| 46 |
|
| 47 |
$qcld_openai_files_total = $wpdb->get_var( $qcld_openai_files_count_sql ); |
| 48 |
|
| 49 |
?> |
| 50 |
<div class="table-responsive"> |
| 51 |
<table class="table table-striped table-bordered qcld_convert_datatable"> |
| 52 |
<thead><tr><td><?php esc_html_e( 'Filename','openai_addon');?></td><td><?php esc_html_e( 'Fine tune with','openai_addon');?></td><td><?php esc_html_e( 'Date of creation','openai_addon');?></td><td><?php esc_html_e( 'Size','openai_addon');?></td><td> <?php esc_html_e( 'Action','openai_addon');?></td></tr></thead> |
| 53 |
<tbody id="post_conversion_files"> |
| 54 |
<?php |
| 55 |
if($qcld_openai_files && is_array($qcld_openai_files) && count($qcld_openai_files)): |
| 56 |
foreach($qcld_openai_files as $qcld_openai_file): |
| 57 |
$file = wp_upload_dir()['basedir'].'/qcldopenai_site_training/'.$qcld_openai_file->post_title; |
| 58 |
if(file_exists($file)): |
| 59 |
$type = explode('_',$qcld_openai_file->post_title); |
| 60 |
$type = (sizeof($type) == 2) ? 'GPT3.5' : 'Davinci, ADA etc.'; |
| 61 |
?> |
| 62 |
<tr> |
| 63 |
<td><?php echo esc_html($qcld_openai_file->post_title);?></td> |
| 64 |
<td><?php echo esc_html($type);?></td> |
| 65 |
<td><?php echo date('d.m.Y H:i',strtotime($qcld_openai_file->post_date));?></td> |
| 66 |
<td><?php echo date('d.m.Y H:i',strtotime($qcld_openai_file->post_modified));?></td> |
| 67 |
<td><?php echo size_format(filesize($file));?></td> |
| 68 |
<td> |
| 69 |
<a class="button button-small" href="<?php echo wp_upload_dir()['baseurl'].'/qcldopenai_site_training/'.esc_html($qcld_openai_file->post_title)?>" download><?php esc_html_e('Download'); ?></a> |
| 70 |
<a class="button button-small qcld_delete_training_file" data-file="<?php echo wp_upload_dir()['basedir'].'/qcldopenai_site_training/'.esc_html($qcld_openai_file->post_title)?>" ><?php esc_html_e('Delete'); ?></a> |
| 71 |
<button class="button button-small qcld_convert_upload" data-lines="<?php echo count(file($file))?>" data-file="<?php echo esc_html($qcld_openai_file->post_title)?>"><?php esc_html_e('Upload As FT Model'); ?></button> |
| 72 |
</td> |
| 73 |
</tr> |
| 74 |
<?php |
| 75 |
endif; |
| 76 |
endforeach; |
| 77 |
endif; |
| 78 |
?> |
| 79 |
</tbody> |
| 80 |
</table> |
| 81 |
</div> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
<?php |
| 85 |
} else { ?> |
| 86 |
<div class="row"> |
| 87 |
<div class="col-md-12"> |
| 88 |
<?php |
| 89 |
esc_html_e('Fine tuning and training is available with the WPBot Pro Professional and Master Licenses'); |
| 90 |
?> |
| 91 |
</div> |
| 92 |
</div> |
| 93 |
<?php } ?> |
| 94 |
|
| 95 |
|