Restore correct working of eveai_chat using gunicorn
This commit is contained in:
@@ -24,8 +24,10 @@ def register_client():
|
||||
# Validate tenant_id and api_key here (e.g., check against the database)
|
||||
if validate_tenant(tenant_id, api_key):
|
||||
access_token = create_access_token(identity={'tenant_id': tenant_id, 'api_key': api_key})
|
||||
current_app.logger.debug(f'Tenant Registration: Tenant {tenant_id} registered successfully')
|
||||
return jsonify({'token': access_token}), 200
|
||||
else:
|
||||
current_app.logger.debug(f'Tenant Registration: Invalid tenant_id ({tenant_id}) or api_key ({api_key})')
|
||||
return jsonify({'message': 'Invalid credentials'}), 401
|
||||
|
||||
|
||||
@@ -33,14 +35,14 @@ def register_client():
|
||||
@jwt_required()
|
||||
def handle_connect():
|
||||
current_tenant = get_jwt_identity()
|
||||
print(f'Tenant {current_tenant["tenant_id"]} connected')
|
||||
current_app.logger.debug(f'Tenant {current_tenant["tenant_id"]} connected')
|
||||
|
||||
|
||||
@socketio.on('message', namespace='/chat')
|
||||
@jwt_required()
|
||||
def handle_message(data):
|
||||
current_tenant = get_jwt_identity()
|
||||
print(f'Tenant {current_tenant["tenant_id"]} sent a message: {data}')
|
||||
current_app.logger.debug(f'Tenant {current_tenant["tenant_id"]} sent a message: {data}')
|
||||
# Store interaction in the database
|
||||
emit('response', {'data': 'Message received'}, broadcast=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user