mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Update health API to pass authenticated users their info
This allows Khoj clients to get email address associated with user's API token for display in client UX In anonymous mode, default user information is passed
This commit is contained in:
parent
4d30f7d1d9
commit
870af19ba4
1 changed files with 5 additions and 3 deletions
|
@ -554,6 +554,8 @@ async def extract_references_and_questions(
|
|||
return compiled_references, inferred_queries, defiltered_query
|
||||
|
||||
|
||||
@api.get("/health")
|
||||
async def health_check():
|
||||
return Response(status_code=200)
|
||||
@api.get("/health", response_class=Response)
|
||||
@requires(["authenticated"], status_code=200)
|
||||
def health_check(request: Request) -> Response:
|
||||
response_obj = {"email": request.user.object.email}
|
||||
return Response(content=json.dumps(response_obj), media_type="application/json", status_code=200)
|
||||
|
|
Loading…
Reference in a new issue