Spaces:
Sleeping
Sleeping
tutorial added
Browse files- package-lock.json +1 -2
- src/App.css +105 -6
- src/App.js +44 -8
package-lock.json
CHANGED
|
@@ -11,8 +11,7 @@
|
|
| 11 |
"react": "^18.0.0",
|
| 12 |
"react-dom": "^18.0.0",
|
| 13 |
"react-scripts": "^5.0.1"
|
| 14 |
-
}
|
| 15 |
-
"devDependencies": {}
|
| 16 |
},
|
| 17 |
"node_modules/@alloc/quick-lru": {
|
| 18 |
"version": "5.2.0",
|
|
|
|
| 11 |
"react": "^18.0.0",
|
| 12 |
"react-dom": "^18.0.0",
|
| 13 |
"react-scripts": "^5.0.1"
|
| 14 |
+
}
|
|
|
|
| 15 |
},
|
| 16 |
"node_modules/@alloc/quick-lru": {
|
| 17 |
"version": "5.2.0",
|
src/App.css
CHANGED
|
@@ -340,15 +340,14 @@ button:not(.active) {
|
|
| 340 |
}
|
| 341 |
|
| 342 |
.modal {
|
| 343 |
-
background:
|
| 344 |
-
|
| 345 |
-
|
|
|
|
| 346 |
width: 90%;
|
| 347 |
font-family: var(--font-main);
|
| 348 |
color: var(--light);
|
| 349 |
-
|
| 350 |
-
overflow: hidden;
|
| 351 |
-
text-align: center;
|
| 352 |
animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
|
| 353 |
}
|
| 354 |
|
|
@@ -1018,3 +1017,103 @@ button:not(.active) {
|
|
| 1018 |
}
|
| 1019 |
|
| 1020 |
/* ...existing styles... */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
}
|
| 341 |
|
| 342 |
.modal {
|
| 343 |
+
background: var(--dark);
|
| 344 |
+
border-radius: var(--border-radius-lg);
|
| 345 |
+
padding: 30px;
|
| 346 |
+
max-width: 700px;
|
| 347 |
width: 90%;
|
| 348 |
font-family: var(--font-main);
|
| 349 |
color: var(--light);
|
| 350 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
|
|
|
|
|
| 351 |
animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
|
| 352 |
}
|
| 353 |
|
|
|
|
| 1017 |
}
|
| 1018 |
|
| 1019 |
/* ...existing styles... */
|
| 1020 |
+
|
| 1021 |
+
/* Updated Welcome Modal Example Styles */
|
| 1022 |
+
.modal-examples {
|
| 1023 |
+
margin-top: 25px;
|
| 1024 |
+
text-align: left;
|
| 1025 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 1026 |
+
border-radius: var(--border-radius);
|
| 1027 |
+
padding: 20px;
|
| 1028 |
+
background-color: rgba(64, 65, 79, 0.3);
|
| 1029 |
+
color: var(--light);
|
| 1030 |
+
backdrop-filter: blur(8px);
|
| 1031 |
+
}
|
| 1032 |
+
|
| 1033 |
+
.modal-examples h3 {
|
| 1034 |
+
margin-top: 0;
|
| 1035 |
+
margin-bottom: 20px;
|
| 1036 |
+
text-align: center;
|
| 1037 |
+
color: var(--light);
|
| 1038 |
+
font-size: 18px;
|
| 1039 |
+
font-weight: 500;
|
| 1040 |
+
}
|
| 1041 |
+
|
| 1042 |
+
.button-example-container {
|
| 1043 |
+
display: flex;
|
| 1044 |
+
align-items: center;
|
| 1045 |
+
margin-bottom: 12px;
|
| 1046 |
+
}
|
| 1047 |
+
|
| 1048 |
+
.button-example-container span {
|
| 1049 |
+
margin-left: 12px;
|
| 1050 |
+
font-size: 14px;
|
| 1051 |
+
color: rgba(255, 255, 255, 0.7);
|
| 1052 |
+
}
|
| 1053 |
+
|
| 1054 |
+
.example-textarea {
|
| 1055 |
+
width: 100%;
|
| 1056 |
+
min-height: 40px;
|
| 1057 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 1058 |
+
border-radius: var(--border-radius);
|
| 1059 |
+
padding: 10px 12px;
|
| 1060 |
+
background-color: rgba(64, 65, 79, 0.3);
|
| 1061 |
+
font-size: 14px;
|
| 1062 |
+
color: var(--light);
|
| 1063 |
+
display: flex;
|
| 1064 |
+
align-items: center;
|
| 1065 |
+
}
|
| 1066 |
+
|
| 1067 |
+
.modal-input-example, .modal-buttons-example, .modal-send-example {
|
| 1068 |
+
margin-bottom: 18px;
|
| 1069 |
+
}
|
| 1070 |
+
|
| 1071 |
+
.button-example-container button.example,
|
| 1072 |
+
.modal-send-example button.example {
|
| 1073 |
+
pointer-events: none;
|
| 1074 |
+
transform: none;
|
| 1075 |
+
opacity: 1;
|
| 1076 |
+
}
|
| 1077 |
+
|
| 1078 |
+
.button-example-container .standard-button.example {
|
| 1079 |
+
background: rgba(64, 65, 79, 0.9);
|
| 1080 |
+
color: var(--light);
|
| 1081 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 1082 |
+
max-width: 90px;
|
| 1083 |
+
height: 36px;
|
| 1084 |
+
}
|
| 1085 |
+
|
| 1086 |
+
.button-example-container .reasoning-button.example {
|
| 1087 |
+
background: transparent;
|
| 1088 |
+
}
|
| 1089 |
+
|
| 1090 |
+
.button-example-container .search-button.example {
|
| 1091 |
+
background: transparent;
|
| 1092 |
+
}
|
| 1093 |
+
|
| 1094 |
+
.modal-send-example .answer-button.example {
|
| 1095 |
+
background: var(--primary);
|
| 1096 |
+
color: white;
|
| 1097 |
+
position: static;
|
| 1098 |
+
transform: none;
|
| 1099 |
+
display: inline-flex;
|
| 1100 |
+
margin: 0;
|
| 1101 |
+
}
|
| 1102 |
+
|
| 1103 |
+
.start-button {
|
| 1104 |
+
margin-top: 25px;
|
| 1105 |
+
background: var(--primary);
|
| 1106 |
+
color: white;
|
| 1107 |
+
padding: 12px 24px;
|
| 1108 |
+
font-size: 16px;
|
| 1109 |
+
}
|
| 1110 |
+
|
| 1111 |
+
/* Make the modal match the app's style */
|
| 1112 |
+
.modal {
|
| 1113 |
+
background: var(--dark);
|
| 1114 |
+
border-radius: var(--border-radius-lg);
|
| 1115 |
+
padding: 30px;
|
| 1116 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 1117 |
+
}
|
| 1118 |
+
|
| 1119 |
+
/* ...existing code... */
|
src/App.js
CHANGED
|
@@ -148,15 +148,51 @@ export default function ChatDisplay() {
|
|
| 148 |
function WelcomeModal() {
|
| 149 |
return (
|
| 150 |
showModal && (
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
</div>
|
| 159 |
</div>
|
|
|
|
| 160 |
)
|
| 161 |
);
|
| 162 |
}
|
|
@@ -224,7 +260,7 @@ export default function ChatDisplay() {
|
|
| 224 |
const getInputClassName = () => {
|
| 225 |
const classes = ['chat-input'];
|
| 226 |
|
| 227 |
-
// Only apply new-prompt class if
|
| 228 |
if (initialLoadComplete.current && isNewPrompt) {
|
| 229 |
classes.push('new-prompt');
|
| 230 |
}
|
|
|
|
| 148 |
function WelcomeModal() {
|
| 149 |
return (
|
| 150 |
showModal && (
|
| 151 |
+
<div className="modal-overlay">
|
| 152 |
+
<div className="modal">
|
| 153 |
+
<h2 style={{ textAlign: 'center' }}>🌳 Welcome to AI Energy Efficiency Trainer 🌿</h2>
|
| 154 |
+
<p className="modal-subtitle">Learn to choose the right AI model to save energy and improve responses</p>
|
| 155 |
+
|
| 156 |
+
<div className="modal-instruction-block">
|
| 157 |
+
<div className="instruction-header"></div>
|
| 158 |
+
<div className="instruction-content">
|
| 159 |
+
<p className="instruction-title" style={{ fontWeight: 'bold', fontSize: '1.1em', marginBottom: '8px', marginTop: '16px' }}>️1. Review the prompt:</p>
|
| 160 |
+
<div className="input-example-container">
|
| 161 |
+
<div className="example-textarea">
|
| 162 |
+
"Calculate the compound interest on $5,000 invested for 3 years at 4.5% per annum."
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div className="modal-instruction-block">
|
| 169 |
+
<div className="instruction-content">
|
| 170 |
+
<p className="instruction-title" style={{ fontWeight: 'bold', fontSize: '1.1em', marginBottom: '8px', marginTop: '16px' }}>2. Select the appropriate model (if needed):</p>
|
| 171 |
+
<div className="button-example-container" style={{ display: 'flex', alignItems: 'center', marginBottom: '10px' }}>
|
| 172 |
+
<button className="standard-button reasoning-button example" style={{ minWidth: '80px' }}>Reason</button>
|
| 173 |
+
<span style={{ marginLeft: '10px', display: 'inline-block', verticalAlign: 'middle' }}>For calculations, step-by-step explanations, and complex reasoning</span>
|
| 174 |
+
</div>
|
| 175 |
+
<div className="button-example-container" style={{ display: 'flex', alignItems: 'center' }}>
|
| 176 |
+
<button className="standard-button search-button example" style={{ minWidth: '80px' }}>Search</button>
|
| 177 |
+
<span style={{ marginLeft: '10px', display: 'inline-block', verticalAlign: 'middle' }}>For factual answers, simple lookups, and direct responses</span>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
|
| 182 |
+
<div className="modal-instruction-block">
|
| 183 |
+
<div className="instruction-content">
|
| 184 |
+
<p className="instruction-title" style={{ fontWeight: 'bold', fontSize: '1.1em', marginBottom: '8px', marginTop: '16px' }}>3. Click Send to submit your answer!</p>
|
| 185 |
+
<div className="send-button-example">
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
<div className="modal-footer">
|
| 191 |
+
<p className="energy-note">⚡ Making the right choice helps reduce AI energy consumption</p>
|
| 192 |
+
<button onClick={() => setShowModal(false)} className="start-button" style={{ float: 'right' }}>Let's Begin</button>
|
| 193 |
</div>
|
| 194 |
</div>
|
| 195 |
+
</div>
|
| 196 |
)
|
| 197 |
);
|
| 198 |
}
|
|
|
|
| 260 |
const getInputClassName = () => {
|
| 261 |
const classes = ['chat-input'];
|
| 262 |
|
| 263 |
+
// Only apply new-prompt class if initialLoadComplete is true
|
| 264 |
if (initialLoadComplete.current && isNewPrompt) {
|
| 265 |
classes.push('new-prompt');
|
| 266 |
}
|