Skip to content

Commit

Permalink
Removed use of alert()
Browse files Browse the repository at this point in the history
  • Loading branch information
Raadsl committed Jul 4, 2024
1 parent e15a3e8 commit b45711b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,10 @@

<button class='button' id="toggle-api-key-visibility" type="button" title="Shows an input of the API key that is linked to the normal key input, but is viewable">View API Key</button>
<label style="display: none;" id='api-key-label'>
Api key:
API key:
<input type="text" id="view-api-key-input" placeholder="API Key" />
</label>


<hr />
<button class='button' id="reset-settings-button">Reset Settings</button>
<button class='button' id="save-settings-button">Save</button>
Expand Down
11 changes: 9 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ async function fetchAssistantResponse(apiKey, mode, history, temperature, server
if (!response.ok) {
console.log(`HTTP error! status: ${response.status}`)
}
console.log(response)
return response;

} catch (error) {
Expand Down Expand Up @@ -1166,9 +1167,15 @@ document.getElementById('view-api-key-input').addEventListener('input', function


async function useImageUrl() {
const UrlButton = document.getElementById("use-image-url-button");
const imageUrl = document.getElementById('image-url-input').value;
if (!imageUrl) {
alert("Please enter a URL");
UrlButton.disabled = true;
UrlButton.innerText = "Please enter an URL";
setTimeout(function() {
UrlButton.disabled = false;
UrlButton.innerText = "Use URL";
}, 2500);
return;
}

Expand Down Expand Up @@ -1197,7 +1204,7 @@ async function useImageUrl() {
lastID.uplaodloccalfile = await replit.messages.showConfirm("Successfully uploaded local iamge", 2000)
} catch (error) {
console.error("Failed to load or process local image:", error);
const UrlButton = document.getElementById("use-image-url-button");

UrlButton.disabled = true;
UrlButton.innerText = "Failed loading image";
setTimeout(function() {
Expand Down

0 comments on commit b45711b

Please sign in to comment.