-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update index.html to make API version easier to configure
- Loading branch information
1 parent
f7151ca
commit d21e7a5
Showing
1 changed file
with
11 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'); | ||
|
@@ -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; | ||
|
@@ -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' | ||
|
@@ -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' | ||
|