Spaces:
Runtime error
Runtime error
Ajey95
commited on
Commit
·
84e82eb
1
Parent(s):
da17f18
Fix: tools addition
Browse files- templates/index.html +26 -3
templates/index.html
CHANGED
|
@@ -608,6 +608,7 @@
|
|
| 608 |
<title>MyPharma AI - Your Study Companion</title>
|
| 609 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 610 |
<style>
|
|
|
|
| 611 |
:root {
|
| 612 |
--saffron: #FF9933; --maroon: #800000; --gold: #FFD700;
|
| 613 |
--peacock-blue: #005F9E; --cream: #FFF8E7; --light-saffron: #FFE4B5;
|
|
@@ -631,6 +632,10 @@
|
|
| 631 |
}
|
| 632 |
.header h1 { font-size: 2em; margin-bottom: 5px; }
|
| 633 |
.header .subtitle { font-size: 1.1em; opacity: 0.9; }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
.chat-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
|
| 635 |
.chat-messages { flex: 1; padding: 20px; overflow-y: auto; }
|
| 636 |
.message { margin-bottom: 20px; display: flex; max-width: 85%; animation: fadeIn 0.3s ease-in; }
|
|
@@ -679,7 +684,11 @@
|
|
| 679 |
<div class="container">
|
| 680 |
<div class="header">
|
| 681 |
<h1>🇮🇳 MyPharma AI</h1>
|
| 682 |
-
<div class="subtitle">{{ greeting }}</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
</div>
|
| 684 |
|
| 685 |
<div class="chat-container">
|
|
@@ -700,7 +709,10 @@
|
|
| 700 |
</div>
|
| 701 |
|
| 702 |
<div class="input-container">
|
| 703 |
-
<input type="text"
|
|
|
|
|
|
|
|
|
|
| 704 |
<button id="sendBtn" onclick="sendMessage()">Send 📨</button>
|
| 705 |
</div>
|
| 706 |
</div>
|
|
@@ -742,7 +754,7 @@
|
|
| 742 |
const messagesContainer = document.getElementById('chatMessages');
|
| 743 |
const messageDiv = document.createElement('div');
|
| 744 |
messageDiv.className = `message ${sender}`;
|
| 745 |
-
const agentIcons = { 'academic': '📚 Academic Agent', 'drug_info': '💊 Drug Info Agent', 'quiz_generation': '❓ Quiz Master' };
|
| 746 |
const agentBadge = sender === 'bot' ? `<div class="agent-badge">${agentIcons[agentType] || '🤖 AI Assistant'}</div>` : '';
|
| 747 |
const formattedText = marked.parse(text || 'Sorry, I received an empty response.');
|
| 748 |
messageDiv.innerHTML = `<div class="message-bubble">${agentBadge}${formattedText}</div>`;
|
|
@@ -779,8 +791,19 @@
|
|
| 779 |
input.focus();
|
| 780 |
}
|
| 781 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 782 |
document.addEventListener('DOMContentLoaded', () => {
|
| 783 |
document.getElementById('messageInput').focus();
|
|
|
|
| 784 |
});
|
| 785 |
</script>
|
| 786 |
</body>
|
|
|
|
| 608 |
<title>MyPharma AI - Your Study Companion</title>
|
| 609 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 610 |
<style>
|
| 611 |
+
/* Indian Traditional Theme CSS */
|
| 612 |
:root {
|
| 613 |
--saffron: #FF9933; --maroon: #800000; --gold: #FFD700;
|
| 614 |
--peacock-blue: #005F9E; --cream: #FFF8E7; --light-saffron: #FFE4B5;
|
|
|
|
| 632 |
}
|
| 633 |
.header h1 { font-size: 2em; margin-bottom: 5px; }
|
| 634 |
.header .subtitle { font-size: 1.1em; opacity: 0.9; }
|
| 635 |
+
.quote-container {
|
| 636 |
+
background: var(--gold); color: var(--maroon); padding: 15px;
|
| 637 |
+
border-radius: 10px; margin: 20px; text-align: center; font-style: italic;
|
| 638 |
+
}
|
| 639 |
.chat-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
|
| 640 |
.chat-messages { flex: 1; padding: 20px; overflow-y: auto; }
|
| 641 |
.message { margin-bottom: 20px; display: flex; max-width: 85%; animation: fadeIn 0.3s ease-in; }
|
|
|
|
| 684 |
<div class="container">
|
| 685 |
<div class="header">
|
| 686 |
<h1>🇮🇳 MyPharma AI</h1>
|
| 687 |
+
<div class="subtitle">{{ greeting or "नमस्ते! Your Intelligent Pharmacy Study Companion" }}</div>
|
| 688 |
+
</div>
|
| 689 |
+
|
| 690 |
+
<div class="quote-container" id="quoteContainer">
|
| 691 |
+
📿 {{ daily_quote or "विद्या धनं सर्व धन प्रधानम् - Knowledge is the supreme wealth" }}
|
| 692 |
</div>
|
| 693 |
|
| 694 |
<div class="chat-container">
|
|
|
|
| 709 |
</div>
|
| 710 |
|
| 711 |
<div class="input-container">
|
| 712 |
+
<input type="text"
|
| 713 |
+
id="messageInput"
|
| 714 |
+
placeholder="Ask about your documents..."
|
| 715 |
+
onkeypress="handleKeyPress(event)">
|
| 716 |
<button id="sendBtn" onclick="sendMessage()">Send 📨</button>
|
| 717 |
</div>
|
| 718 |
</div>
|
|
|
|
| 754 |
const messagesContainer = document.getElementById('chatMessages');
|
| 755 |
const messageDiv = document.createElement('div');
|
| 756 |
messageDiv.className = `message ${sender}`;
|
| 757 |
+
const agentIcons = { 'academic': '📚 Academic Agent', 'drug_info': '💊 Drug Info Agent', 'quiz_generation': '❓ Quiz Master', 'mnemonic_creation': '🧠 Memory Master', 'viva_practice': '🗣️ Viva Coach', 'error': '⚠️ System' };
|
| 758 |
const agentBadge = sender === 'bot' ? `<div class="agent-badge">${agentIcons[agentType] || '🤖 AI Assistant'}</div>` : '';
|
| 759 |
const formattedText = marked.parse(text || 'Sorry, I received an empty response.');
|
| 760 |
messageDiv.innerHTML = `<div class="message-bubble">${agentBadge}${formattedText}</div>`;
|
|
|
|
| 791 |
input.focus();
|
| 792 |
}
|
| 793 |
|
| 794 |
+
async function getNewQuote() {
|
| 795 |
+
try {
|
| 796 |
+
const response = await fetch('/quote');
|
| 797 |
+
const data = await response.json();
|
| 798 |
+
document.getElementById('quoteContainer').innerHTML = `📿 ${data.quote}`;
|
| 799 |
+
} catch (error) {
|
| 800 |
+
console.error('Failed to fetch new quote:', error);
|
| 801 |
+
}
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
document.addEventListener('DOMContentLoaded', () => {
|
| 805 |
document.getElementById('messageInput').focus();
|
| 806 |
+
setInterval(getNewQuote, 5 * 60 * 1000); // Update quote every 5 mins
|
| 807 |
});
|
| 808 |
</script>
|
| 809 |
</body>
|