mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-02 17:00:28 +08:00
8906854dbf
* Extract classes UserRepository and TaskRepository from PromptRepository * move close_task() to TaskRepository and get_user_leaderboard to UserRepository() * Use UserRepository in leaderboards endpoint, add type annotation to leaderboards endpoint
18 lines
527 B
Python
18 lines
527 B
Python
from fastapi import APIRouter, Depends
|
|
from oasst_backend.api import deps
|
|
from oasst_backend.models import ApiClient
|
|
from oasst_backend.prompt_repository import PromptRepository
|
|
from oasst_shared.schemas import protocol
|
|
from sqlmodel import Session
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/", response_model=protocol.SystemStats)
|
|
def get_message_stats(
|
|
db: Session = Depends(deps.get_db),
|
|
api_client: ApiClient = Depends(deps.get_trusted_api_client),
|
|
):
|
|
pr = PromptRepository(db, api_client)
|
|
return pr.get_stats()
|