- Created a new eveai_chat plugin to support the new dynamic possibilities of the Specialists. Currently only supports standard Rag retrievers (i.e. no extra arguments).
This commit is contained in:
@@ -68,7 +68,7 @@ def tenant():
|
||||
current_app.logger.info(f"Creating MinIO bucket for tenant {new_tenant.id}")
|
||||
minio_client.create_tenant_bucket(new_tenant.id)
|
||||
|
||||
return redirect(prefixed_url_for('basic_bp.index'))
|
||||
return redirect(prefixed_url_for('user_bp.select_tenant'))
|
||||
else:
|
||||
form_validation_failed(request, form)
|
||||
|
||||
@@ -378,66 +378,6 @@ def edit_tenant_domain(tenant_domain_id):
|
||||
return render_template('user/edit_tenant_domain.html', form=form, tenant_domain_id=tenant_domain_id)
|
||||
|
||||
|
||||
@user_bp.route('/check_chat_api_key', methods=['POST'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def check_chat_api_key():
|
||||
tenant_id = session['tenant']['id']
|
||||
tenant = Tenant.query.get_or_404(tenant_id)
|
||||
|
||||
if tenant.encrypted_chat_api_key:
|
||||
return jsonify({'api_key_exists': True})
|
||||
return jsonify({'api_key_exists': False})
|
||||
|
||||
|
||||
@user_bp.route('/generate_chat_api_key', methods=['POST'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def generate_chat_api_key():
|
||||
tenant = Tenant.query.get_or_404(session['tenant']['id'])
|
||||
|
||||
new_api_key = generate_api_key(prefix="EveAI-CHAT")
|
||||
tenant.encrypted_chat_api_key = simple_encryption.encrypt_api_key(new_api_key)
|
||||
update_logging_information(tenant, dt.now(tz.utc))
|
||||
|
||||
try:
|
||||
db.session.add(tenant)
|
||||
db.session.commit()
|
||||
except SQLAlchemyError as e:
|
||||
db.session.rollback()
|
||||
current_app.logger.error(f'Unable to store chat api key for tenant {tenant.id}. Error: {str(e)}')
|
||||
|
||||
return jsonify({'api_key': new_api_key}), 200
|
||||
|
||||
|
||||
@user_bp.route('/check_api_api_key', methods=['POST'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def check_api_api_key():
|
||||
tenant_id = session['tenant']['id']
|
||||
tenant = Tenant.query.get_or_404(tenant_id)
|
||||
|
||||
if tenant.encrypted_api_key:
|
||||
return jsonify({'api_key_exists': True})
|
||||
return jsonify({'api_key_exists': False})
|
||||
|
||||
|
||||
@user_bp.route('/generate_api_api_key', methods=['POST'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def generate_api_api_key():
|
||||
tenant = Tenant.query.get_or_404(session['tenant']['id'])
|
||||
|
||||
new_api_key = generate_api_key(prefix="EveAI-API")
|
||||
tenant.encrypted_api_key = simple_encryption.encrypt_api_key(new_api_key)
|
||||
update_logging_information(tenant, dt.now(tz.utc))
|
||||
|
||||
try:
|
||||
db.session.add(tenant)
|
||||
db.session.commit()
|
||||
except SQLAlchemyError as e:
|
||||
db.session.rollback()
|
||||
current_app.logger.error(f'Unable to store api key for tenant {tenant.id}. Error: {str(e)}')
|
||||
|
||||
return jsonify({'api_key': new_api_key}), 200
|
||||
|
||||
|
||||
@user_bp.route('/tenant_overview', methods=['GET'])
|
||||
@roles_accepted('Super User', 'Tenant Admin')
|
||||
def tenant_overview():
|
||||
|
||||
Reference in New Issue
Block a user