File size: 311 Bytes
089198a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from fastapi import APIRouter
from .metrics import tracker

router = APIRouter()

@router.get("/stats")
def get_stats():
    return tracker.get_stats()

@router.get("/get_history")
def get_history():
    s = tracker.get_stats()
    return {"history": s["lastN_questions"], "total_chunks": s["total_chunks"]}