Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/app/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@
organization_id = api_key_record.organization_id
project_id = api_key_record.project_id

else:
raise HTTPException(status_code=401, detail="Invalid API Key")

Check warning on line 125 in backend/app/api/deps.py

View check run for this annotation

Codecov / codecov/patch

backend/app/api/deps.py#L125

Added line #L125 was not covered by tests

return UserProjectOrg(
**current_user.model_dump(),
organization_id=organization_id,
Expand Down
8 changes: 4 additions & 4 deletions backend/app/api/routes/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from typing import Optional
from langfuse.decorators import observe, langfuse_context

from app.api.deps import get_current_user_org, get_db
from app.api.deps import get_current_user_org, get_db, get_current_user_org_project
from app.core import logging, settings
from app.models import UserOrganization, OpenAIThreadCreate
from app.models import UserOrganization, OpenAIThreadCreate, UserProjectOrg
from app.crud import upsert_thread_result, get_thread_result
from app.utils import APIResponse
from app.crud.credentials import get_provider_credential
Expand Down Expand Up @@ -372,7 +372,7 @@ async def start_thread(
request: StartThreadRequest,
background_tasks: BackgroundTasks,
db: Session = Depends(get_db),
_current_user: UserOrganization = Depends(get_current_user_org),
_current_user: UserProjectOrg = Depends(get_current_user_org_project),
):
"""
Create a new OpenAI thread for the given question and start polling in the background.
Expand All @@ -383,7 +383,7 @@ async def start_thread(
session=db,
org_id=_current_user.organization_id,
provider="openai",
project_id=request.get("project_id"),
project_id=_current_user.project_id,
)

# Configure OpenAI client
Expand Down