feat: use local profile image by default

This commit is contained in:
Timothy J. Baek 2024-01-26 21:38:33 -08:00
parent 3ce8f3e8fb
commit 0c322063b5
4 changed files with 72 additions and 31 deletions

View file

@ -65,7 +65,7 @@ class UsersTable:
"name": name,
"email": email,
"role": role,
"profile_image_url": get_gravatar_url(email),
"profile_image_url": "/user.png",
"timestamp": int(time.time()),
}
)

View file

@ -9,7 +9,7 @@ import os
import aiohttp
import json
from utils.misc import calculate_sha256
from utils.misc import calculate_sha256, get_gravatar_url
from config import OLLAMA_API_BASE_URL, DATA_DIR, UPLOAD_DIR
from constants import ERROR_MESSAGES
@ -165,3 +165,10 @@ def upload(file: UploadFile = File(...)):
yield f"data: {json.dumps(res)}\n\n"
return StreamingResponse(file_process_stream(), media_type="text/event-stream")
@router.get("/gravatar")
async def get_gravatar(
email: str,
):
return get_gravatar_url(email)