Skip to content

Commit

Permalink
Fix Oauth routes (#1968)
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem authored Feb 12, 2025
1 parent 17e0a9e commit e44a257
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion py/core/main/api/v3/retrieval_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ async def agent_app(
The agent uses both vector search and knowledge graph capabilities to find and synthesize
information, providing detailed, factual responses with proper attribution to source documents.
"""
print("in app..")
if "model" not in rag_generation_config.__fields_set__:
rag_generation_config.model = self.config.app.quality_llm

Expand Down
7 changes: 5 additions & 2 deletions py/core/main/api/v3/users_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,7 @@ async def get_user_limits(
return limits_info # type: ignore

@self.router.get("/users/oauth/google/authorize")
@self.base_endpoint
async def google_authorize() -> WrappedGenericMessageResponse:
"""
Redirect user to Google's OAuth 2.0 consent screen.
Expand All @@ -1729,6 +1730,7 @@ async def google_authorize() -> WrappedGenericMessageResponse:
return GenericMessageResponse(message=google_auth_url) # type: ignore

@self.router.get("/users/oauth/google/callback")
@self.base_endpoint
async def google_callback(
code: str = Query(...), state: str = Query(...)
) -> WrappedLoginResponse:
Expand Down Expand Up @@ -1780,14 +1782,14 @@ async def google_callback(
email=email,
)

# =============== GITHUB OAUTH ===============
@self.router.get("/users/oauth/github/authorize")
@self.base_endpoint
async def github_authorize() -> WrappedGenericMessageResponse:
"""
Redirect user to GitHub's OAuth consent screen.
"""
state = "some_random_string_or_csrf_token"
scope = "read:user user:email" # whatever scopes you need
scope = "read:user user:email"

params = {
"client_id": self.github_client_id,
Expand All @@ -1799,6 +1801,7 @@ async def github_authorize() -> WrappedGenericMessageResponse:
return GenericMessageResponse(message=github_auth_url) # type: ignore

@self.router.get("/users/oauth/github/callback")
@self.base_endpoint
async def github_callback(
code: str = Query(...), state: str = Query(...)
) -> WrappedLoginResponse:
Expand Down
4 changes: 2 additions & 2 deletions py/sdk/sync_methods/retrieval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import uuid
from typing import Any, AsyncGenerator, Optional, Union
from typing import Any, AsyncGenerator, Optional

from shared.api.models import (
WrappedAgentResponse,
Expand Down Expand Up @@ -169,7 +169,7 @@ def agent(
search_settings: Optional[dict | SearchSettings] = None,
task_prompt_override: Optional[str] = None,
include_title_if_available: Optional[bool] = False,
conversation_id: Optional[Union[str, uuid.UUID]] = None,
conversation_id: Optional[str | uuid.UUID] = None,
tools: Optional[list[dict]] = None,
max_tool_context_length: Optional[int] = None,
use_extended_prompt: Optional[bool] = True,
Expand Down
4 changes: 0 additions & 4 deletions py/tests/unit/test_citations.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import re
import uuid
from copy import deepcopy

# Example imports (adjust paths to match your codebase)
from typing import List

import pytest

Expand Down

0 comments on commit e44a257

Please sign in to comment.