Skip to content

Commit

Permalink
Update index.html to make API version easier to configure
Browse files Browse the repository at this point in the history
  • Loading branch information
crpietschmann committed Mar 13, 2024
1 parent f7151ca commit d21e7a5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ <h5><a href="https://build5nines.com" target="_blank"><img src="/images/build5ni
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/showdown.min.js"></script>
<script>
$(document).ready(function() {

// ###################################################

// Configure the API version to use
const config_api_version = 'v1'; // "v2"

// ###################################################

const messageList = $('#message-list');
const messageForm = $('#message-form');
const messageInput = $('#message-input');
Expand All @@ -87,7 +95,7 @@ <h5><a href="https://build5nines.com" target="_blank"><img src="/images/build5ni
});

$('#btnClearHistory').click(() => {
fetch('/v2/clear').then((res) => {
fetch(`/${config_api_version}/clear`).then((res) => {
if (res.ok){
$('#message-list').html('');
return;
Expand Down Expand Up @@ -171,7 +179,7 @@ <h5><a href="https://build5nines.com" target="_blank"><img src="/images/build5ni
}

function sendMessageToApi(message) {
fetch('/v2/chat', {
fetch(`/${config_api_version}/chat`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
Expand All @@ -193,7 +201,7 @@ <h5><a href="https://build5nines.com" target="_blank"><img src="/images/build5ni


// load chat history
fetch('/v2/history', {
fetch(`/${config_api_version}/history`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
Expand Down

0 comments on commit d21e7a5

Please sign in to comment.