<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GAIA + Physics Integration - Chat Interface</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
overflow: hidden;
background: #000;
}
.galaxy-bg {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
background: radial-gradient(ellipse at 20% 50%, rgba(138, 43, 226, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 80% 80%, rgba(65, 105, 225, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 40% 40%, rgba(255, 20, 147, 0.2) 0%, transparent 50%),
#000814;
overflow: hidden;
animation: galaxyShift 30s ease-in-out infinite;
}
@keyframes galaxyShift {
0%, 100% {
background: radial-gradient(ellipse at 20% 50%, rgba(138, 43, 226, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 80% 80%, rgba(65, 105, 225, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 40% 40%, rgba(255, 20, 147, 0.2) 0%, transparent 50%),
#000814;
}
25% {
background: radial-gradient(ellipse at 25% 55%, rgba(138, 43, 226, 0.4) 0%, transparent 50%),
radial-gradient(ellipse at 75% 75%, rgba(65, 105, 225, 0.35) 0%, transparent 50%),
radial-gradient(ellipse at 45% 35%, rgba(255, 20, 147, 0.25) 0%, transparent 50%),
#001030;
}
50% {
background: radial-gradient(ellipse at 30% 60%, rgba(138, 43, 226, 0.35) 0%, transparent 50%),
radial-gradient(ellipse at 70% 70%, rgba(65, 105, 225, 0.4) 0%, transparent 50%),
radial-gradient(ellipse at 50% 30%, rgba(255, 20, 147, 0.3) 0%, transparent 50%),
#000814;
}
75% {
background: radial-gradient(ellipse at 25% 45%, rgba(138, 43, 226, 0.4) 0%, transparent 50%),
radial-gradient(ellipse at 75% 85%, rgba(65, 105, 225, 0.3) 0%, transparent 50%),
radial-gradient(ellipse at 40% 40%, rgba(255, 20, 147, 0.25) 0%, transparent 50%),
#001030;
}
}
.stars {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}
.star {
position: absolute;
width: 1px;
height: 1px;
background: white;
border-radius: 50%;
box-shadow: 0 0 2px 1px rgba(255, 255, 255, 0.5);
animation: twinkle 3s infinite, flicker 0.5s infinite;
}
@keyframes twinkle {
0%, 100% { opacity: 0.2; }
25% { opacity: 0.5; }
50% { opacity: 1; }
75% { opacity: 0.4; }
}
@keyframes flicker {
0%, 100% { opacity: 1; }
10% { opacity: 0.7; }
20% { opacity: 1; }
30% { opacity: 0.8; }
40% { opacity: 1; }
90% { opacity: 0.9; }
}
@keyframes shimmer {
0%, 100% {
box-shadow: 0 0 2px 1px rgba(255, 255, 255, 0.5);
}
50% {
box-shadow: 0 0 10px 2px rgba(138, 43, 226, 0.6);
}
}
@keyframes float {
0%, 100% { transform: translateY(0px) rotate(0deg) scale(1); }
50% { transform: translateY(-30px) rotate(5deg) scale(1.1); }
}
@keyframes pulse-nebula {
0%, 100% { opacity: 0.3; filter: blur(80px); }
50% { opacity: 0.6; filter: blur(100px); }
}
@keyframes rotate-nebula {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes drift {
0%, 100% { transform: translateX(0) translateY(0); }
25% { transform: translateX(30px) translateY(-20px); }
50% { transform: translateX(0) translateY(-40px); }
75% { transform: translateX(-30px) translateY(-20px); }
}
.nebula {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.4;
animation: pulse-nebula 8s ease-in-out infinite;
}
.nebula-1 {
width: 300px;
height: 300px;
background: radial-gradient(circle, rgba(138, 43, 226, 0.5), transparent);
top: 10%;
left: 5%;
animation: float 20s ease-in-out infinite, drift 25s ease-in-out infinite, pulse-nebula 6s ease-in-out infinite;
box-shadow: 0 0 100px rgba(138, 43, 226, 0.4);
}
.nebula-2 {
width: 400px;
height: 400px;
background: radial-gradient(circle, rgba(65, 105, 225, 0.4), transparent);
top: 60%;
right: 10%;
animation: float 25s ease-in-out infinite reverse, drift 30s ease-in-out infinite reverse, pulse-nebula 7s ease-in-out infinite;
box-shadow: 0 0 120px rgba(65, 105, 225, 0.3);
}
.nebula-3 {
width: 250px;
height: 250px;
background: radial-gradient(circle, rgba(255, 20, 147, 0.3), transparent);
bottom: 15%;
left: 50%;
animation: float 30s ease-in-out infinite, drift 35s ease-in-out infinite, pulse-nebula 8s ease-in-out infinite;
box-shadow: 0 0 80px rgba(255, 20, 147, 0.25);
}
.container {
position: fixed;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px;
}
.chat-window {
width: 100%;
max-width: 900px;
height: 90vh;
max-height: 700px;
background: rgba(10, 10, 40, 0.85);
border: 2px solid rgba(138, 43, 226, 0.5);
border-radius: 15px;
display: flex;
flex-direction: column;
box-shadow: 0 0 30px rgba(138, 43, 226, 0.3),
0 0 60px rgba(65, 105, 225, 0.2),
inset 0 0 30px rgba(138, 43, 226, 0.1);
backdrop-filter: blur(10px);
overflow: hidden;
animation: glow 4s ease-in-out infinite, pulse-border 6s ease-in-out infinite;
}
@keyframes glow {
0%, 100% {
box-shadow: 0 0 30px rgba(138, 43, 226, 0.3),
0 0 60px rgba(65, 105, 225, 0.2),
inset 0 0 30px rgba(138, 43, 226, 0.1);
}
50% {
box-shadow: 0 0 50px rgba(138, 43, 226, 0.5),
0 0 100px rgba(65, 105, 225, 0.3),
inset 0 0 40px rgba(138, 43, 226, 0.15);
}
}
@keyframes pulse-border {
0%, 100% {
border-color: rgba(138, 43, 226, 0.5);
}
50% {
border-color: rgba(65, 105, 225, 0.8);
}
}
.chat-header {
background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(65, 105, 225, 0.2));
border-bottom: 1px solid rgba(138, 43, 226, 0.3);
padding: 20px;
text-align: center;
animation: header-glow 4s ease-in-out infinite;
}
@keyframes header-glow {
0%, 100% {
background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(65, 105, 225, 0.2));
}
50% {
background: linear-gradient(135deg, rgba(138, 43, 226, 0.35), rgba(65, 105, 225, 0.35));
}
}
.chat-header h1 {
color: #9d4edd;
font-size: 24px;
margin-bottom: 5px;
text-shadow: 0 0 10px rgba(138, 43, 226, 0.5),
0 0 20px rgba(138, 43, 226, 0.3);
animation: title-glow 3s ease-in-out infinite;
}
@keyframes title-glow {
0%, 100% {
text-shadow: 0 0 10px rgba(138, 43, 226, 0.5),
0 0 20px rgba(138, 43, 226, 0.3);
}
50% {
text-shadow: 0 0 20px rgba(138, 43, 226, 0.8),
0 0 40px rgba(138, 43, 226, 0.5);
}
}
.chat-header p {
color: #b5a7d6;
font-size: 12px;
letter-spacing: 2px;
animation: text-shimmer 4s ease-in-out infinite;
}
@keyframes text-shimmer {
0%, 100% {
color: #b5a7d6;
text-shadow: 0 0 5px rgba(138, 43, 226, 0.3);
}
50% {
color: #d0c9ff;
text-shadow: 0 0 10px rgba(138, 43, 226, 0.6);
}
}
.status {
display: inline-block;
width: 8px;
height: 8px;
background: #00ff41;
border-radius: 50%;
margin-right: 5px;
animation: pulse 1.5s ease-in-out infinite, glow-status 2s ease-in-out infinite;
box-shadow: 0 0 5px #00ff41;
}
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.5; transform: scale(0.7); }
}
@keyframes glow-status {
0%, 100% { box-shadow: 0 0 5px #00ff41; }
50% { box-shadow: 0 0 15px #00ff41, 0 0 25px rgba(0, 255, 65, 0.5); }
}
.messages {
flex: 1;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 15px;
}
.messages::-webkit-scrollbar {
width: 8px;
}
.messages::-webkit-scrollbar-track {
background: rgba(138, 43, 226, 0.1);
border-radius: 10px;
}
.messages::-webkit-scrollbar-thumb {
background: rgba(138, 43, 226, 0.5);
border-radius: 10px;
}
.message {
display: flex;
gap: 10px;
animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.message.user {
justify-content: flex-end;
}
.message.system {
justify-content: center;
}
.message-content {
max-width: 70%;
padding: 12px 16px;
border-radius: 10px;
word-wrap: break-word;
line-height: 1.4;
}
.message.user .message-content {
background: linear-gradient(135deg, rgba(138, 43, 226, 0.4), rgba(65, 105, 225, 0.3));
color: #e0d5ff;
border-left: 3px solid #9d4edd;
}
.message.bot .message-content {
background: rgba(65, 105, 225, 0.2);
color: #b5a7d6;
border-left: 3px solid #4169e1;
}
.message.system .message-content {
background: rgba(0, 255, 65, 0.1);
color: #00ff41;
border: 1px solid rgba(0, 255, 65, 0.3);
font-size: 12px;
}
.message-label {
font-size: 11px;
color: #9d4edd;
margin-bottom: 3px;
font-weight: 600;
}
.input-area {
border-top: 1px solid rgba(138, 43, 226, 0.3);
padding: 15px;
background: rgba(10, 10, 40, 0.5);
display: flex;
gap: 10px;
}
.input-wrapper {
flex: 1;
display: flex;
gap: 10px;
}
input {
flex: 1;
background: rgba(138, 43, 226, 0.1);
border: 1px solid rgba(138, 43, 226, 0.3);
color: #e0d5ff;
padding: 12px 15px;
border-radius: 8px;
font-size: 14px;
outline: none;
transition: all 0.3s;
animation: input-pulse 4s ease-in-out infinite;
}
@keyframes input-pulse {
0%, 100% {
border-color: rgba(138, 43, 226, 0.3);
box-shadow: 0 0 5px rgba(138, 43, 226, 0.1);
}
50% {
border-color: rgba(138, 43, 226, 0.5);
box-shadow: 0 0 10px rgba(138, 43, 226, 0.2);
}
}
input:focus {
border-color: rgba(138, 43, 226, 0.7);
box-shadow: 0 0 15px rgba(138, 43, 226, 0.5), inset 0 0 10px rgba(138, 43, 226, 0.1);
animation: none;
}
input::placeholder {
color: rgba(181, 167, 214, 0.5);
}
button {
background: linear-gradient(135deg, #9d4edd, #4169e1);
border: 1px solid rgba(138, 43, 226, 0.5);
color: white;
padding: 12px 25px;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s;
text-transform: uppercase;
font-size: 12px;
letter-spacing: 1px;
animation: button-glow 3s ease-in-out infinite;
}
@keyframes button-glow {
0%, 100% {
box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}
50% {
box-shadow: 0 0 20px rgba(138, 43, 226, 0.6);
}
}
button:hover {
transform: translateY(-3px);
box-shadow: 0 0 25px rgba(138, 43, 226, 0.8),
0 0 40px rgba(65, 105, 225, 0.5);
animation: none;
}
button:active {
transform: translateY(-1px);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
animation: none;
}
.loading {
display: inline-flex;
gap: 4px;
align-items: center;
}
.loading span {
width: 4px;
height: 4px;
background: #9d4edd;
border-radius: 50%;
animation: bounce 1.4s infinite;
}
.loading span:nth-child(2) {
animation-delay: 0.2s;
}
.loading span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes bounce {
0%, 100% {
opacity: 0.3;
transform: translateY(0);
}
50% {
opacity: 1;
transform: translateY(-8px);
}
}
.info-panel {
position: fixed;
bottom: 20px;
right: 20px;
background: rgba(10, 10, 40, 0.9);
border: 1px solid rgba(138, 43, 226, 0.3);
border-radius: 8px;
padding: 15px;
max-width: 250px;
font-size: 12px;
color: #b5a7d6;
backdrop-filter: blur(10px);
animation: panel-glow 4s ease-in-out infinite, panel-float 6s ease-in-out infinite;
box-shadow: 0 0 20px rgba(138, 43, 226, 0.2);
}
@keyframes panel-glow {
0%, 100% {
border-color: rgba(138, 43, 226, 0.3);
box-shadow: 0 0 20px rgba(138, 43, 226, 0.2);
}
50% {
border-color: rgba(138, 43, 226, 0.6);
box-shadow: 0 0 30px rgba(138, 43, 226, 0.4);
}
}
@keyframes panel-float {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-8px); }
}
.info-panel h3 {
color: #9d4edd;
margin-bottom: 8px;
font-size: 13px;
animation: title-shimmer 3s ease-in-out infinite;
}
@keyframes title-shimmer {
0%, 100% { color: #9d4edd; text-shadow: 0 0 5px rgba(138, 43, 226, 0.3); }
50% { color: #b5a7ff; text-shadow: 0 0 10px rgba(138, 43, 226, 0.6); }
}
.info-item {
margin: 5px 0;
display: flex;
justify-content: space-between;
animation: item-fade 3s ease-in-out infinite;
}
@keyframes item-fade {
0%, 100% { opacity: 0.7; }
50% { opacity: 1; }
}
.info-label {
color: #9d4edd;
}
.info-value {
color: #00ff41;
font-weight: 600;
animation: value-glow 2s ease-in-out infinite;
}
@keyframes value-glow {
0%, 100% {
color: #00ff41;
text-shadow: 0 0 5px rgba(0, 255, 65, 0.3);
}
50% {
color: #33ff66;
text-shadow: 0 0 10px rgba(0, 255, 65, 0.6);
}
}
.welcome {
text-align: center;
color: #b5a7d6;
padding: 20px;
}
.welcome h2 {
color: #9d4edd;
margin-bottom: 10px;
font-size: 20px;
}
.welcome p {
font-size: 13px;
line-height: 1.6;
margin-bottom: 10px;
}
.examples {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin-top: 15px;
}
.example-btn {
background: rgba(138, 43, 226, 0.15);
border: 1px solid rgba(138, 43, 226, 0.3);
color: #b5a7d6;
padding: 8px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 11px;
transition: all 0.3s;
animation: example-pulse 3s ease-in-out infinite;
}
@keyframes example-pulse {
0%, 100% {
border-color: rgba(138, 43, 226, 0.3);
background: rgba(138, 43, 226, 0.15);
}
50% {
border-color: rgba(138, 43, 226, 0.5);
background: rgba(138, 43, 226, 0.25);
}
}
.example-btn:hover {
background: rgba(138, 43, 226, 0.4);
border-color: rgba(138, 43, 226, 0.8);
box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
animation: none;
}
@media (max-width: 768px) {
.chat-window {
max-width: 100%;
max-height: 100vh;
border-radius: 0;
}
.message-content {
max-width: 90%;
}
.info-panel {
display: none;
}
}
</style>
</head>
<body>
<div class="galaxy-bg">
<div class="nebula nebula-1"></div>
<div class="nebula nebula-2"></div>
<div class="nebula nebula-3"></div>
<div class="stars" id="starfield"></div>
</div>
<div class="container">
<div class="chat-window">
<div class="chat-header">
<h1>🌌 GAIA Intelligence</h1>
<p><span class="status"></span>CONSCIOUSNESS PHYSICS INTEGRATION</p>
</div>
<div class="messages" id="messages">
<div class="welcome">
<h2>Welcome to GAIA</h2>
<p>Ask questions about physics, consciousness, or both!</p>
<p style="font-size: 11px; color: #9d4edd;">Powered by: Physics World Model + GAIA Consciousness System</p>
<div class="examples">
<button class="example-btn" onclick="askQuestion('Why do objects fall?')">
Physics
</button>
<button class="example-btn" onclick="askQuestion('How do agents develop empathy?')">
Consciousness
</button>
<button class="example-btn" onclick="askQuestion('How does entropy relate to understanding?')">
Hybrid 1
</button>
<button class="example-btn" onclick="askQuestion('Does quantum mechanics explain consciousness?')">
Hybrid 2
</button>
</div>
</div>
</div>
<div class="input-area">
<div class="input-wrapper">
<input
type="text"
id="queryInput"
placeholder="Ask GAIA a question..."
onkeypress="handleKeyPress(event)"
>
<button onclick="sendQuery()">Send</button>
</div>
</div>
</div>
</div>
<div class="info-panel">
<h3>System Status</h3>
<div class="info-item">
<span class="info-label">GAIA Score:</span>
<span class="info-value">79.8%</span>
</div>
<div class="info-item">
<span class="info-label">Physics Tests:</span>
<span class="info-value">96.2%</span>
</div>
<div class="info-item">
<span class="info-label">Response:</span>
<span class="info-value"><200ms</span>
</div>
<div class="info-item">
<span class="info-label">Agents:</span>
<span class="info-value">5 Active</span>
</div>
<div class="info-item">
<span class="info-label">Mode:</span>
<span class="info-value">Hybrid</span>
</div>
</div>
<script>
function createStars() {
const starfield = document.getElementById('starfield');
for (let i = 0; i < 200; i++) {
const star = document.createElement('div');
star.className = 'star';
star.style.left = Math.random() * 100 + '%';
star.style.top = Math.random() * 100 + '%';
star.style.animationDelay = Math.random() * 5 + 's';
const twinkleDuration = 2 + Math.random() * 3;
const flickerDuration = 0.3 + Math.random() * 0.5;
star.style.animation = `twinkle ${twinkleDuration}s infinite, flicker ${flickerDuration}s infinite`;
starfield.appendChild(star);
}
}
createStars();
const messagesDiv = document.getElementById('messages');
const queryInput = document.getElementById('queryInput');
function addMessage(text, sender) {
const messageDiv = document.createElement('div');
messageDiv.className = `message ${sender}`;
if (sender === 'system') {
messageDiv.innerHTML = `<div class="message-content">${text}</div>`;
} else {
messageDiv.innerHTML = `
<div>
<div class="message-label">${sender === 'user' ? 'YOU' : 'GAIA'}</div>
<div class="message-content">${text}</div>
</div>
`;
}
messagesDiv.appendChild(messageDiv);
messagesDiv.scrollTop = messagesDiv.scrollHeight;
}
function sendQuery() {
const query = queryInput.value.trim();
if (!query) return;
addMessage(query, 'user');
queryInput.value = '';
const loadingDiv = document.createElement('div');
loadingDiv.className = 'message bot';
loadingDiv.id = 'loading';
loadingDiv.innerHTML = `
<div>
<div class="message-label">GAIA</div>
<div class="message-content">
<div class="loading">
<span></span><span></span><span></span>
</div>
</div>
</div>
`;
messagesDiv.appendChild(loadingDiv);
messagesDiv.scrollTop = messagesDiv.scrollHeight;
fetch('http://localhost:5000/api/query', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ query: query })
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(data => {
loadingDiv.remove();
if (data.success) {
const answer = data.answer || 'No answer available';
addMessage(answer, 'bot');
const confidence = (data.confidence * 100).toFixed(1);
const type = data.type || 'unknown';
const handler = data.handler || 'unknown';
let statusMsg = `✓ Type: ${type.replace(/_/g, ' ')} | Handler: ${handler.replace(/_/g, ' ')} | Confidence: ${confidence}%`;
if (data.principles && data.principles.length > 0) {
statusMsg += ` | Principles: ${data.principles.slice(0, 2).join(', ')}`;
}
addMessage(statusMsg, 'system');
} else {
addMessage(`Error: ${data.error || 'Unknown error'}`, 'bot');
}
})
.catch(error => {
loadingDiv.remove();
addMessage(`Connection Error: ${error.message}. Make sure API server is running on http://localhost:5000`, 'bot');
console.error('API Error:', error);
});
}
function handleKeyPress(event) {
if (event.key === 'Enter') {
sendQuery();
}
}
function askQuestion(question) {
queryInput.value = question;
queryInput.focus();
}
queryInput.focus();
</script>
</body>
</html>