diff --git a/eveai_app/errors.py b/eveai_app/errors.py index 4c6f0ec..f726feb 100644 --- a/eveai_app/errors.py +++ b/eveai_app/errors.py @@ -1,4 +1,4 @@ -from flask import render_template, request, jsonify, redirect +from flask import render_template, request, jsonify, redirect, current_app from flask_login import current_user from common.utils.nginx_utils import prefixed_url_for @@ -6,24 +6,28 @@ from common.utils.nginx_utils import prefixed_url_for def not_found_error(error): if not current_user.is_authenticated: return redirect(prefixed_url_for('security.login')) + current_app.logger.error(f"Not Found Error: {error}") return render_template('error/404.html'), 404 def internal_server_error(error): if not current_user.is_authenticated: return redirect(prefixed_url_for('security.login')) + current_app.logger.error(f"Internal Server Error: {error}") return render_template('error/500.html'), 500 def not_authorised_error(error): if not current_user.is_authenticated: return redirect(prefixed_url_for('security.login')) + current_app.logger.error(f"Not Authorised Error: {error}") return render_template('error/401.html') def access_forbidden(error): if not current_user.is_authenticated: return redirect(prefixed_url_for('security.login')) + current_app.logger.error(f"Access Forbidden: {error}") return render_template('error/403.html') @@ -32,6 +36,7 @@ def key_error_handler(error): if str(error) == "'tenant'": return redirect(prefixed_url_for('security.login')) # For other KeyErrors, you might want to log the error and return a generic error page + current_app.logger.error(f"Key Error: {error}") return render_template('error/generic.html', error_message="An unexpected error occurred"), 500 diff --git a/eveai_app/templates/document/library_operations.html b/eveai_app/templates/document/library_operations.html index e1f732c..97152f7 100644 --- a/eveai_app/templates/document/library_operations.html +++ b/eveai_app/templates/document/library_operations.html @@ -10,6 +10,17 @@
+

Create Default RAG Library

+

This function will create a default library setup for RAG purposes. More specifically, it will create:

+
    +
  • A default RAG Catalog
  • +
  • A Default HTML Processor
  • +
  • A default RAG Retriever
  • +
  • A default RAG Specialist
  • +
+

This enables a quick start-up for standard Ask Eve AI functionality. All elements can be changed later on an individual basis.

+ +

Re-Embed Latest Versions

This functionality will re-apply embeddings on the latest versions of all documents in the library. This is useful only while tuning the embedding parameters, or when changing embedding algorithms. @@ -17,6 +28,7 @@ use it with caution!

+

Refresh all documents

This operation will create new versions of all documents in the library with a URL. Documents that were uploaded directly, cannot be automatically refreshed. This is an expensive operation, and impacts the performance of the system in future use. diff --git a/eveai_app/templates/entitlements/view_licenses.html b/eveai_app/templates/entitlements/view_licenses.html index f76534d..3beda2f 100644 --- a/eveai_app/templates/entitlements/view_licenses.html +++ b/eveai_app/templates/entitlements/view_licenses.html @@ -9,13 +9,10 @@ {% block content %} {{ render_selectable_table(headers=["License ID", "Name", "Start Date", "End Date", "Active"], rows=rows, selectable=True, id="licensesTable") }} - - - - - - - +

+ + +
{% endblock %} diff --git a/eveai_app/templates/interaction/view_chat_session.html b/eveai_app/templates/interaction/view_chat_session.html index 568f6ef..53c22ef 100644 --- a/eveai_app/templates/interaction/view_chat_session.html +++ b/eveai_app/templates/interaction/view_chat_session.html @@ -1,6 +1,4 @@ {% extends "base.html" %} -{% from "macros.html" import render_field %} - {% block title %}Session Overview{% endblock %} {% block content_title %}Session Overview{% endblock %} @@ -8,7 +6,7 @@ {% block content %}
-

Chat Session Details

+

Chat Session Details

Session Information
@@ -21,44 +19,73 @@
-

Interactions

+
Interactions
- {% for interaction in interactions %} + {% for interaction, id, question_at, specialist_arguments, specialist_results, specialist_name, specialist_type in interactions %}
-

+

-

+

-
Detailed Question:
-

{{ interaction.detailed_question }}

-
Answer:
-
{{ interaction.answer | safe }}
- {% if embeddings_dict.get(interaction.id) %} -
Related Documents:
-
    - {% for embedding in embeddings_dict[interaction.id] %} -
  • - {% if embedding.url %} - {{ embedding.url }} - {% else %} - {{ embedding.object_name }} - {% endif %} -
  • - {% endfor %} -
+ + {% if specialist_arguments %} +
+
Specialist Arguments:
+
+
{{ specialist_arguments | tojson(indent=2) }}
+
+
+ {% endif %} + + + {% if specialist_results %} +
+
Specialist Results:
+
+
{{ specialist_results | tojson(indent=2) }}
+
+
+ {% endif %} + + + {% if embeddings_dict.get(id) %} +
+
Related Documents:
+
    + {% for embedding in embeddings_dict[id] %} +
  • + {% if embedding.url %} + + link + {{ embedding.url }} + + {% else %} + description + {{ embedding.object_name }} + {% endif %} +
  • + {% endfor %} +
+
{% endif %}
@@ -68,14 +95,166 @@
{% endblock %} +{% block styles %} +{{ super() }} + +{% endblock %} + {% block scripts %} - +{{ super() }} {% endblock %} \ No newline at end of file diff --git a/eveai_app/templates/macros.html b/eveai_app/templates/macros.html index 5538426..d27bc5e 100644 --- a/eveai_app/templates/macros.html +++ b/eveai_app/templates/macros.html @@ -1,3 +1,81 @@ +{% macro render_field_content(field, disabled=False, class='') %} + {% if field.type == 'BooleanField' %} +
+
+ {{ field(class="form-check-input " + class, disabled=disabled) }} + {% if field.description %} + {{ field.label(class="form-check-label", + **{'data-bs-toggle': 'tooltip', + 'data-bs-placement': 'right', + 'title': field.description}) }} + {% if field.flags.required %} + + Required field + {% endif %} + {% else %} + {{ field.label(class="form-check-label") }} + {% if field.flags.required %} + + Required field + {% endif %} + {% endif %} +
+ {% if field.errors %} +
+ {% for error in field.errors %} + {{ error }} + {% endfor %} +
+ {% endif %} +
+ {% else %} +
+ {% if field.description %} + {{ field.label(class="form-label", + **{'data-bs-toggle': 'tooltip', + 'data-bs-placement': 'right', + 'title': field.description}) }} + {% if field.flags.required %} + + Required field + {% endif %} + {% else %} + {{ field.label(class="form-label") }} + {% if field.flags.required %} + + Required field + {% endif %} + {% endif %} + + {% if field.type == 'TextAreaField' and 'json-editor' in class %} +
+ {{ field(class="form-control d-none " + class, disabled=disabled) }} + {% elif field.type == 'SelectField' %} + {{ field(class="form-control form-select " + class, disabled=disabled) }} + {% else %} + {{ field(class="form-control " + class, disabled=disabled) }} + {% endif %} + + {% if field.errors %} +
+ {% for error in field.errors %} + {{ error }} + {% endfor %} +
+ {% endif %} +
+ {% endif %} +{% endmacro %} + + {% macro render_field(field, disabled_fields=[], exclude_fields=[], class='') %} @@ -5,157 +83,14 @@ {% set disabled = field.name in disabled_fields %} {% set exclude_fields = exclude_fields + ['csrf_token', 'submit'] %} {% if field.name not in exclude_fields %} - {% if field.type == 'BooleanField' %} -
-
- {{ field(class="form-check-input " + class, disabled=disabled) }} - {% if field.description %} - {{ field.label(class="form-check-label", - **{'data-bs-toggle': 'tooltip', - 'data-bs-placement': 'right', - 'title': field.description}) }} - {% if field.flags.required %} - - Required field - {% endif %} - {% else %} - {{ field.label(class="form-check-label") }} - {% if field.flags.required %} - - Required field - {% endif %} - {% endif %} -
- {% if field.errors %} -
- {% for error in field.errors %} - {{ error }} - {% endfor %} -
- {% endif %} -
- {% else %} -
- {% if field.description %} - {{ field.label(class="form-label", - **{'data-bs-toggle': 'tooltip', - 'data-bs-placement': 'right', - 'title': field.description}) }} - {% if field.flags.required %} - - Required field - {% endif %} - {% else %} - {{ field.label(class="form-label") }} - {% if field.flags.required %} - - Required field - {% endif %} - {% endif %} - - {% if field.type == 'TextAreaField' and 'json-editor' in class %} -
- {{ field(class="form-control d-none " + class, disabled=disabled) }} - {% elif field.type == 'SelectField' %} - {{ field(class="form-control form-select " + class, disabled=disabled) }} - {% else %} - {{ field(class="form-control " + class, disabled=disabled) }} - {% endif %} - - {% if field.errors %} -
- {% for error in field.errors %} - {{ error }} - {% endfor %} -
- {% endif %} -
- {% endif %} + {{ render_field_content(field, disabled, class) }} {% endif %} {% endmacro %} -{% macro render_included_field(field, disabled_fields=[], include_fields=[]) %} +{% macro render_included_field(field, disabled_fields=[], include_fields=[], class='') %} {% set disabled = field.name in disabled_fields %} {% if field.name in include_fields %} - {% if field.type == 'BooleanField' %} -
- {{ field(class="form-check-input", type="checkbox", id="flexSwitchCheckDefault") }} - {% if field.description %} - {{ field.label(class="form-check-label", - for="flexSwitchCheckDefault", - disabled=disabled, - **{'data-bs-toggle': 'tooltip', - 'data-bs-placement': 'right', - 'title': field.description}) }} - {% if field.flags.required %} - - Required field - {% endif %} - {% else %} - {{ field.label(class="form-check-label", for="flexSwitchCheckDefault", disabled=disabled) }} - {% if field.flags.required %} - - Required field - {% endif %} - {% endif %} -
- {% else %} -
- {% if field.description %} -
- {{ field.label(class="form-label", - **{'data-bs-toggle': 'tooltip', - 'data-bs-placement': 'right', - 'title': field.description}) }} - {% if field.flags.required %} - - Required field - {% endif %} -
- {% else %} -
- {{ field.label(class="form-label") }} - {% if field.flags.required %} - - Required field - {% endif %} -
- {% endif %} - - {% if field.type == 'TextAreaField' and 'json-editor' in field.render_kw.get('class', '') %} -
- {{ field(class="form-control d-none", disabled=disabled) }} - {% elif field.type == 'SelectField' %} - {{ field(class="form-control form-select", disabled=disabled) }} - {% else %} - {{ field(class="form-control", disabled=disabled) }} - {% endif %} - - {% if field.errors %} -
- {% for error in field.errors %} - {{ error }} - {% endfor %} -
- {% endif %} -
- {% endif %} + {{ render_field_content(field, disabled, class) }} {% endif %} {% endmacro %} diff --git a/eveai_app/templates/navbar.html b/eveai_app/templates/navbar.html index 8515f32..2528e1b 100644 --- a/eveai_app/templates/navbar.html +++ b/eveai_app/templates/navbar.html @@ -109,7 +109,7 @@ {'name': 'License Tier Registration', 'url': '/entitlements/license_tier', 'roles': ['Super User']}, {'name': 'All License Tiers', 'url': '/entitlements/view_license_tiers', 'roles': ['Super User']}, {'name': 'Trigger Actions', 'url': '/administration/trigger_actions', 'roles': ['Super User']}, - {'name': 'All Licenses', 'url': 'entitlements/view_licenses', 'roles': ['Super User', 'Tenant Admin']}, + {'name': 'All Licenses', 'url': '/entitlements/view_licenses', 'roles': ['Super User', 'Tenant Admin']}, {'name': 'Usage', 'url': '/entitlements/view_usages', 'roles': ['Super User', 'Tenant Admin']}, ]) }} {% endif %} diff --git a/eveai_app/templates/user/tenant.html b/eveai_app/templates/user/tenant.html index 7e624b3..77601a1 100644 --- a/eveai_app/templates/user/tenant.html +++ b/eveai_app/templates/user/tenant.html @@ -9,65 +9,12 @@ {% block content %}
{{ form.hidden_tag() }} - - {% set main_fields = ['name', 'website', 'default_language', 'allowed_languages', 'timezone','rag_context', 'type'] %} + {% set disabled_fields = [] %} + {% set exclude_fields = [] %} {% for field in form %} - {{ render_included_field(field, disabled_fields=[], include_fields=main_fields) }} + {{ render_field(field, disabled_fields, exclude_fields) }} {% endfor %} - -
-
- -
- -
- {% set model_fields = ['embedding_model', 'llm_model'] %} - {% for field in form %} - {{ render_included_field(field, disabled_fields=[], include_fields=model_fields) }} - {% endfor %} -
- -
- {% set license_fields = ['currency', 'usage_email', ] %} - {% for field in form %} - {{ render_included_field(field, disabled_fields=[], include_fields=license_fields) }} - {% endfor %} - -
- - -
- - - -
-
-
-
{% endblock %} @@ -78,88 +25,6 @@ {% endblock %} {% block scripts %} -