Upload 29 files
Browse files
app.py
CHANGED
|
@@ -246,27 +246,36 @@ def build_ui() -> gr.Blocks:
|
|
| 246 |
user_in.submit(main_chat, inputs=chat_inputs, outputs=chat_outputs)
|
| 247 |
|
| 248 |
# --- Helper JS to hide welcome message on first interaction ---
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
|
|
|
| 259 |
}
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
}
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
# Verify Ollama status on load
|
| 272 |
demo.load(verify, outputs=[], every=60)
|
|
@@ -287,4 +296,4 @@ if __name__ == "__main__":
|
|
| 287 |
server_name="0.0.0.0",
|
| 288 |
server_port=7860,
|
| 289 |
share=False
|
| 290 |
-
)
|
|
|
|
| 246 |
user_in.submit(main_chat, inputs=chat_inputs, outputs=chat_outputs)
|
| 247 |
|
| 248 |
# --- Helper JS to hide welcome message on first interaction ---
|
| 249 |
+
gr.HTML(
|
| 250 |
+
"""
|
| 251 |
+
<script>
|
| 252 |
+
(function attachWelcomeListeners() {
|
| 253 |
+
const inputContainer = document.querySelector('#prompt-input textarea');
|
| 254 |
+
const welcomeCard = document.getElementById('welcome-card');
|
| 255 |
+
const chatCanvas = document.getElementById('chat-canvas');
|
| 256 |
+
|
| 257 |
+
if (!inputContainer || !welcomeCard || !chatCanvas) {
|
| 258 |
+
requestAnimationFrame(attachWelcomeListeners);
|
| 259 |
+
return;
|
| 260 |
}
|
| 261 |
+
|
| 262 |
+
function handleFirstInteraction() {
|
| 263 |
+
if (welcomeCard.style.display !== 'none') {
|
| 264 |
+
welcomeCard.style.display = 'none';
|
| 265 |
+
chatCanvas.style.display = 'flex';
|
| 266 |
+
}
|
| 267 |
}
|
| 268 |
+
|
| 269 |
+
inputContainer.addEventListener('focus', handleFirstInteraction, { once: true });
|
| 270 |
+
inputContainer.addEventListener('input', (event) => {
|
| 271 |
+
if (event.target.value.length > 0) {
|
| 272 |
+
handleFirstInteraction();
|
| 273 |
+
}
|
| 274 |
+
});
|
| 275 |
+
})();
|
| 276 |
+
</script>
|
| 277 |
+
"""
|
| 278 |
+
)
|
| 279 |
|
| 280 |
# Verify Ollama status on load
|
| 281 |
demo.load(verify, outputs=[], every=60)
|
|
|
|
| 296 |
server_name="0.0.0.0",
|
| 297 |
server_port=7860,
|
| 298 |
share=False
|
| 299 |
+
)
|