Spaces:
Running
Running
Show inference loading state
Browse files- index.html +20 -1
index.html
CHANGED
|
@@ -25,6 +25,19 @@
|
|
| 25 |
button:disabled { opacity: 0.5; cursor: wait; }
|
| 26 |
textarea:focus, input:focus, button:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
|
| 27 |
#status { min-height: 34px; margin: 0; padding: 0 16px 12px; color: #6b7280; font-size: 12px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
@media (max-width: 600px) {
|
| 29 |
form { grid-template-columns: 1fr; }
|
| 30 |
.controls { flex-direction: row; align-items: end; justify-content: space-between; }
|
|
@@ -87,7 +100,11 @@
|
|
| 87 |
addMessage("user", text);
|
| 88 |
prompt.value = "";
|
| 89 |
send.disabled = true;
|
| 90 |
-
status.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
const output = addMessage("assistant", "");
|
| 92 |
|
| 93 |
try {
|
|
@@ -122,6 +139,8 @@
|
|
| 122 |
output.textContent = `Request failed: ${error.message}`;
|
| 123 |
status.textContent = "The inference service did not complete the request.";
|
| 124 |
} finally {
|
|
|
|
|
|
|
| 125 |
send.disabled = false;
|
| 126 |
prompt.focus();
|
| 127 |
}
|
|
|
|
| 25 |
button:disabled { opacity: 0.5; cursor: wait; }
|
| 26 |
textarea:focus, input:focus, button:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
|
| 27 |
#status { min-height: 34px; margin: 0; padding: 0 16px 12px; color: #6b7280; font-size: 12px; }
|
| 28 |
+
#status.loading::before {
|
| 29 |
+
content: "";
|
| 30 |
+
display: inline-block;
|
| 31 |
+
width: 12px;
|
| 32 |
+
height: 12px;
|
| 33 |
+
margin-right: 8px;
|
| 34 |
+
vertical-align: -2px;
|
| 35 |
+
border: 2px solid #d1d5db;
|
| 36 |
+
border-top-color: #4f46e5;
|
| 37 |
+
border-radius: 50%;
|
| 38 |
+
animation: spin 0.8s linear infinite;
|
| 39 |
+
}
|
| 40 |
+
@keyframes spin { to { transform: rotate(360deg); } }
|
| 41 |
@media (max-width: 600px) {
|
| 42 |
form { grid-template-columns: 1fr; }
|
| 43 |
.controls { flex-direction: row; align-items: end; justify-content: space-between; }
|
|
|
|
| 100 |
addMessage("user", text);
|
| 101 |
prompt.value = "";
|
| 102 |
send.disabled = true;
|
| 103 |
+
status.classList.add("loading");
|
| 104 |
+
status.textContent = "Starting model. Cold starts can take a few minutes...";
|
| 105 |
+
const slowNotice = setTimeout(() => {
|
| 106 |
+
status.textContent = "Still waiting for the inference worker to become ready...";
|
| 107 |
+
}, 45_000);
|
| 108 |
const output = addMessage("assistant", "");
|
| 109 |
|
| 110 |
try {
|
|
|
|
| 139 |
output.textContent = `Request failed: ${error.message}`;
|
| 140 |
status.textContent = "The inference service did not complete the request.";
|
| 141 |
} finally {
|
| 142 |
+
clearTimeout(slowNotice);
|
| 143 |
+
status.classList.remove("loading");
|
| 144 |
send.disabled = false;
|
| 145 |
prompt.focus();
|
| 146 |
}
|