Changes for eveai_chat_client:
- Session Defaults Header clickable - Document Processing View - show 'Finished Processing' iso 'Processing' to have more logical visual indicators - TRAICIE_SELECTION_SPECIALIST now no longer shows question to start selection procedure at initialisation. - Error Messages for adding documents in 'alert' - Correction of error in Template variable replacement, resulting in missing template variable value
This commit is contained in:
@@ -56,7 +56,11 @@ def replace_variable_in_template(template: str, variable: str, value: str) -> st
|
|||||||
Returns:
|
Returns:
|
||||||
str: Template with variable placeholder replaced
|
str: Template with variable placeholder replaced
|
||||||
"""
|
"""
|
||||||
return template.replace(variable, value or "")
|
|
||||||
|
current_app.logger.info(f"Replacing variable {variable} with value {value}")
|
||||||
|
modified_template = template.replace(f"{{{variable}}}", value or "")
|
||||||
|
current_app.logger.info(f"Modified template: {modified_template}")
|
||||||
|
return modified_template
|
||||||
|
|
||||||
|
|
||||||
def get_embedding_model_and_class(tenant_id, catalog_id, full_embedding_name="mistral.mistral-embed"):
|
def get_embedding_model_and_class(tenant_id, catalog_id, full_embedding_name="mistral.mistral-embed"):
|
||||||
|
|||||||
@@ -6,6 +6,24 @@
|
|||||||
|
|
||||||
<body class="presentation-page bg-gray-200">
|
<body class="presentation-page bg-gray-200">
|
||||||
{% include 'session_defaults.html' %}
|
{% include 'session_defaults.html' %}
|
||||||
|
|
||||||
|
{# <script>#}
|
||||||
|
{# // Hulpfunctie om URLs te genereren met prefix#}
|
||||||
|
{# function prefixed_url_for(endpoint) {#}
|
||||||
|
{# // Verwijder eventuele dubbele slashes aan het begin#}
|
||||||
|
{# if (endpoint.startsWith('//')) {#}
|
||||||
|
{# endpoint = endpoint.substring(1);#}
|
||||||
|
{# } else if (endpoint.startsWith('/')) {#}
|
||||||
|
{# endpoint = endpoint;#}
|
||||||
|
{# }#}
|
||||||
|
{##}
|
||||||
|
{# // Basis URL van de applicatie (zonder trailing slash)#}
|
||||||
|
{# const baseUrl = window.location.origin;#}
|
||||||
|
{##}
|
||||||
|
{# // Combineer basis URL met endpoint#}
|
||||||
|
{# return `${baseUrl}${endpoint}`;#}
|
||||||
|
{# }#}
|
||||||
|
{# </script>#}
|
||||||
{% include 'navbar.html' %}
|
{% include 'navbar.html' %}
|
||||||
{% include 'header.html' %}
|
{% include 'header.html' %}
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<div class="container-fluid position-relative z-index-2 px-0 py-2 bg-gradient-light">
|
<div class="container-fluid position-relative z-index-2 px-0 py-2 bg-gradient-light">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
@@ -8,7 +9,7 @@
|
|||||||
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
||||||
partner_exchange
|
partner_exchange
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div class="session-default-item" data-url="{{ prefixed_url_for('partner_bp.partners') }}">
|
||||||
<small>
|
<small>
|
||||||
{% if 'partner' in session and session['partner'] %}
|
{% if 'partner' in session and session['partner'] %}
|
||||||
{{ session['partner'].get('id', 'Not selected') }}: {{ session['partner'].get('name', 'None') }}
|
{{ session['partner'].get('id', 'Not selected') }}: {{ session['partner'].get('name', 'None') }}
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
||||||
source_environment
|
source_environment
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div class="session-default-item" data-url="{{ prefixed_url_for('user_bp.tenants') }}">
|
||||||
<small>
|
<small>
|
||||||
{% if 'tenant' in session and session['tenant'] %}
|
{% if 'tenant' in session and session['tenant'] %}
|
||||||
{{ session['tenant'].get('id', 'Not selected') }}: {{ session['tenant'].get('name', 'None') }}
|
{{ session['tenant'].get('id', 'Not selected') }}: {{ session['tenant'].get('name', 'None') }}
|
||||||
@@ -34,13 +35,14 @@
|
|||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<!-- Tenant information (links) - voor andere gebruikers -->
|
<!-- Tenant information (links) - voor andere gebruikers -->
|
||||||
<div class="col-md-6 d-flex align-items-center">
|
<div class="col-md-6 d-flex align-items-center">
|
||||||
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
||||||
source_environment
|
source_environment
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div class="session-default-item" data-url="{{ prefixed_url_for('user_bp.tenants') }}">
|
||||||
<small>
|
<small>
|
||||||
{% if 'tenant' in session and session['tenant'] %}
|
{% if 'tenant' in session and session['tenant'] %}
|
||||||
{{ session['tenant'].get('id', 'Not selected') }}: {{ session['tenant'].get('name', 'None') }}
|
{{ session['tenant'].get('id', 'Not selected') }}: {{ session['tenant'].get('name', 'None') }}
|
||||||
@@ -57,7 +59,7 @@
|
|||||||
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
<span class="material-symbols-outlined me-2" style="font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;">
|
||||||
note_stack
|
note_stack
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div class="session-default-item" data-url="{{ prefixed_url_for('document_bp.catalogs') }}">
|
||||||
<small>
|
<small>
|
||||||
{% if 'catalog_id' in session and session['catalog_id'] %}
|
{% if 'catalog_id' in session and session['catalog_id'] %}
|
||||||
{{ session.get('catalog_id', 'Not selected') }}: {{ session.get('catalog_name', 'None') }}
|
{{ session.get('catalog_id', 'Not selected') }}: {{ session.get('catalog_name', 'None') }}
|
||||||
@@ -71,3 +73,53 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.session-default-item {
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-default-item:hover {
|
||||||
|
background-color: rgba(49, 13, 94, 0.1);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-default-item:hover::after {
|
||||||
|
content: "Klik om te wijzigen";
|
||||||
|
position: absolute;
|
||||||
|
bottom: -25px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: rgba(49, 13, 94, 0.1);
|
||||||
|
color: white;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 10px;
|
||||||
|
white-space: nowrap;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-default-item:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const sessionItems = document.querySelectorAll('.session-default-item');
|
||||||
|
|
||||||
|
sessionItems.forEach(item => {
|
||||||
|
item.addEventListener('click', function() {
|
||||||
|
const targetUrl = this.getAttribute('data-url');
|
||||||
|
if (targetUrl) {
|
||||||
|
window.location.href = targetUrl;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -395,11 +395,11 @@ def add_document():
|
|||||||
return redirect(prefixed_url_for('document_bp.documents_processing'))
|
return redirect(prefixed_url_for('document_bp.documents_processing'))
|
||||||
|
|
||||||
except EveAIException as e:
|
except EveAIException as e:
|
||||||
flash(str(e), 'error')
|
flash(str(e), 'danger')
|
||||||
current_app.logger.error(f"Error adding document: {str(e)}")
|
current_app.logger.error(f"Error adding document: {str(e)}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.error(f'Error adding document: {str(e)}')
|
current_app.logger.error(f'Error adding document: {str(e)}')
|
||||||
flash('An error occurred while adding the document.', 'error')
|
flash('An error occurred while adding the document.', 'danger')
|
||||||
|
|
||||||
return render_template('document/add_document.html', form=form)
|
return render_template('document/add_document.html', form=form)
|
||||||
|
|
||||||
@@ -501,7 +501,7 @@ def handle_document_selection():
|
|||||||
try:
|
try:
|
||||||
doc_id = ast.literal_eval(document_identification).get('value')
|
doc_id = ast.literal_eval(document_identification).get('value')
|
||||||
except (ValueError, AttributeError):
|
except (ValueError, AttributeError):
|
||||||
flash('Invalid document selection.', 'error')
|
flash('Invalid document selection.', 'danger')
|
||||||
return redirect(prefixed_url_for('document_bp.documents'))
|
return redirect(prefixed_url_for('document_bp.documents'))
|
||||||
|
|
||||||
action = request.form['action']
|
action = request.form['action']
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ def get_documents_processing_list_view(catalog_id):
|
|||||||
data.append({
|
data.append({
|
||||||
'id': doc.id,
|
'id': doc.id,
|
||||||
'name': doc.name,
|
'name': doc.name,
|
||||||
'processing': doc.processing,
|
'processing_finished': not doc.processing,
|
||||||
'processing_started_at': doc.processing_started_at.strftime('%Y-%m-%d %H:%M:%S') if doc.processing_started_at else '',
|
'processing_started_at': doc.processing_started_at.strftime('%Y-%m-%d %H:%M:%S') if doc.processing_started_at else '',
|
||||||
'processing_finished_at': doc.processing_finished_at.strftime('%Y-%m-%d %H:%M:%S') if doc.processing_finished_at else '',
|
'processing_finished_at': doc.processing_finished_at.strftime('%Y-%m-%d %H:%M:%S') if doc.processing_finished_at else '',
|
||||||
'processing_error': doc.processing_error,
|
'processing_error': doc.processing_error,
|
||||||
@@ -282,7 +282,7 @@ def get_documents_processing_list_view(catalog_id):
|
|||||||
columns = [
|
columns = [
|
||||||
{'title': 'ID', 'field': 'id', 'width': 80},
|
{'title': 'ID', 'field': 'id', 'width': 80},
|
||||||
{'title': 'Name', 'field': 'name'},
|
{'title': 'Name', 'field': 'name'},
|
||||||
{'title': 'Processing', 'field': 'processing', 'formatter': 'tickCross'},
|
{'title': 'Finished Processing', 'field': 'processing_finished', 'formatter': 'tickCross'},
|
||||||
{'title': 'Start', 'field': 'processing_started_at'},
|
{'title': 'Start', 'field': 'processing_started_at'},
|
||||||
{'title': 'Finish', 'field': 'processing_finished_at'},
|
{'title': 'Finish', 'field': 'processing_finished_at'},
|
||||||
{'title': 'Error', 'field': 'processing_error'},
|
{'title': 'Error', 'field': 'processing_error'},
|
||||||
|
|||||||
Reference in New Issue
Block a user