diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d97d088 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c980228 --- /dev/null +++ b/docker-compose.yml @@ -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 diff --git a/main.py b/main.py index 765795c..aa1af09 100644 --- a/main.py +++ b/main.py @@ -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") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5d402e1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +fastapi==0.100.0 +uvicorn==0.22.0 +python-multipart==0.0.6 \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..06d74ec --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +uvicorn main:app --host 0.0.0.0 --port 8888 --reload \ No newline at end of file diff --git a/static/index.html b/static/index.html index f654ab0..8ac9f6d 100644 --- a/static/index.html +++ b/static/index.html @@ -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(); }