Add comprehensive web-based admin interface

Creates a production-ready admin interface with FastAPI backend and React frontend:

Backend Features:
- FastAPI server with JWT authentication and WebSocket support
- Comprehensive API endpoints for dashboard, characters, conversations, analytics
- Real-time metrics and activity monitoring with WebSocket broadcasting
- System control endpoints for pause/resume and configuration management
- Advanced analytics including topic trends, relationship networks, community health
- Export capabilities for conversations and character data

Frontend Features:
- Modern React/TypeScript SPA with Tailwind CSS styling
- Real-time dashboard with live activity feeds and system metrics
- Character management interface with profiles and relationship visualization
- Conversation browser with search, filtering, and export capabilities
- Analytics dashboard with charts and community insights
- System status monitoring and control interface
- Responsive design with mobile support

Key Components:
- Authentication system with session management
- WebSocket integration for real-time updates
- Chart visualizations using Recharts
- Component library with consistent design system
- API client with automatic token management
- Toast notifications for user feedback

Admin Interface Access:
- Backend: http://localhost:8000 (FastAPI with auto-docs)
- Frontend: http://localhost:3000/admin (React SPA)
- Default credentials: admin/admin123
- Startup script: python scripts/start_admin.py

This provides complete observability and management capabilities for the autonomous character ecosystem.
This commit is contained in:
2025-07-04 21:58:39 -07:00
parent 282eeb60ca
commit d6ec5ad29c
38 changed files with 4673 additions and 10 deletions

View File

@@ -0,0 +1,130 @@
import React, { useState } from 'react';
import { useAuth } from '../contexts/AuthContext';
import { Monitor, Users, MessageSquare } from 'lucide-react';
import LoadingSpinner from '../components/Common/LoadingSpinner';
import toast from 'react-hot-toast';
const LoginPage: React.FC = () => {
const [username, setUsername] = useState('admin');
const [password, setPassword] = useState('');
const [loading, setLoading] = useState(false);
const { login } = useAuth();
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!username || !password) {
toast.error('Please enter both username and password');
return;
}
setLoading(true);
try {
await login(username, password);
toast.success('Login successful!');
} catch (error: any) {
toast.error(error.message || 'Login failed');
} finally {
setLoading(false);
}
};
return (
<div className="min-h-screen bg-gradient-to-br from-primary-50 to-secondary-100 flex items-center justify-center px-4">
<div className="max-w-md w-full">
{/* Logo and Title */}
<div className="text-center mb-8">
<div className="mx-auto w-16 h-16 bg-primary-600 rounded-xl flex items-center justify-center mb-4">
<Monitor className="w-8 h-8 text-white" />
</div>
<h1 className="text-3xl font-bold text-gray-900 mb-2">Discord Fishbowl</h1>
<p className="text-gray-600">Admin Interface</p>
</div>
{/* Features Preview */}
<div className="mb-8 grid grid-cols-3 gap-4">
<div className="text-center">
<div className="w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center mx-auto mb-2">
<Users className="w-5 h-5 text-blue-600" />
</div>
<p className="text-xs text-gray-600">Character Management</p>
</div>
<div className="text-center">
<div className="w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center mx-auto mb-2">
<MessageSquare className="w-5 h-5 text-green-600" />
</div>
<p className="text-xs text-gray-600">Live Conversations</p>
</div>
<div className="text-center">
<div className="w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center mx-auto mb-2">
<Monitor className="w-5 h-5 text-purple-600" />
</div>
<p className="text-xs text-gray-600">Real-time Analytics</p>
</div>
</div>
{/* Login Form */}
<div className="bg-white rounded-xl shadow-lg p-8">
<form onSubmit={handleSubmit} className="space-y-6">
<div>
<label htmlFor="username" className="block text-sm font-medium text-gray-700 mb-2">
Username
</label>
<input
id="username"
type="text"
value={username}
onChange={(e) => setUsername(e.target.value)}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
placeholder="Enter your username"
disabled={loading}
/>
</div>
<div>
<label htmlFor="password" className="block text-sm font-medium text-gray-700 mb-2">
Password
</label>
<input
id="password"
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
placeholder="Enter your password"
disabled={loading}
/>
</div>
<button
type="submit"
disabled={loading}
className="w-full bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"
>
{loading ? (
<LoadingSpinner size="sm" />
) : (
'Sign In'
)}
</button>
</form>
{/* Demo credentials hint */}
<div className="mt-6 p-4 bg-gray-50 rounded-lg">
<p className="text-sm text-gray-600 text-center">
<strong>Demo credentials:</strong><br />
Username: admin<br />
Password: admin123
</p>
</div>
</div>
{/* Footer */}
<div className="text-center mt-8 text-sm text-gray-500">
Monitor and manage your autonomous AI character ecosystem
</div>
</div>
</div>
);
};
export default LoginPage;