- RQC output of TRAICIE_SELECTION_SPECIALIST to EveAIDataCapsule

This commit is contained in:
Josako
2025-07-25 04:27:19 +02:00
parent 8a85b4540f
commit ba523a95c5
11 changed files with 338 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy import desc
import ast
from common.models.interaction import Specialist, SpecialistMagicLink, ChatSession
from common.models.interaction import Specialist, SpecialistMagicLink, ChatSession, EveAIDataCapsule
from common.utils.nginx_utils import prefixed_url_for
from eveai_app.views.list_views.list_view_utils import render_list_view
@@ -196,3 +196,51 @@ def get_chat_sessions_list_view():
'table_height': 800
}
def get_eveai_data_capsules_list_view():
"""Generate the EvAI Data Capsules list view configuration"""
# Get all data capsules ordered by creation date (descending)
data_capsules_query = EveAIDataCapsule.query.order_by(desc(EveAIDataCapsule.created_at))
all_data_capsules = data_capsules_query.all()
# Prepare data for Tabulator
data = []
for capsule in all_data_capsules:
data.append({
'id': capsule.id,
'chat_session_id': capsule.chat_session_id,
'type': capsule.type,
'type_version': capsule.type_version,
'created_at': capsule.created_at.strftime('%Y-%m-%d %H:%M:%S') if capsule.created_at else ''
})
# Column definitions
columns = [
{'title': 'ID', 'field': 'id', 'width': 80},
{'title': 'Chat Session ID', 'field': 'chat_session_id'},
{'title': 'Type', 'field': 'type'},
{'title': 'Type Version', 'field': 'type_version'},
{'title': 'Created At', 'field': 'created_at'}
]
# Action definitions
actions = [
{'value': 'view_data_capsule', 'text': 'View Details', 'class': 'btn-primary', 'requiresSelection': True},
{'value': 'view_chat_session', 'text': 'View Chat Session', 'class': 'btn-secondary', 'requiresSelection': True}
]
# Initial sort configuration
initial_sort = [{'column': 'created_at', 'dir': 'desc'}]
return {
'title': 'EvAI Data Capsules',
'data': data,
'columns': columns,
'actions': actions,
'initial_sort': initial_sort,
'table_id': 'eveai_data_capsules_table',
'form_action': url_for('interaction_bp.handle_data_capsule_selection'),
'description': 'View all EvAI Data Capsules',
'table_height': 800
}