- Introduction of dynamic Retrievers & Specialists
- Introduction of dynamic Processors - Introduction of caching system - Introduction of a better template manager - Adaptation of ModelVariables to support dynamic Processors / Retrievers / Specialists - Start adaptation of chat client
This commit is contained in:
@@ -52,37 +52,16 @@ def create_app(config_file=None):
|
||||
|
||||
@app.before_request
|
||||
def before_request():
|
||||
app.logger.debug(f'Before request: {request.method} {request.path}')
|
||||
app.logger.debug(f'Request URL: {request.url}')
|
||||
app.logger.debug(f'Request headers: {dict(request.headers)}')
|
||||
|
||||
# Log JSON data if the content type is application/json
|
||||
if request.is_json:
|
||||
app.logger.debug(f'JSON data: {request.json}')
|
||||
|
||||
# Log raw data for other content types
|
||||
if request.data:
|
||||
app.logger.debug(f'Raw data: {request.data}')
|
||||
|
||||
# Check if this is a request to the token endpoint
|
||||
if request.path == '/api/v1/auth/token' and request.method == 'POST':
|
||||
app.logger.debug('Token request detected, skipping JWT verification')
|
||||
return
|
||||
|
||||
# Check if this a health check request
|
||||
if request.path.startswith('/_healthz') or request.path.startswith('/healthz'):
|
||||
app.logger.debug('Health check request detected, skipping JWT verification')
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
verify_jwt_in_request(optional=True)
|
||||
tenant_id = get_jwt_identity()
|
||||
app.logger.debug(f'Tenant ID from JWT: {tenant_id}')
|
||||
|
||||
if tenant_id:
|
||||
Database(tenant_id).switch_schema()
|
||||
app.logger.debug(f'Switched to schema for tenant {tenant_id}')
|
||||
else:
|
||||
app.logger.debug('No tenant ID found in JWT')
|
||||
except Exception as e:
|
||||
app.logger.error(f'Error in before_request: {str(e)}')
|
||||
# Don't raise the exception here, let the request continue
|
||||
|
||||
Reference in New Issue
Block a user