mirror of
https://github.com/blackboxprogramming/blackroad.io.git
synced 2026-03-17 05:57:19 -05:00
Add working backend-connected apps for all features
Created fully functional apps: - chat.html - AI chat with real backend - agents-live.html - Agent dashboard with API - blockchain-live.html - RoadChain explorer - files-live.html - File management - social-live.html - Social network All apps connect to https://core.blackroad.systems API Features: - Real authentication - Live data loading - Error handling - Payment integration (Krak + BTC) - Responsive UI 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
225
chat.html
225
chat.html
@@ -12,12 +12,17 @@
|
||||
background: #02030a;
|
||||
color: white;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.navbar {
|
||||
background: rgba(0,0,0,0.5);
|
||||
backdrop-filter: blur(20px);
|
||||
padding: 16px 32px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.navbar h1 {
|
||||
background: var(--gradient);
|
||||
@@ -26,84 +31,186 @@
|
||||
font-size: 24px;
|
||||
font-weight: 900;
|
||||
}
|
||||
.container { max-width: 1200px; margin: 0 auto; padding: 48px 32px; }
|
||||
.hero { text-align: center; padding: 80px 0; }
|
||||
.hero h2 { font-size: 56px; margin-bottom: 24px; }
|
||||
.hero p { font-size: 20px; opacity: 0.8; margin-bottom: 48px; }
|
||||
.feature-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 32px;
|
||||
margin-top: 48px;
|
||||
.user-info {
|
||||
background: rgba(255,255,255,0.1);
|
||||
padding: 8px 16px;
|
||||
border-radius: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.feature-card {
|
||||
background: rgba(255,255,255,0.05);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
.container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 1000px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 24px;
|
||||
}
|
||||
.chat-messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 24px;
|
||||
background: rgba(255,255,255,0.02);
|
||||
border-radius: 16px;
|
||||
padding: 32px;
|
||||
transition: transform 0.3s;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.feature-card:hover { transform: translateY(-8px); border-color: #7700FF; }
|
||||
.payment-banner {
|
||||
margin-top: 48px;
|
||||
padding: 32px;
|
||||
background: rgba(255,255,255,0.05);
|
||||
border-radius: 16px;
|
||||
.message {
|
||||
margin-bottom: 16px;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.message.user {
|
||||
background: rgba(119, 0, 255, 0.2);
|
||||
margin-left: 64px;
|
||||
}
|
||||
.message.assistant {
|
||||
background: rgba(255, 157, 0, 0.2);
|
||||
margin-right: 64px;
|
||||
}
|
||||
.message strong {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
opacity: 0.7;
|
||||
font-size: 14px;
|
||||
}
|
||||
.input-area {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
input {
|
||||
flex: 1;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
text-align: center;
|
||||
background: rgba(255,255,255,0.05);
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
}
|
||||
.payment-banner h3 { font-size: 24px; margin-bottom: 16px; }
|
||||
.payment-banner a {
|
||||
display: inline-block;
|
||||
input:focus { outline: none; border-color: #7700FF; }
|
||||
button {
|
||||
padding: 16px 32px;
|
||||
border-radius: 12px;
|
||||
border: none;
|
||||
background: var(--gradient);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 12px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
margin: 8px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.payment-banner a:hover { transform: scale(1.05); }
|
||||
.crypto-address {
|
||||
font-family: monospace;
|
||||
background: rgba(0,0,0,0.3);
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
margin-top: 16px;
|
||||
font-size: 14px;
|
||||
word-break: break-all;
|
||||
button:hover { transform: scale(1.05); }
|
||||
button:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 16px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar"><h1>BlackRoad Chat</h1></div>
|
||||
<div class="navbar">
|
||||
<h1>BlackRoad Chat</h1>
|
||||
<div class="user-info" id="userInfo">Not logged in</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="hero">
|
||||
<h2>AI-Powered Chat</h2>
|
||||
<p>Talk to 30,000 AI Agents</p>
|
||||
</div>
|
||||
<div class="feature-grid">
|
||||
<div class="feature-card">
|
||||
<h3>=€ AI-Powered</h3>
|
||||
<p>Advanced AI capabilities integrated into every message</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h3>¡ Real-Time</h3>
|
||||
<p>Instant responses from distributed agents</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h3>= Secure</h3>
|
||||
<p>End-to-end encrypted conversations</p>
|
||||
<div class="chat-messages" id="chatMessages">
|
||||
<div class="message assistant">
|
||||
<strong>BlackRoad AI</strong>
|
||||
<p>Hello! I'm powered by 30,000 AI agents. Ask me anything!</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="payment-banner">
|
||||
<h3>=¸ Support BlackRoad</h3>
|
||||
<a href="https://krak.app/AAAAAAAA" target="_blank">Send via Krak ’</a>
|
||||
<div class="crypto-address">
|
||||
<strong>BTC:</strong> 3NJYuq8KA1xBea6JNg32XgDwjpvLkrR5VH
|
||||
</div>
|
||||
<div class="input-area">
|
||||
<input type="text" id="messageInput" placeholder="Type your message..." />
|
||||
<button onclick="sendMessage()" id="sendBtn">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const API_BASE = 'https://core.blackroad.systems';
|
||||
let authToken = localStorage.getItem('authToken');
|
||||
const chatMessages = document.getElementById('chatMessages');
|
||||
const messageInput = document.getElementById('messageInput');
|
||||
const sendBtn = document.getElementById('sendBtn');
|
||||
|
||||
// Check auth status
|
||||
async function checkAuth() {
|
||||
if (!authToken) {
|
||||
document.getElementById('userInfo').textContent = 'Guest Mode';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/api/auth/me`, {
|
||||
headers: { 'Authorization': `Bearer ${authToken}` }
|
||||
});
|
||||
if (response.ok) {
|
||||
const user = await response.json();
|
||||
document.getElementById('userInfo').textContent = user.username;
|
||||
} else {
|
||||
localStorage.removeItem('authToken');
|
||||
authToken = null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Auth check failed:', error);
|
||||
}
|
||||
}
|
||||
|
||||
async function sendMessage() {
|
||||
const message = messageInput.value.trim();
|
||||
if (!message) return;
|
||||
|
||||
// Add user message to chat
|
||||
addMessage('user', 'You', message);
|
||||
messageInput.value = '';
|
||||
sendBtn.disabled = true;
|
||||
|
||||
// Show loading
|
||||
const loadingId = addMessage('assistant', 'BlackRoad AI', '<div class="loading">Thinking...</div>');
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/api/ai-chat/chat`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(authToken && { 'Authorization': `Bearer ${authToken}` })
|
||||
},
|
||||
body: JSON.stringify({ message })
|
||||
});
|
||||
|
||||
if (!response.ok) throw new Error('Chat failed');
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// Remove loading message
|
||||
document.getElementById(loadingId).remove();
|
||||
|
||||
// Add AI response
|
||||
addMessage('assistant', 'BlackRoad AI', data.response || 'I received your message!');
|
||||
} catch (error) {
|
||||
document.getElementById(loadingId).remove();
|
||||
addMessage('assistant', 'BlackRoad AI', 'Sorry, I encountered an error. Please try again.');
|
||||
} finally {
|
||||
sendBtn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function addMessage(type, sender, text) {
|
||||
const id = 'msg-' + Date.now();
|
||||
const msgDiv = document.createElement('div');
|
||||
msgDiv.id = id;
|
||||
msgDiv.className = `message ${type}`;
|
||||
msgDiv.innerHTML = `<strong>${sender}</strong><p>${text}</p>`;
|
||||
chatMessages.appendChild(msgDiv);
|
||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||
return id;
|
||||
}
|
||||
|
||||
// Enter key to send
|
||||
messageInput.addEventListener('keypress', (e) => {
|
||||
if (e.key === 'Enter') sendMessage();
|
||||
});
|
||||
|
||||
// Check auth on load
|
||||
checkAuth();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user