Devrajsinh bharatsinh gohil commited on
Commit
c87cf42
Β·
1 Parent(s): 25ff05b

feat: Add professional HTML landing page for backend

Browse files
Files changed (2) hide show
  1. backend/main.py +15 -7
  2. backend/static/index.html +257 -0
backend/main.py CHANGED
@@ -110,13 +110,21 @@ app.include_router(diagnostics.router)
110
 
111
  @app.get("/")
112
  async def root():
113
- """Root endpoint - health check."""
114
- return {
115
- "name": "MEXAR Core Engine",
116
- "version": "2.0.0",
117
- "status": "operational",
118
- "docs": "/docs"
119
- }
 
 
 
 
 
 
 
 
120
 
121
 
122
  @app.get("/api/health")
 
110
 
111
  @app.get("/")
112
  async def root():
113
+ """Root endpoint - serves landing page."""
114
+ from fastapi.responses import FileResponse
115
+ from pathlib import Path
116
+
117
+ html_path = Path(__file__).parent / "static" / "index.html"
118
+ if html_path.exists():
119
+ return FileResponse(html_path, media_type="text/html")
120
+ else:
121
+ # Fallback to JSON if HTML not found
122
+ return {
123
+ "name": "MEXAR Core Engine",
124
+ "version": "2.0.0",
125
+ "status": "operational",
126
+ "docs": "/docs"
127
+ }
128
 
129
 
130
  @app.get("/api/health")
backend/static/index.html ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>MEXAR Core Engine - API</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+ body {
14
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
15
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
16
+ min-height: 100vh;
17
+ padding: 2rem;
18
+ color: #333;
19
+ }
20
+ .container {
21
+ max-width: 900px;
22
+ margin: 0 auto;
23
+ background: white;
24
+ border-radius: 16px;
25
+ box-shadow: 0 20px 60px rgba(0,0,0,0.3);
26
+ overflow: hidden;
27
+ }
28
+ .header {
29
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
30
+ color: white;
31
+ padding: 3rem 2rem;
32
+ text-align: center;
33
+ }
34
+ .header h1 {
35
+ font-size: 2.5rem;
36
+ margin-bottom: 0.5rem;
37
+ }
38
+ .header .subtitle {
39
+ font-size: 1.1rem;
40
+ opacity: 0.9;
41
+ }
42
+ .badge {
43
+ display: inline-block;
44
+ background: rgba(255,255,255,0.2);
45
+ padding: 0.3rem 0.8rem;
46
+ border-radius: 20px;
47
+ font-size: 0.85rem;
48
+ margin: 0.5rem 0.3rem 0 0;
49
+ }
50
+ .content {
51
+ padding: 2rem;
52
+ }
53
+ .section {
54
+ margin-bottom: 2rem;
55
+ }
56
+ .section h2 {
57
+ color: #667eea;
58
+ font-size: 1.5rem;
59
+ margin-bottom: 1rem;
60
+ padding-bottom: 0.5rem;
61
+ border-bottom: 2px solid #f0f0f0;
62
+ }
63
+ .endpoint {
64
+ background: #f8f9fa;
65
+ border-left: 4px solid #667eea;
66
+ padding: 1rem;
67
+ margin-bottom: 1rem;
68
+ border-radius: 4px;
69
+ }
70
+ .endpoint code {
71
+ background: #e9ecef;
72
+ padding: 0.2rem 0.5rem;
73
+ border-radius: 3px;
74
+ font-family: 'Courier New', monospace;
75
+ color: #212529;
76
+ }
77
+ .method {
78
+ display: inline-block;
79
+ padding: 0.2rem 0.5rem;
80
+ border-radius: 3px;
81
+ font-weight: bold;
82
+ margin-right: 0.5rem;
83
+ font-size: 0.85rem;
84
+ }
85
+ .method.get { background: #28a745; color: white; }
86
+ .method.post { background: #007bff; color: white; }
87
+ .method.delete { background: #dc3545; color: white; }
88
+ .feature-grid {
89
+ display: grid;
90
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
91
+ gap: 1rem;
92
+ margin-top: 1rem;
93
+ }
94
+ .feature-card {
95
+ background: #f8f9fa;
96
+ padding: 1.5rem;
97
+ border-radius: 8px;
98
+ border: 1px solid #e9ecef;
99
+ }
100
+ .feature-card h3 {
101
+ color: #667eea;
102
+ margin-bottom: 0.5rem;
103
+ font-size: 1.1rem;
104
+ }
105
+ .links {
106
+ display: flex;
107
+ gap: 1rem;
108
+ margin-top: 1.5rem;
109
+ flex-wrap: wrap;
110
+ }
111
+ .btn {
112
+ display: inline-block;
113
+ padding: 0.75rem 1.5rem;
114
+ background: #667eea;
115
+ color: white;
116
+ text-decoration: none;
117
+ border-radius: 6px;
118
+ font-weight: 500;
119
+ transition: all 0.3s;
120
+ }
121
+ .btn:hover {
122
+ background: #5568d3;
123
+ transform: translateY(-2px);
124
+ box-shadow: 0 4px 12px rgba(102,126,234,0.4);
125
+ }
126
+ .btn.secondary {
127
+ background: #6c757d;
128
+ }
129
+ .btn.secondary:hover {
130
+ background: #5a6268;
131
+ }
132
+ .footer {
133
+ background: #f8f9fa;
134
+ padding: 1.5rem 2rem;
135
+ text-align: center;
136
+ color: #6c757d;
137
+ font-size: 0.9rem;
138
+ }
139
+ </style>
140
+ </head>
141
+ <body>
142
+ <div class="container">
143
+ <div class="header">
144
+ <h1>🧠 MEXAR Core Engine</h1>
145
+ <p class="subtitle">Multimodal Explainable AI Reasoning Assistant</p>
146
+ <div>
147
+ <span class="badge">FastAPI 0.109</span>
148
+ <span class="badge">Python 3.9+</span>
149
+ <span class="badge">Status: Operational</span>
150
+ </div>
151
+ </div>
152
+
153
+ <div class="content">
154
+ <div class="section">
155
+ <h2>✨ Key Features</h2>
156
+ <div class="feature-grid">
157
+ <div class="feature-card">
158
+ <h3>πŸ” Hybrid Search</h3>
159
+ <p>Semantic + keyword search with RRF fusion</p>
160
+ </div>
161
+ <div class="feature-card">
162
+ <h3>πŸ“Š Source Attribution</h3>
163
+ <p>Inline citations linking to source data</p>
164
+ </div>
165
+ <div class="feature-card">
166
+ <h3>πŸ—£οΈ Multimodal</h3>
167
+ <p>Audio, Images, Video support</p>
168
+ </div>
169
+ <div class="feature-card">
170
+ <h3>βœ… Faithfulness</h3>
171
+ <p>Grounding verification for answers</p>
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+ <div class="section">
177
+ <h2>πŸ”— Quick Links</h2>
178
+ <div class="links">
179
+ <a href="/docs" class="btn">πŸ“– Interactive API Docs</a>
180
+ <a href="/redoc" class="btn secondary">πŸ“‘ ReDoc Documentation</a>
181
+ <a href="https://mexar.vercel.app" class="btn secondary">🌐 Frontend App</a>
182
+ <a href="https://github.com/devrajsinh2012/Mexar" class="btn secondary">πŸ’» GitHub Repository</a>
183
+ </div>
184
+ </div>
185
+
186
+ <div class="section">
187
+ <h2>πŸ”§ API Endpoints</h2>
188
+
189
+ <div class="endpoint">
190
+ <span class="method post">POST</span>
191
+ <code>/api/auth/register</code>
192
+ <p style="margin-top: 0.5rem;">Register a new user account</p>
193
+ </div>
194
+
195
+ <div class="endpoint">
196
+ <span class="method post">POST</span>
197
+ <code>/api/auth/login</code>
198
+ <p style="margin-top: 0.5rem;">Login and receive JWT token</p>
199
+ </div>
200
+
201
+ <div class="endpoint">
202
+ <span class="method get">GET</span>
203
+ <code>/api/agents/</code>
204
+ <p style="margin-top: 0.5rem;">List all compiled agents</p>
205
+ </div>
206
+
207
+ <div class="endpoint">
208
+ <span class="method post">POST</span>
209
+ <code>/api/compile/</code>
210
+ <p style="margin-top: 0.5rem;">Start agent compilation from uploaded files</p>
211
+ </div>
212
+
213
+ <div class="endpoint">
214
+ <span class="method post">POST</span>
215
+ <code>/api/chat/</code>
216
+ <p style="margin-top: 0.5rem;">Send a message to an agent</p>
217
+ </div>
218
+
219
+ <div class="endpoint">
220
+ <span class="method get">GET</span>
221
+ <code>/api/health</code>
222
+ <p style="margin-top: 0.5rem;">Check API health status</p>
223
+ </div>
224
+ </div>
225
+
226
+ <div class="section">
227
+ <h2>πŸš€ Getting Started</h2>
228
+ <ol style="line-height: 2; padding-left: 1.5rem;">
229
+ <li>Visit the <a href="/docs" style="color: #667eea;">interactive API documentation</a></li>
230
+ <li>Register an account via <code>/api/auth/register</code></li>
231
+ <li>Login to receive your JWT token</li>
232
+ <li>Use the token in the <code>Authorization: Bearer {token}</code> header</li>
233
+ <li>Start creating agents and chat!</li>
234
+ </ol>
235
+ </div>
236
+
237
+ <div class="section">
238
+ <h2>πŸ“Š Tech Stack</h2>
239
+ <p style="line-height: 1.8;">
240
+ <strong>Framework:</strong> FastAPI<br>
241
+ <strong>Database:</strong> PostgreSQL with pgvector<br>
242
+ <strong>AI/LLM:</strong> Groq API (Llama 3.3, Whisper, Vision)<br>
243
+ <strong>Embeddings:</strong> FastEmbed (BAAI/bge-small-en-v1.5)<br>
244
+ <strong>Deployment:</strong> Hugging Face Spaces (Docker)
245
+ </p>
246
+ </div>
247
+ </div>
248
+
249
+ <div class="footer">
250
+ <p>MEXAR Core Engine v2.0.0 | Built with ❀️ using FastAPI</p>
251
+ <p style="margin-top: 0.5rem;">
252
+ <a href="https://github.com/devrajsinh2012/Mexar" style="color: #667eea; text-decoration: none;">View on GitHub</a>
253
+ </p>
254
+ </div>
255
+ </div>
256
+ </body>
257
+ </html>