Spaces:
Build error
Build error
T-K-O-H commited on
Commit ·
ce330ae
1
Parent(s): 1df6b88
Update HTML to reflect stock market focus
Browse files- index.html +42 -38
index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>
|
| 8 |
<style>
|
| 9 |
body {
|
| 10 |
font-family: Arial, sans-serif;
|
|
@@ -17,8 +17,10 @@
|
|
| 17 |
background-color: white;
|
| 18 |
border-radius: 10px;
|
| 19 |
padding: 20px;
|
|
|
|
|
|
|
|
|
|
| 20 |
margin-bottom: 20px;
|
| 21 |
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 22 |
}
|
| 23 |
.message {
|
| 24 |
margin-bottom: 10px;
|
|
@@ -27,11 +29,11 @@
|
|
| 27 |
}
|
| 28 |
.user-message {
|
| 29 |
background-color: #e3f2fd;
|
| 30 |
-
margin-left:
|
| 31 |
}
|
| 32 |
.ai-message {
|
| 33 |
-
background-color: #
|
| 34 |
-
margin-right:
|
| 35 |
}
|
| 36 |
.input-container {
|
| 37 |
display: flex;
|
|
@@ -54,79 +56,81 @@
|
|
| 54 |
button:hover {
|
| 55 |
background-color: #1976d2;
|
| 56 |
}
|
| 57 |
-
.
|
| 58 |
background-color: #e8f5e9;
|
| 59 |
padding: 15px;
|
| 60 |
border-radius: 5px;
|
| 61 |
margin-bottom: 20px;
|
| 62 |
}
|
| 63 |
-
.
|
| 64 |
margin-top: 0;
|
| 65 |
color: #2e7d32;
|
| 66 |
}
|
| 67 |
-
.
|
| 68 |
padding-left: 20px;
|
| 69 |
}
|
| 70 |
-
.
|
| 71 |
-
margin-bottom:
|
| 72 |
}
|
| 73 |
</style>
|
| 74 |
</head>
|
| 75 |
<body>
|
| 76 |
-
<h1>
|
| 77 |
|
| 78 |
-
<div class="
|
| 79 |
<h3>Available Tools:</h3>
|
| 80 |
<ul>
|
| 81 |
-
<li><strong>
|
| 82 |
-
<li><strong>
|
| 83 |
-
<li><strong>
|
| 84 |
</ul>
|
| 85 |
</div>
|
| 86 |
|
| 87 |
-
<div class="chat-container" id="
|
| 88 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
</div>
|
| 90 |
|
| 91 |
<div class="input-container">
|
| 92 |
-
<input type="text" id="
|
| 93 |
<button onclick="sendMessage()">Send</button>
|
| 94 |
</div>
|
| 95 |
|
| 96 |
<script>
|
| 97 |
-
const ws = new WebSocket(
|
| 98 |
-
const chatContainer = document.getElementById('
|
| 99 |
-
const userInput = document.getElementById('
|
| 100 |
-
|
| 101 |
-
// Add welcome message
|
| 102 |
-
addMessage('Welcome! I can help you with weather information, calculations, and image generation. What would you like to do?', 'ai');
|
| 103 |
|
| 104 |
ws.onmessage = function(event) {
|
| 105 |
const data = JSON.parse(event.data);
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
};
|
| 112 |
|
| 113 |
function sendMessage() {
|
| 114 |
const message = userInput.value.trim();
|
| 115 |
if (message) {
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
ws.send(message);
|
| 118 |
userInput.value = '';
|
| 119 |
}
|
| 120 |
}
|
| 121 |
|
| 122 |
-
function addMessage(text, sender) {
|
| 123 |
-
const messageDiv = document.createElement('div');
|
| 124 |
-
messageDiv.className = `message ${sender}-message`;
|
| 125 |
-
messageDiv.textContent = text;
|
| 126 |
-
chatContainer.appendChild(messageDiv);
|
| 127 |
-
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
userInput.addEventListener('keypress', function(e) {
|
| 131 |
if (e.key === 'Enter') {
|
| 132 |
sendMessage();
|
|
|
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Stock Market Assistant</title>
|
| 8 |
<style>
|
| 9 |
body {
|
| 10 |
font-family: Arial, sans-serif;
|
|
|
|
| 17 |
background-color: white;
|
| 18 |
border-radius: 10px;
|
| 19 |
padding: 20px;
|
| 20 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 21 |
+
height: 500px;
|
| 22 |
+
overflow-y: auto;
|
| 23 |
margin-bottom: 20px;
|
|
|
|
| 24 |
}
|
| 25 |
.message {
|
| 26 |
margin-bottom: 10px;
|
|
|
|
| 29 |
}
|
| 30 |
.user-message {
|
| 31 |
background-color: #e3f2fd;
|
| 32 |
+
margin-left: 60%;
|
| 33 |
}
|
| 34 |
.ai-message {
|
| 35 |
+
background-color: #f1f1f1;
|
| 36 |
+
margin-right: 60%;
|
| 37 |
}
|
| 38 |
.input-container {
|
| 39 |
display: flex;
|
|
|
|
| 56 |
button:hover {
|
| 57 |
background-color: #1976d2;
|
| 58 |
}
|
| 59 |
+
.tools-info {
|
| 60 |
background-color: #e8f5e9;
|
| 61 |
padding: 15px;
|
| 62 |
border-radius: 5px;
|
| 63 |
margin-bottom: 20px;
|
| 64 |
}
|
| 65 |
+
.tools-info h3 {
|
| 66 |
margin-top: 0;
|
| 67 |
color: #2e7d32;
|
| 68 |
}
|
| 69 |
+
.tools-info ul {
|
| 70 |
padding-left: 20px;
|
| 71 |
}
|
| 72 |
+
.tools-info li {
|
| 73 |
+
margin-bottom: 8px;
|
| 74 |
}
|
| 75 |
</style>
|
| 76 |
</head>
|
| 77 |
<body>
|
| 78 |
+
<h1>Stock Market Assistant</h1>
|
| 79 |
|
| 80 |
+
<div class="tools-info">
|
| 81 |
<h3>Available Tools:</h3>
|
| 82 |
<ul>
|
| 83 |
+
<li><strong>Stock Price:</strong> Get current price for any stock symbol (e.g., "What's the price of AAPL?")</li>
|
| 84 |
+
<li><strong>Stock Info:</strong> Get detailed information about a company (e.g., "Tell me about Microsoft")</li>
|
| 85 |
+
<li><strong>Stock History:</strong> Get historical data for a stock (e.g., "Show me Tesla's performance last month")</li>
|
| 86 |
</ul>
|
| 87 |
</div>
|
| 88 |
|
| 89 |
+
<div class="chat-container" id="chatContainer">
|
| 90 |
+
<div class="message ai-message">
|
| 91 |
+
Hello! I'm your Stock Market Assistant. I can help you with:
|
| 92 |
+
<ul>
|
| 93 |
+
<li>Current stock prices</li>
|
| 94 |
+
<li>Company information</li>
|
| 95 |
+
<li>Historical stock data</li>
|
| 96 |
+
</ul>
|
| 97 |
+
How can I help you today?
|
| 98 |
+
</div>
|
| 99 |
</div>
|
| 100 |
|
| 101 |
<div class="input-container">
|
| 102 |
+
<input type="text" id="userInput" placeholder="Ask about any stock...">
|
| 103 |
<button onclick="sendMessage()">Send</button>
|
| 104 |
</div>
|
| 105 |
|
| 106 |
<script>
|
| 107 |
+
const ws = new WebSocket('ws://' + window.location.host + '/ws');
|
| 108 |
+
const chatContainer = document.getElementById('chatContainer');
|
| 109 |
+
const userInput = document.getElementById('userInput');
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
ws.onmessage = function(event) {
|
| 112 |
const data = JSON.parse(event.data);
|
| 113 |
+
const messageDiv = document.createElement('div');
|
| 114 |
+
messageDiv.className = 'message ' + (data.type === 'ai_message' ? 'ai-message' : 'error-message');
|
| 115 |
+
messageDiv.textContent = data.content;
|
| 116 |
+
chatContainer.appendChild(messageDiv);
|
| 117 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 118 |
};
|
| 119 |
|
| 120 |
function sendMessage() {
|
| 121 |
const message = userInput.value.trim();
|
| 122 |
if (message) {
|
| 123 |
+
const messageDiv = document.createElement('div');
|
| 124 |
+
messageDiv.className = 'message user-message';
|
| 125 |
+
messageDiv.textContent = message;
|
| 126 |
+
chatContainer.appendChild(messageDiv);
|
| 127 |
+
chatContainer.scrollTop = chatContainer.scrollHeight;
|
| 128 |
+
|
| 129 |
ws.send(message);
|
| 130 |
userInput.value = '';
|
| 131 |
}
|
| 132 |
}
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
userInput.addEventListener('keypress', function(e) {
|
| 135 |
if (e.key === 'Enter') {
|
| 136 |
sendMessage();
|