Skip to content

Commit b5ad51c

Browse files
committed
Refactor: Remove test settings and functionality
Removed the 'Generate randomly' button from the UI, the associated 'generateRandomTestStory' function, and its event listener. This change prepares the application for use with the live Arduino backend by removing test-specific code.
1 parent f613990 commit b5ad51c

File tree

4 files changed

+5
-32
lines changed

4 files changed

+5
-32
lines changed

examples/bedtime-story-teller/app.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description:
55
It uses a cloud-based language model to generate a story based on user input and shows the story on a web interface.
66

77
bricks:
8-
- arduino:cloud_llm
9-
variables:
10-
API_KEY: <API_KEY>
8+
- arduino:cloud_llm:
9+
variables:
10+
API_KEY: <API_KEY>
1111
- arduino:web_ui

examples/bedtime-story-teller/assets/app.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,7 @@
44

55
const socket = io(`http://${window.location.host}`);
66

7-
function generateRandomTestStory() {
8-
document.querySelector('.story-output-placeholder').style.display = 'none';
9-
const responseArea = document.getElementById('story-response-area');
10-
responseArea.style.display = 'flex';
11-
document.getElementById('prompt-container').style.display = 'none';
12-
document.getElementById('story-container').style.display = 'none';
13-
document.getElementById('loading-spinner').style.display = 'block';
14-
document.getElementById('story-response').textContent = '';
15-
document.getElementById('clear-story-button').style.display = 'none';
16-
setTimeout(() => {
17-
const randomStory = `Once upon a time, in a land far, far away, there lived a brave ${Math.random() > 0.5 ? 'knight' : 'princess'}. They embarked on a quest to find a magical ${Math.random() > 0.5 ? 'dragon' : 'unicorn'} and save their kingdom from a wicked ${Math.random() > 0.5 ? 'sorcerer' : 'giant'}. After many adventures and challenges, they succeeded and lived happily ever after. The end.`;
18-
document.getElementById('story-container').style.display = 'flex';
19-
const storyResponse = document.getElementById('story-response');
20-
storyResponse.textContent += randomStory;
21-
document.getElementById('loading-spinner').style.display = 'none';
22-
const clearStoryButton = document.getElementById('clear-story-button');
23-
clearStoryButton.style.display = 'block';
24-
clearStoryButton.disabled = false;
25-
}, 1500);
26-
}
7+
278

289
function initSocketIO() {
2910
socket.on('response', (data) => {
@@ -347,7 +328,7 @@ document.addEventListener('DOMContentLoaded', () => {
347328
});
348329

349330
document.querySelector('.generate-story-button').addEventListener('click', gatherDataAndGenerateStory);
350-
document.querySelector('.generate-randomly-button').addEventListener('click', generateRandomTestStory);
331+
351332

352333
const modal = document.getElementById('new-story-modal');
353334
const clearButton = document.getElementById('clear-story-button');

examples/bedtime-story-teller/assets/index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ <h3 class="parameter-title">Other</h3>
172172
<div class="story-output-container">
173173
<div class="story-output-placeholder">
174174
<p>Set parameters to generate story</p>
175-
<p>or</p>
176-
<button class="generate-randomly-button">
177-
Generate randomly <img src="./img/double-arrow.svg" alt="double arrow icon">
178-
</button>
179175
</div>
180176
<div id="story-response-area" style="display: none;">
181177
<div id="loading-spinner" class="spinner" style="display: none;"></div>

examples/bedtime-story-teller/assets/style.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,6 @@ body {
666666
*/
667667

668668
@media (max-width: 768px) {
669-
body {
670-
padding: 12px 16px;
671-
}
672-
673669
.container {
674670
max-width: none;
675671
width: 100%;

0 commit comments

Comments
 (0)