Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ad4f9ef
async-graph-client
galshubeli Aug 21, 2025
f92d76b
find-thread
galshubeli Aug 21, 2025
22aaeeb
Merge branch 'staging' into async-graph
gkorland Aug 21, 2025
759e4e0
Merge branch 'staging' into async-graph
gkorland Aug 21, 2025
c30f06c
Merge branch 'staging' into async-graph
gkorland Aug 21, 2025
49aef0d
Merge branch 'staging' into async-graph
gkorland Aug 21, 2025
0a467e9
imp-conc
galshubeli Aug 24, 2025
f85ad20
update-conc
galshubeli Aug 24, 2025
29d55df
rm-func
galshubeli Aug 24, 2025
08b8993
rm-time-logs
galshubeli Aug 24, 2025
e7d8896
Merge branch 'staging' into async-graph
galshubeli Aug 25, 2025
965b635
fix-awaits
galshubeli Aug 25, 2025
d80d6ae
fix GOOGLE_TAG_MANAGER_ID
gkorland Aug 25, 2025
50e27c8
Merge pull request #122 from FalkorDB/tag-manager
gkorland Aug 25, 2025
03d6a7b
Merge branch 'main' into staging
gkorland Aug 25, 2025
70f1166
Merge branch 'staging' into async-graph
gkorland Aug 25, 2025
ebd1006
Merge pull request #98 from FalkorDB/async-graph
gkorland Aug 25, 2025
4f235ce
update icons
gkorland Aug 25, 2025
12cd266
conn-pool
galshubeli Aug 25, 2025
df3cb25
Merge pull request #124 from FalkorDB/fix-connection
gkorland Aug 25, 2025
cc7d9b5
fix-async-queries
galshubeli Aug 25, 2025
f68e4a0
fix-comment
galshubeli Aug 25, 2025
e0cf84d
add-decode-res
galshubeli Aug 25, 2025
e863047
fix-async
galshubeli Aug 25, 2025
16b5a05
Update api/extensions.py
galshubeli Aug 25, 2025
fd18c88
Merge pull request #125 from FalkorDB/fix-async-queries
gkorland Aug 25, 2025
afa54d3
fix-commit
galshubeli Aug 25, 2025
2aad396
Merge branch 'staging' into fix-conn-pool
gkorland Aug 25, 2025
603608e
Merge pull request #126 from FalkorDB/fix-conn-pool
gkorland Aug 25, 2025
b8e426d
call callback_hanler after login
gkorland Aug 25, 2025
a8fa395
Merge pull request #128 from FalkorDB/fix-handler
gkorland Aug 25, 2025
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
2 changes: 1 addition & 1 deletion api/agents/relevancy_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, queries_history: list, result_history: list):
self.messages.append({"role": "user", "content": query})
self.messages.append({"role": "assistant", "content": result})

def get_answer(self, user_question: str, database_desc: dict) -> dict:
async def get_answer(self, user_question: str, database_desc: dict) -> dict:
"""Get relevancy assessment for user question against database description."""
self.messages.append(
{
Expand Down
10 changes: 3 additions & 7 deletions api/app_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from starlette.middleware.sessions import SessionMiddleware
from starlette.middleware.base import BaseHTTPMiddleware

from api.auth.oauth_handlers import setup_oauth_handlers
from api.routes.auth import auth_router, init_auth
from api.routes.graphs import graphs_router
from api.routes.database import database_router
Expand Down Expand Up @@ -83,6 +84,8 @@ def create_app():
app.include_router(graphs_router, prefix="/graphs")
app.include_router(database_router)

setup_oauth_handlers(app, app.state.oauth)

@app.exception_handler(Exception)
async def handle_oauth_error(request: Request, exc: Exception):
"""Handle OAuth-related errors gracefully"""
Expand All @@ -99,11 +102,4 @@ async def handle_oauth_error(request: Request, exc: Exception):
# For other errors, let them bubble up
raise exc

# Add template globals
@app.middleware("http")
async def add_template_globals(request: Request, call_next):
request.state.google_tag_manager_id = os.getenv("GOOGLE_TAG_MANAGER_ID")
response = await call_next(request)
return response

return app
4 changes: 2 additions & 2 deletions api/auth/oauth_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def handle_google_callback(_request: Request,
return False

# Check if identity exists in Organizations graph, create if new
_, _ = ensure_user_in_organizations(
_, _ = await ensure_user_in_organizations(
user_id,
email,
name,
Expand Down Expand Up @@ -62,7 +62,7 @@ async def handle_github_callback(_request: Request,
return False

# Check if identity exists in Organizations graph, create if new
_, _ = ensure_user_in_organizations(
_, _ = await ensure_user_in_organizations(
user_id,
email,
name,
Expand Down
8 changes: 4 additions & 4 deletions api/auth/user_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from api.extensions import db


def ensure_user_in_organizations(provider_user_id, email, name, provider, picture=None):
async def ensure_user_in_organizations(provider_user_id, email, name, provider, picture=None):
"""
Check if identity exists in Organizations graph, create if not.
Creates separate Identity and User nodes with proper relationships.
Expand Down Expand Up @@ -80,7 +80,7 @@ def ensure_user_in_organizations(provider_user_id, email, name, provider, pictur
EXISTS((user)<-[:AUTHENTICATES]-(:Identity)) AS had_other_identities
"""

result = organizations_graph.query(merge_query, {
result = await organizations_graph.query(merge_query, {
"provider": provider,
"provider_user_id": provider_user_id,
"email": email,
Expand Down Expand Up @@ -124,7 +124,7 @@ def ensure_user_in_organizations(provider_user_id, email, name, provider, pictur
return False, None


def update_identity_last_login(provider, provider_user_id):
async def update_identity_last_login(provider, provider_user_id):
"""Update the last login timestamp for an existing identity"""
# Input validation
if not provider or not provider_user_id:
Expand All @@ -145,7 +145,7 @@ def update_identity_last_login(provider, provider_user_id):
SET identity.last_login = timestamp()
RETURN identity
"""
organizations_graph.query(update_query, {
await organizations_graph.query(update_query, {
"provider": provider,
"provider_user_id": provider_user_id
})
Expand Down
14 changes: 12 additions & 2 deletions api/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import os

from falkordb import FalkorDB
from falkordb.asyncio import FalkorDB
from redis.asyncio import ConnectionPool

# Connect to FalkorDB
url = os.getenv("FALKORDB_URL", None)
Expand All @@ -12,4 +13,13 @@
except Exception as e:
raise ConnectionError(f"Failed to connect to FalkorDB: {e}") from e
else:
db = FalkorDB.from_url(os.getenv("FALKORDB_URL"))
# Ensure the URL is properly encoded as string and handle potential encoding issues
try:
# Create connection pool with explicit encoding settings
pool = ConnectionPool.from_url(
url,
decode_responses=True
)
db = FalkorDB(connection_pool=pool)
except Exception as e:
raise ConnectionError(f"Failed to connect to FalkorDB with URL: {e}") from e
Loading
Loading