ready packed app

This commit is contained in:
ALIHAN DIKEL
2025-03-26 00:05:30 +03:00
parent 0a9c5a098c
commit 134d6a2389
6 changed files with 58 additions and 3 deletions

16
Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN mkdir -p static
COPY static/index.html static/
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

19
docker-compose.yml Normal file
View File

@@ -0,0 +1,19 @@
version: '3.8'
services:
web:
build: .
ports:
- "8000:8000"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/benchmarks"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: '1'
memory: 512M

View File

@@ -3,7 +3,7 @@ from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
import os
from services import benchmarks
import benchmarks
app = FastAPI(title="RAG Benchmark Dashboard")

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
fastapi==0.100.0
uvicorn==0.22.0
python-multipart==0.0.6

3
run.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
uvicorn main:app --host 0.0.0.0 --port 8888 --reload

View File

@@ -230,7 +230,8 @@
expandedQuestions: {},
notification: {
type: 'success',
message: 'Benchmark data loaded successfully!'
message: 'Benchmark data loaded successfully!',
autoDismiss: true // Add autoDismiss flag for success notifications
}
});
@@ -300,7 +301,8 @@
expandedQuestions: {},
notification: {
type: 'info',
message: 'All uploaded benchmarks have been cleared.'
message: 'All uploaded benchmarks have been cleared.',
autoDismiss: true // Auto-dismiss for info notifications too
}
});
}
@@ -308,6 +310,18 @@
// Update state and trigger re-render
setState(newState) {
this.state = { ...this.state, ...newState };
// Auto-dismiss success and info notifications
if (this.state.notification && this.state.notification.autoDismiss) {
setTimeout(() => {
// Only clear the notification if it hasn't changed since the timeout was set
if (this.state.notification && this.state.notification.autoDismiss) {
this.state.notification = null;
this.render();
}
}, 3000); // Auto-dismiss after 3 seconds
}
this.render();
}