Skip to content

Commit

Permalink
k
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Oct 12, 2024
1 parent e04acf0 commit 1a059c8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions backend/danswer/tools/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@


def get_tool_headers(headers: dict[str, str] | Headers) -> dict[str, str]:
"""
Extract headers specified in TOOL_PASS_THROUGH_HEADERS from input headers.
Handles both dict and FastAPI Headers objects, accounting for lowercase keys.
Args:
headers: Input headers as dict or Headers object.
Returns:
dict: Filtered headers based on TOOL_PASS_THROUGH_HEADERS.
"""
if not TOOL_PASS_THROUGH_HEADERS:
return {}

pass_through_headers = {}
for key in TOOL_PASS_THROUGH_HEADERS:
# fastapi makes all header keys lowercase, handling that here
lowercase_key = key.lower()
if key in headers:
pass_through_headers[key] = headers[key]
Expand Down
2 changes: 1 addition & 1 deletion deployment/docker_compose/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5432:5432"
- "5433:5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
2 changes: 1 addition & 1 deletion deployment/docker_compose/docker-compose.gpu-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5432:5432"
- "5433:5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5432"
- "5433"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down

0 comments on commit 1a059c8

Please sign in to comment.