AthleticGPT
body {
font-family: sans-serif;
background-color: #fff5f5;
padding: 20px;
max-width: 600px;
margin: auto;
border: 2px solid #ba0c2f;
border-radius: 16px;
}
#chat-box {
height: 300px;
overflow-y: auto;
padding: 10px;
background: #ffffff;
border: 1px solid #ddd;
margin-bottom: 10px;
border-radius: 8px;
}
#user-input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 8px;
}
button {
margin-top: 10px;
width: 100%;
padding: 10px;
background: #ba0c2f;
color: white;
border: none;
border-radius: 8px;
font-weight: bold;
}
🤖 AthleticGPT
“Un bot con más garra que Dani en los 80”
Enviar
const apiKey = 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; // Reemplaza con tu API Key real
const chatBox = document.getElementById(«chat-box»);
function appendMessage(sender, text) {
const div = document.createElement(«div»);
div.innerHTML = `${sender}: ${text}`;
div.style.marginBottom = «10px»;
chatBox.appendChild(div);
chatBox.scrollTop = chatBox.scrollHeight;
}
async function sendToGPT() {
const input = document.getElementById(«user-input»);
const question = input.value;
if (!question) return;
appendMessage(«Tú», question);
input.value = «Pensando como Valverde…»;
input.disabled = true;
const messages = [
{
role: «system»,
content: `Eres AthleticGPT, un asistente con alma rojiblanca. Te comportas como un fan del Athletic Club de toda la vida. Sabes historia, jugadores, estilo de juego, y hablas con orgullo, humor bilbaíno y emoción. Sueltas frases como «¡Aupa Athletic!», «¡Txapeldunak!», y das respuestas con personalidad zurigorri. Respondes siempre como un aficionado que ama al club.`
},
{
role: «user»,
content: question
}
];
try {
const res = await fetch(«https://api.openai.com/v1/chat/completions», {
method: «POST»,
headers: {
«Authorization»: `Bearer ${apiKey}`,
«Content-Type»: «application/json»
},
body: JSON.stringify({
model: «gpt-3.5-turbo»,
messages: messages
})
});
const data = await res.json();
const reply = data.choices[0].message.content;
appendMessage(«AthleticGPT», reply);
} catch (err) {
appendMessage(«AthleticGPT», «⚠️ Error al conectar con Lezama. Inténtalo más tarde.»);
}
input.disabled = false;
input.value = «»;
}
