prepare(" AND `data` LIKE %s", '%' . $wpdb->esc_like($search) . '%'); $where .= $wpdb->prepare(" OR `prompt` LIKE %s", '%' . $wpdb->esc_like($search) . '%'); } $query = "SELECT * FROM ".$wpdb->prefix."acwc_promptbase_logs WHERE 1=1".$where; $total_query = "SELECT COUNT(1) FROM (${query}) AS combined_table"; $total = $wpdb->get_var( $total_query ); $items_per_page = 20; $offset = ( $acwc_log_page * $items_per_page ) - $items_per_page; $acwc_logs = $wpdb->get_results( $query . " ORDER BY created_at DESC LIMIT ${offset}, ${items_per_page}" ); $totalPage = ceil($total / $items_per_page); ?>
model; $acwc_usage_token = $acwc_log->tokens; if($acwc_ai_model === 'gpt-3.5-turbo') { $acwc_estimated = 0.002 * $acwc_usage_token / 1000; } if($acwc_ai_model === 'gpt-4') { $acwc_estimated = 0.06 * $acwc_usage_token / 1000; } if($acwc_ai_model === 'gpt-4-32k') { $acwc_estimated = 0.12 * $acwc_usage_token / 1000; } else{ $acwc_estimated = 0.02 * $acwc_usage_token / 1000; } ?>
# Title Prompt Used Model Duration Token Estimated Created At
prompt_id)?> name)?> prompt,0,100))?>.. acwc_seconds_to_time((int)$acwc_log->duration))?> $ created_at))?>
1){ echo paginate_links( array( 'base' => admin_url('admin.php?page=acwc_promptbase&action=logs&wpage=%#%'), 'total' => $totalPage, 'current' => $acwc_log_page, 'format' => '?wpage=%#%', 'show_all' => false, 'prev_next' => false, 'add_args' => false, )); } ?>