Skip to content

Commit

Permalink
Add local store reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
robbizbal committed Nov 13, 2024
1 parent b9cdda1 commit b216f08
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
15 changes: 14 additions & 1 deletion src/static/scripts/mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ document.getElementById('backendType').addEventListener('change', function() {

// shows/hides custom input fields when checkbox is checked
document.getElementById('LLMcustom').addEventListener('change', function() {
var llmInputDiv = document.getElementById('LLMInput');
var llmInputDiv = document.getElementById('LLMInput');
var llmInputReset = document.getElementById('LLMReset');
if (this.checked === true) {
llmInputDiv.style.display = 'flex'; // Show the LLMInput div
llmInputReset.style.display = 'flex';
} else {
llmInputDiv.style.display = 'none'; // Hide the LLMInput div
llmInputReset.style.display = 'none';
}
});

Expand Down Expand Up @@ -49,6 +52,16 @@ document.getElementById('inputForm').addEventListener('submit', function(event)
}
});

// Reset stored values when reset button is clicked
document.getElementById('btnLLMReset').addEventListener('click', function() {
alert('Reset stored custom LLM settings');
document.getElementById('inputLLMurl').value = "";
localStorage.setItem('LLMURL', "");

document.getElementById('inputLLMmodel').value = "";
localStorage.setItem('LLMMODEL', "");
});

document.getElementById('inputForm').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the default form submission

Expand Down
6 changes: 1 addition & 5 deletions src/static/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ footer {
white-space: pre-wrap; /* Preserve whitespace */
}

#LLMInput {
display: none; /* Hide by default */
}

#LLMcustomLabel {
#LLMcustomLabel, #LLMReset, #LLMInput {
display: none; /* Hide by default */
}

Expand Down
3 changes: 3 additions & 0 deletions src/templates/html/mask.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ <h3>Input</h3>
<div class="flex-item">
<input type="text" name="LLMMODEL" id="inputLLMmodel" placeholder="e.g.: llama3.2:latest"></input>
</div>
<div id="LLMReset" class="flex-item">
<button id="btnLLMReset"type="button">Reset</button>
</div>
</div>
<div class="flex-item">
<input type="submit" value="Submit">
Expand Down

0 comments on commit b216f08

Please sign in to comment.