Delete templates/index.html
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>WendyGPT - Music Industry Advisor</title> <style> body { font-family: 'Arial', sans-serif; line-height: 1.6; color: #333; max-width: 800px; margin: 0 auto; padding: 20px; background-color: #f9f9f9; } header { text-align: center; margin-bottom: 30px; } h1 { color: #D01F3C; margin-bottom: 10px; } .chat-container { background-color: white; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 20px; } #chat-messages { height: 400px; overflow-y: auto; margin-bottom: 20px; padding: 10px; border: 1px solid #eee; border-radius: 5px; } .message { margin-bottom: 15px; padding: 10px 15px; border-radius: 20px; max-width: 80%; } .user-message { background-color: #E1F5FE; margin-left: auto; border-bottom-right-radius: 5px; text-align: right; } .wendy-message { background-color: #FFF3E0; margin-right: auto; border-bottom-left-radius: 5px; } .input-area { display: flex; } #user-input { flex-grow: 1; padding: 10px; border: 1px solid #ddd; border-radius: 5px 0 0 5px; font-size: 16px; } #send-button { padding: 10px 20px; background-color: #D01F3C; color: white; border: none; border-radius: 0 5px 5px 0; cursor: pointer; font-size: 16px; } #send-button:hover { background-color: #B01833; } footer { text-align: center; margin-top: 30px; font-size: 14px; color: #666; } .loading { text-align: center; color: #666; font-style: italic; } </style></head><body> <header> <h1>WendyGPT</h1> <p>Ask me anything about the music industry, artist development, and building your career.</p> </header>
<div class="chat-container"> <div id="chat-messages"> <div class="message wendy-message"> Hey, I'm WendyGPT. What music industry questions can I help you with today? </div> </div> <div class="input-area"> <input type="text" id="user-input" placeholder="Type your question here..."> <button id="send-button">Send</button> </div> </div>
<footer> Powered by the wisdom of Wendy Day, music industry veteran and artist advocate </footer>
<script> const chatMessages = document.getElementById('chat-messages'); const userInput = document.getElementById('user-input'); const sendButton = document.getElementById('send-button');
// Function to add a message to the chat function addMessage(text, isUser) { const messageDiv = document.createElement('div'); messageDiv.classList.add('message'); messageDiv.classList.add(isUser ? 'user-message' : 'wendy-message'); messageDiv.textContent = text; chatMessages.appendChild(messageDiv); chatMessages.scrollTop = chatMessages.scrollHeight; }
// Function to handle sending a message async function sendMessage() { const message = userInput.value.trim(); if (message === '') return;
// Add user message to chat addMessage(message, true); userInput.value = '';
// Add loading indicator const loadingDiv = document.createElement('div'); loadingDiv.classList.add('message', 'wendy-message', 'loading'); loadingDiv.textContent = 'Typing...'; chatMessages.appendChild(loadingDiv); chatMessages.scrollTop = chatMessages.scrollHeight;
try { // Send message to backend const response = await fetch('/ask', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ prompt: message }), });
const data = await response.json(); // Remove loading indicator chatMessages.removeChild(loadingDiv); // Add Wendy's response addMessage(data.response, false); } catch (error) { // Remove loading indicator chatMessages.removeChild(loadingDiv); // Add error message addMessage('Sorry, something went wrong. Please try again.', false); console.error('Error:', error); } }
// Event listeners sendButton.addEventListener('click', sendMessage); userInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { sendMessage(); } }); </script></body></html>templates/index.htmlDeleted-181