-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
SERVER_PORT=8080 | ||
CUSTOM_MESSAGE="Hello World From Configs" | ||
|
||
#CHAT_CLIENT=CHATGPT | ||
#MODEL=gpt-3.5-turbo | ||
CHAT_CLIENT=CHATGPT | ||
MODEL=gpt-3.5-turbo | ||
CHATGPT_API_KEY=NOT HERE! | ||
|
||
CHAT_CLIENT=OPENLLAMA | ||
#CHAT_CLIENT=OPENLLAMA | ||
OPENLLAMA_URL=http://127.0.0.1:11434 | ||
MODEL=llama3 | ||
#MODEL=llama3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>AI Proxy</title> | ||
<!-- Bootstrap CSS --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
<style> | ||
body, html { | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 20px; | ||
} | ||
.form-control-lg { | ||
font-size: 1.25rem; | ||
height: calc(1.5em + 1rem + 2px); | ||
padding: .5rem 1rem; | ||
line-height: 1.5; | ||
} | ||
.hidden { | ||
display: none; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1 class="text-center mb-4">AI Proxy</h1> | ||
<form id="proxyForm"> | ||
<input class="form-control form-control-lg" type="text" id="inputData" placeholder="Your AI prompt"> | ||
</form> | ||
<div id="spinner" class="hidden text-center mt-3"> | ||
<div class="spinner-border" role="status"> | ||
<span class="sr-only"></span> | ||
</div> | ||
</div> | ||
<div id="responseArea" class="mt-3"></div> | ||
</div> | ||
|
||
<!-- Bootstrap Bundle with Popper --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<!-- jQuery (Optional) --> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> | ||
<script> | ||
const form = document.getElementById('proxyForm'); | ||
const spinner = document.getElementById('spinner'); | ||
const responseArea = document.getElementById('responseArea'); | ||
|
||
form.addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
const inputData = document.getElementById('inputData').value; | ||
spinner.classList.remove('hidden'); // Show spinner | ||
responseArea.textContent = ''; // Clear previous response | ||
|
||
fetch('/chat', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ prompt: inputData }) | ||
}) | ||
.then(response => response.json()) | ||
.then(data => { | ||
spinner.classList.add('hidden'); // Hide spinner | ||
responseArea.innerText = 'Response: ' + data['result']; | ||
}) | ||
.catch(error => { | ||
console.error('Error:', error); | ||
spinner.classList.add('hidden'); // Ensure spinner is hidden on error | ||
responseArea.innerText = 'Error: ' + error.toString(); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |