OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
genai
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
11/28/2024 11:03:35 AM
rwxrwxr-x
📄
article.php
997 bytes
05/19/2024 04:03:54 PM
rw-r--r--
📄
atri.php
6.15 KB
05/16/2024 03:58:00 AM
rw-r--r--
📄
bgenai_save.php
2.13 KB
06/22/2024 11:54:40 AM
rw-r--r--
📄
bizx.php
6.25 KB
05/16/2024 03:58:11 AM
rw-r--r--
📄
bprocess_genai.php
17.32 KB
08/22/2024 06:42:55 AM
rw-r--r--
📄
casudhi.php
6.59 KB
06/10/2024 05:09:43 AM
rw-r--r--
📄
creamai.php
12.81 KB
06/05/2024 11:58:31 PM
rw-r--r--
📄
gen2 copy.php
13.89 KB
05/21/2024 01:25:56 AM
rw-r--r--
📄
gen2.php
17.74 KB
06/12/2024 10:34:13 AM
rw-r--r--
📄
gen2_1.php
29.92 KB
06/15/2024 04:21:20 AM
rw-r--r--
📄
gen2_1_1.php
30.24 KB
06/14/2024 07:42:54 AM
rw-r--r--
📄
gen2_without_copytext.php
12.1 KB
05/19/2024 03:17:36 AM
rw-r--r--
📄
genai_article_save.php
1.6 KB
09/17/2024 07:46:25 AM
rw-r--r--
📄
genai_function.php
17.26 KB
09/17/2024 07:45:48 AM
rw-r--r--
📄
genai_save.php
2.13 KB
09/17/2024 07:45:57 AM
rw-r--r--
📄
gencv.php
6.84 KB
08/04/2024 12:04:57 PM
rw-r--r--
📄
gengraf.php
6.79 KB
05/18/2024 09:59:45 AM
rw-r--r--
📄
iamlucky.php
2.57 KB
05/09/2024 12:44:10 PM
rw-r--r--
📁
images
-
06/10/2024 05:06:33 AM
rwxr-xr-x
📄
index.html
3.9 KB
05/09/2024 06:09:07 AM
rw-rw-r--
📄
my_tts.sh
327 bytes
05/09/2024 10:11:32 AM
rwxrwxrwx
📄
netra.php
6.1 KB
05/16/2024 03:57:29 AM
rw-r--r--
📄
oai.sh
619 bytes
05/09/2024 10:37:43 AM
rw-r--r--
📄
old_gen2.php
13.54 KB
05/22/2024 02:35:21 PM
rw-r--r--
📄
old_genai_save.php
1.32 KB
05/22/2024 02:06:04 PM
rw-r--r--
📄
old_process_genai.php
5.77 KB
06/22/2024 04:08:45 AM
rw-r--r--
📄
process_genai.php
2.02 KB
09/17/2024 07:46:13 AM
rw-r--r--
📄
result.html
541 bytes
05/09/2024 06:09:07 AM
rw-rw-r--
📄
speech.mp3
67.97 KB
05/09/2024 10:30:50 AM
rw-r--r--
📄
submit_handler.php
2.78 KB
05/09/2024 11:53:47 AM
rw-r--r--
📁
team
-
05/21/2024 09:32:43 AM
rwxr-xr-x
📁
venv
-
05/09/2024 07:06:18 AM
rwxr-xr-x
Editing: gen2_without_copytext.php
Close
<?php // Start or resume the session session_start(); include '../inc/validate.logged.php'; include '../inc/config.php'; // Corrected the path // Define system prompts for various scenarios $system_prompts = array( "#todo" => "Convert the text that follows as a todo item.", "#post" => "Convert the text that follows as a social post.", "#joke" => "use text as a context or theme to write a joke.", "#note" => "Convert the text that follows as a note.", "#bored" => "Respond with a motivational anecdote especially from among Robin Williams, Emerson, Mark Twain, Jim Ron, Dale Carnegie, Simon Sinek", "#advise" => "Take the following text to give me advise with anecdotes on how it was done by someone else.", "#done" => "Congratulate me and make me feel on top of the world.", "#working" => "help me keep my focus on the current work.", "#continue" => "Answer within the context of : " . end($_SESSION), "#tran-ek" => "Convert the text that follows into Kannada language", "#tran-ke" => "Convert the text in kannada that follows into English language", "#reporter" => "Convert the text that follows as a newspaper report", "#ben" => "Respond like you are Ben Franklin, picking from your writings and thoughts and motivating and guiding.", "#list" => "Respond with html entities that can be rendered directly without postprocessing. Add a html break entity after each item." ); if ($_SERVER["REQUEST_METHOD"] == "POST") { // Clear the generated content if the "Clear" button is clicked if (isset($_POST['clear'])) { unset($_SESSION['generated_content']); // Redirect back to the same page to clear the displayed content header("Location: {$_SERVER['REQUEST_URI']}"); exit(); } // Generate new content if the form is submitted else { // Get form data $working_headline = $_POST["working_headline"]; $num_words = 500; // Set your API key $apiKey = "sk-proj-FrlWqCTIyid7DZGorv0uT3BlbkFJzqrUB0km57kpp4aFPNV7"; // Set the endpoint URL for chat completions $url = "https://api.openai.com/v1/chat/completions"; // Preprocess system prompts $system_prompt = ""; foreach ($system_prompts as $trigger => $response) { if (strpos($working_headline, $trigger) === 0) { $system_prompt = "System: " . $response; // Remove the trigger from the input $working_headline = substr($working_headline, strlen($trigger)); break; } } // Set the request data with a chat-based model and messages parameter $data = array( "model" => "gpt-3.5-turbo", //gpt-3.5-turbo "messages" => array( array( "role" => "system", "content" => "System: Try to complete the sentence even if the max_tokens is reached. Embed icons where possible to make your response beautiful." ), array( "role" => "system", "content" => $system_prompt ), array( "role" => "user", "content" => "You: $working_headline." ) ), "max_tokens" => $num_words ); // Initialize cURL $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "Authorization: Bearer $apiKey" )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the request $response = curl_exec($ch); // Close cURL curl_close($ch); // Decode JSON response $result = json_decode($response, true); // Extract the total_tokens $totalTokens = $result['usage']['total_tokens']; // Get the generated content $new_content = $result['choices'][0]['message']['content']; // Append the new content to the existing content if (!isset($_SESSION['generated_content'])) { $_SESSION['generated_content'] = ""; } $_SESSION['generated_content'] = $new_content . "<br><br>" . $_SESSION['generated_content']; $totalTokens += $result['usage']['total_tokens']; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Knobly Cream GenAI</title> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> <!-- Font Awesome CSS --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> <!-- Custom CSS --> <link rel="stylesheet" href="styles.css"> <!-- jQuery --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <style> body, html { height: 100%; margin: 0; display: flex; flex-direction: column; } .content { flex: 1; display: flex; flex-direction: column; } .footer { background-color: #f8f9fa; text-align: center; padding: 10px 0; position: relative; width: 100%; bottom: 0; } .tips-button { position: absolute; top: 10px; right: 10px; font-size: 0.9rem; color: #007bff; cursor: pointer; z-index: 10; } .modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); } .modal-content { background-color: #f9f9f9; margin: 10% auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 10px; } .close { color: #aaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; } .tips-content { font-size: 0.9rem; color: #333; } @media (max-width: 768px) { .tips-button { top: 50px; right: 10px; font-size: 0.8rem; } .container { text-align: center; } header img { max-width: 150px; margin-bottom: 20px; } } </style> </head> <body> <header class="bg-light"> <div class="container text-center py-3"> <a href="/"><img src="../grfx/logo.png" alt="Knobly Cream" style="max-width: 200px;"></a> <p class="lead">Create • Reach • Measure</p> <span class="tips-button" id="tipsButton">#-tag Tips</span> </div> </header> <div class="container content py-4"> <div class="row justify-content-center"> <div class="col-md-6"> <form method="post" action=""> <table class="w-100"> <tr> <td> <div class="form-group lead"> <label for="working_headline">let's write:</label> <input type="text" class="form-control" id="working_headline" name="working_headline"> </div> </td> <td class="text-right"> <button type="submit" class="btn btn-warning lead" style="background-color:#F58021; border-color:#F58021; color:white">Go</button> </td> <td> <div class="text-right"> <button type="submit" class="btn btn-secondary lead" name="clear">Clear</button> </div> </td> </tr> </table> </form> </div> </div> <?php // Display the generated content if (!empty($_SESSION['generated_content'])) { echo "<div class='row justify-content-center'>"; echo "<div class='col-md-8'>"; echo "<h2 class='text-center'>Generated Content</h2>"; echo "<p id='myInput'>▶ " . $_SESSION['generated_content'] . "</p>"; // Fixed content display ?> <!-- The button used to copy the text --> <button onclick="myFunction()">Copy text</button> <?php echo "<p>Total Tokens: " . $totalTokens . "</p>"; // Corrected token display echo "<p>" . date('Y-m-d H:i:s') . "</p>"; echo "</div>"; echo "</div>"; } ?> </div> <!-- Modal for Tips --> <div id="tipsModal" class="modal"> <div class="modal-content"> <span class="close">×</span> <div class="tips-content"> <h2>#-tag Tips</h2> <ul> <li>#todo: Convert the text that follows as a todo item.</li> <li>#post: Convert the text that follows as a social post.</li> <li>#joke: Use text as a context or theme to write a joke.</li> <li>#note: Convert the text that follows as a note.</li> <li>#bored: Respond with a motivational anecdote especially from among Robin Williams, Emerson, Mark Twain, Jim Rohn, Dale Carnegie, Simon Sinek.</li> <li>#advise: Take the following text to give me advice with anecdotes on how it was done by someone else.</li> <li>#done: Congratulate me and make me feel on top of the world.</li> <li>#working: Help me keep my focus on the current work.</li> <li>#continue: Answer within the context of : (insert context).</li> <li>#tran-ek: Convert the text that follows into Kannada language.</li> <li>#tran-ke: Convert the text in Kannada that follows into English language.</li> <li>#reporter: Convert the text that follows as a newspaper report.</li> <li>#ben: Respond like you are Ben Franklin, picking from your writings and thoughts and motivating and guiding.</li> </ul> </div> </div> </div> <footer class="footer"> © 2024 Knobly Cream GenAI </footer> <!-- Bootstrap JS --> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> <script> // JavaScript for modal functionality $(document).ready(function() { var modal = $('#tipsModal'); var btn = $('#tipsButton'); var span = $('.close'); btn.click(function() { modal.show(); }); span.click(function() { modal.hide(); }); $(window).click(function(event) { if ($(event.target).is(modal)) { modal.hide(); } }); }); </script> <script> function myFunction() { // Get the text field var copyText = document.getElementById("myInput"); // Select the text field copyText.select(); copyText.setSelectionRange(0, 99999); // For mobile devices // Copy the text inside the text field navigator.clipboard.writeText(copyText.value); // Alert the copied text alert("Copied the text: " + copyText.value); } </script> </body> </html>