- RAG Specialist fully implemented new style
- Selection Specialist - VA version - fully implemented - Correction of TRAICIE_ROLE_DEFINITION_SPECIALIST - adaptation to new style - Removal of 'debug' statements
This commit is contained in:
@@ -121,7 +121,6 @@ def view_content(content_type):
|
||||
content_type (str): Type content (eg. 'changelog', 'terms', 'privacy')
|
||||
"""
|
||||
try:
|
||||
current_app.logger.debug(f"Showing content {content_type}")
|
||||
major_minor = request.args.get('version')
|
||||
patch = request.args.get('patch')
|
||||
|
||||
@@ -163,5 +162,4 @@ def view_content(content_type):
|
||||
@roles_accepted('Super User', 'Partner Admin', 'Tenant Admin')
|
||||
def release_notes():
|
||||
"""Doorverwijzen naar de nieuwe content view voor changelog"""
|
||||
current_app.logger.debug(f"Redirecting to content viewer")
|
||||
return redirect(prefixed_url_for('basic_bp.view_content', content_type='changelog'))
|
||||
|
||||
@@ -137,14 +137,12 @@ class RetrieverForm(FlaskForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
tenant_id = session.get('tenant').get('id')
|
||||
choices = TenantServices.get_available_types_for_tenant(tenant_id, "retrievers")
|
||||
current_app.logger.debug(f"Potential choices: {choices}")
|
||||
# Dynamically populate the 'type' field using the constructor
|
||||
type_choices = []
|
||||
for key, value in choices.items():
|
||||
valid_catalog_types = value.get('valid_catalog_types', None)
|
||||
if valid_catalog_types:
|
||||
catalog_type = session.get('catalog').get('type')
|
||||
current_app.logger.debug(f"Check {catalog_type} in {valid_catalog_types}")
|
||||
if catalog_type in valid_catalog_types:
|
||||
type_choices.append((key, value['name']))
|
||||
else: # Retriever type is valid for all catalog types
|
||||
|
||||
@@ -668,7 +668,6 @@ def handle_document_version_selection():
|
||||
return redirect(prefixed_url_for('document_bp.document_versions_list'))
|
||||
|
||||
action = request.form['action']
|
||||
current_app.logger.debug(f'Action: {action}')
|
||||
|
||||
match action:
|
||||
case 'edit_document_version':
|
||||
@@ -747,7 +746,6 @@ def document_versions_list():
|
||||
@document_bp.route('/view_document_version_markdown/<int:document_version_id>', methods=['GET'])
|
||||
@roles_accepted('Super User', 'Partner Admin', 'Tenant Admin')
|
||||
def view_document_version_markdown(document_version_id):
|
||||
current_app.logger.debug(f'Viewing document version markdown {document_version_id}')
|
||||
# Retrieve document version
|
||||
document_version = DocumentVersion.query.get_or_404(document_version_id)
|
||||
|
||||
@@ -759,7 +757,6 @@ def view_document_version_markdown(document_version_id):
|
||||
markdown_filename = f"{document_version.id}.md"
|
||||
markdown_object_name = minio_client.generate_object_name(document_version.doc_id, document_version.language,
|
||||
document_version.id, markdown_filename)
|
||||
current_app.logger.debug(f'Markdown object name: {markdown_object_name}')
|
||||
# Download actual markdown file
|
||||
file_data = minio_client.download_document_file(
|
||||
tenant_id,
|
||||
@@ -769,7 +766,6 @@ def view_document_version_markdown(document_version_id):
|
||||
|
||||
# Decodeer de binaire data naar UTF-8 tekst
|
||||
markdown_content = file_data.decode('utf-8')
|
||||
current_app.logger.debug(f'Markdown content: {markdown_content}')
|
||||
|
||||
# Render de template met de markdown inhoud
|
||||
return render_template(
|
||||
|
||||
@@ -66,8 +66,6 @@ class OrderedListField(TextAreaField):
|
||||
else:
|
||||
existing_render_kw = {}
|
||||
|
||||
current_app.logger.debug(f"incomming render_kw for ordered list field: {existing_render_kw}")
|
||||
|
||||
# Stel nieuwe render_kw samen
|
||||
new_render_kw = {
|
||||
'data-list-type': list_type,
|
||||
@@ -91,8 +89,6 @@ class OrderedListField(TextAreaField):
|
||||
if key != 'class': # Klassen hebben we al verwerkt
|
||||
new_render_kw[key] = value
|
||||
|
||||
current_app.logger.debug(f"final render_kw for ordered list field: {new_render_kw}")
|
||||
|
||||
# Update kwargs met de nieuwe gecombineerde render_kw
|
||||
kwargs['render_kw'] = new_render_kw
|
||||
|
||||
@@ -327,7 +323,6 @@ class DynamicFormBase(FlaskForm):
|
||||
for the collection_name and may also contain list_type definitions
|
||||
initial_data: Optional initial data for the fields
|
||||
"""
|
||||
current_app.logger.debug(f"Adding dynamic fields for collection {collection_name} with config: {config}")
|
||||
|
||||
if isinstance(initial_data, str):
|
||||
try:
|
||||
@@ -535,7 +530,7 @@ class DynamicFormBase(FlaskForm):
|
||||
list_types[list_type] = specialist_config[list_type]
|
||||
break
|
||||
except Exception as e:
|
||||
current_app.logger.debug(f"Error checking specialist {specialist_type}: {e}")
|
||||
current_app.logger.error(f"Error checking specialist {specialist_type}: {e}")
|
||||
continue
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error retrieving specialist configurations: {e}")
|
||||
@@ -575,7 +570,6 @@ class DynamicFormBase(FlaskForm):
|
||||
# Parse JSON for special field types
|
||||
if field.type == 'BooleanField':
|
||||
data[original_field_name] = full_field_name in self.raw_formdata
|
||||
current_app.logger.debug(f"Value for {original_field_name} is {data[original_field_name]}")
|
||||
elif isinstance(field, (TaggingFieldsField, TaggingFieldsFilterField, DynamicArgumentsField, OrderedListField)) and field.data:
|
||||
try:
|
||||
data[original_field_name] = json.loads(field.data)
|
||||
|
||||
@@ -76,7 +76,6 @@ def handle_chat_session_selection():
|
||||
cs_id = ast.literal_eval(chat_session_identification).get('value')
|
||||
|
||||
action = request.form['action']
|
||||
current_app.logger.debug(f'Handle Chat Session Selection Action: {action}')
|
||||
|
||||
match action:
|
||||
case 'view_chat_session':
|
||||
@@ -503,7 +502,6 @@ def execute_specialist(specialist_id):
|
||||
if form.validate_on_submit():
|
||||
# We're only interested in gathering the dynamic arguments
|
||||
arguments = form.get_dynamic_data("arguments")
|
||||
current_app.logger.debug(f"Executing specialist {specialist.id} with arguments: {arguments}")
|
||||
session_id = SpecialistServices.start_session()
|
||||
execution_task = SpecialistServices.execute_specialist(
|
||||
tenant_id=session.get('tenant').get('id'),
|
||||
@@ -512,7 +510,6 @@ def execute_specialist(specialist_id):
|
||||
session_id=session_id,
|
||||
user_timezone=session.get('tenant').get('timezone')
|
||||
)
|
||||
current_app.logger.debug(f"Execution task for specialist {specialist.id} created: {execution_task}")
|
||||
return redirect(prefixed_url_for('interaction_bp.session_interactions_by_session_id', session_id=session_id))
|
||||
|
||||
return render_template('interaction/execute_specialist.html', form=form)
|
||||
@@ -620,7 +617,6 @@ def specialist_magic_link():
|
||||
# Define the make valid for this magic link
|
||||
specialist = Specialist.query.get(new_specialist_magic_link.specialist_id)
|
||||
make_id = specialist.configuration.get('make', None)
|
||||
current_app.logger.debug(f"make_id defined in specialist: {make_id}")
|
||||
if make_id:
|
||||
new_specialist_magic_link.tenant_make_id = make_id
|
||||
elif session.get('tenant').get('default_tenant_make_id'):
|
||||
@@ -707,10 +703,6 @@ def edit_specialist_magic_link(specialist_magic_link_id):
|
||||
|
||||
# Store the data URI in the form data
|
||||
form.qr_code_url.data = data_uri
|
||||
|
||||
current_app.logger.debug(f"QR code generated successfully for {magic_link_code}")
|
||||
current_app.logger.debug(f"QR code data URI starts with: {data_uri[:50]}...")
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Failed to generate QR code: {str(e)}")
|
||||
form.qr_code_url.data = "Error generating QR code"
|
||||
@@ -794,7 +786,6 @@ def assets():
|
||||
def handle_asset_selection():
|
||||
action = request.form.get('action')
|
||||
asset_id = request.form.get('selected_row')
|
||||
current_app.logger.debug(f"Action: {action}, Asset ID: {asset_id}")
|
||||
|
||||
if action == 'edit_asset':
|
||||
return redirect(prefixed_url_for('interaction_bp.edit_asset', asset_id=asset_id))
|
||||
|
||||
@@ -51,7 +51,6 @@ class AssetsListView(FilteredListView):
|
||||
else:
|
||||
return ''
|
||||
|
||||
current_app.logger.debug(f"Assets retrieved: {pagination.items}")
|
||||
rows = [
|
||||
[
|
||||
{'value': item.id, 'class': '', 'type': 'text'},
|
||||
|
||||
@@ -11,7 +11,6 @@ class DocumentListView(FilteredListView):
|
||||
|
||||
def get_query(self):
|
||||
catalog_id = session.get('catalog_id')
|
||||
current_app.logger.debug(f"Catalog ID: {catalog_id}")
|
||||
return Document.query.filter_by(catalog_id=catalog_id)
|
||||
|
||||
def apply_filters(self, query):
|
||||
@@ -57,7 +56,6 @@ class DocumentListView(FilteredListView):
|
||||
else:
|
||||
return ''
|
||||
|
||||
current_app.logger.debug(f"Items retrieved: {pagination.items}")
|
||||
rows = [
|
||||
[
|
||||
{'value': item.id, 'class': '', 'type': 'text'},
|
||||
|
||||
@@ -19,7 +19,6 @@ class FullDocumentListView(FilteredListView):
|
||||
|
||||
def get_query(self):
|
||||
catalog_id = session.get('catalog_id')
|
||||
current_app.logger.debug(f"Catalog ID: {catalog_id}")
|
||||
|
||||
# Fix: Selecteer alleen de id kolom in de subquery
|
||||
latest_version_subquery = (
|
||||
|
||||
@@ -57,7 +57,6 @@ def edit_partner(partner_id):
|
||||
form.tenant.data = tenant.name
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_app.logger.debug(f"Form data for Partner: {form.data}")
|
||||
# Populate the user with form data
|
||||
form.populate_obj(partner)
|
||||
update_logging_information(partner, dt.now(tz.utc))
|
||||
@@ -88,8 +87,6 @@ def partners():
|
||||
Tenant.name.label('name')
|
||||
).join(Tenant, Partner.tenant_id == Tenant.id).order_by(Partner.id))
|
||||
|
||||
current_app.logger.debug(f'{format_query_results(query)}')
|
||||
|
||||
pagination = query.paginate(page=page, per_page=per_page)
|
||||
the_partners = pagination.items
|
||||
|
||||
@@ -170,17 +167,10 @@ def edit_partner_service(partner_service_id):
|
||||
form.add_dynamic_fields("configuration", partner_service_config, partner_service.configuration)
|
||||
form.add_dynamic_fields("permissions", partner_service_config, partner_service.permissions)
|
||||
|
||||
if request.method == 'POST':
|
||||
current_app.logger.debug(f"Form returned: {form.data}")
|
||||
raw_form_data = request.form.to_dict()
|
||||
current_app.logger.debug(f"Raw form data: {raw_form_data}")
|
||||
|
||||
if form.validate_on_submit():
|
||||
form.populate_obj(partner_service)
|
||||
partner_service.configuration = form.get_dynamic_data('configuration')
|
||||
partner_service.permissions = form.get_dynamic_data('permissions')
|
||||
current_app.logger.debug(f"Partner Service configuration: {partner_service.configuration}")
|
||||
current_app.logger.debug(f"Partner Service permissions: {partner_service.permissions}")
|
||||
|
||||
update_logging_information(partner_service, dt.now(tz.utc))
|
||||
|
||||
|
||||
@@ -172,11 +172,6 @@ def validate_make_name(form, field):
|
||||
# Check if tenant_make already exists in the database
|
||||
existing_make = TenantMake.query.filter_by(name=field.data).first()
|
||||
|
||||
if existing_make:
|
||||
current_app.logger.debug(f'Existing make: {existing_make.id}')
|
||||
current_app.logger.debug(f'Form has id: {hasattr(form, 'id')}')
|
||||
if hasattr(form, 'id'):
|
||||
current_app.logger.debug(f'Form has id: {form.id.data}')
|
||||
if existing_make:
|
||||
if not hasattr(form, 'id') or form.id.data != existing_make.id:
|
||||
raise ValidationError(f'A Make with name "{field.data}" already exists. Choose another name.')
|
||||
|
||||
@@ -147,12 +147,8 @@ def select_tenant():
|
||||
# Start with a base query
|
||||
query = Tenant.query
|
||||
|
||||
current_app.logger.debug("We proberen het scherm op te bouwen")
|
||||
current_app.logger.debug(f"Session: {session}")
|
||||
|
||||
# Apply different filters based on user role
|
||||
if current_user.has_roles('Partner Admin') and 'partner' in session:
|
||||
current_app.logger.debug("We zitten in partner mode")
|
||||
# Get the partner's management service
|
||||
management_service = next((service for service in session['partner']['services']
|
||||
if service.get('type') == 'MANAGEMENT_SERVICE'), None)
|
||||
@@ -175,7 +171,6 @@ def select_tenant():
|
||||
# Filter query to only show allowed tenants
|
||||
query = query.filter(Tenant.id.in_(allowed_tenant_ids))
|
||||
|
||||
current_app.logger.debug("We zitten na partner service selectie")
|
||||
# Apply form filters (for both Super User and Partner Admin)
|
||||
if filter_form.validate_on_submit():
|
||||
if filter_form.types.data:
|
||||
@@ -722,9 +717,7 @@ def edit_tenant_make(tenant_make_id):
|
||||
form.populate_obj(tenant_make)
|
||||
tenant_make.chat_customisation_options = form.get_dynamic_data("configuration")
|
||||
# Verwerk allowed_languages als array
|
||||
current_app.logger.debug(f"Allowed languages: {form.allowed_languages.data}")
|
||||
tenant_make.allowed_languages = form.allowed_languages.data if form.allowed_languages.data else None
|
||||
current_app.logger.debug(f"Updated allowed languages: {tenant_make.allowed_languages}")
|
||||
|
||||
# Update logging information
|
||||
update_logging_information(tenant_make, dt.now(tz.utc))
|
||||
|
||||
Reference in New Issue
Block a user