chore(deps): update pre-commit config and apply bulk formatting

- build(pre-commit): upgrade hooks (django-upgrade 1.29.1, uv 0.9.7, ruff 0.14.3, bandit 1.8.6)
- build(pre-commit): add uv-lock hook, tombi TOML formatter, prettier-plugin-packagejson
- build(pre-commit): disable Django check hooks (commented out)
- build(pre-commit): switch npx → bunx for prettier execution
- build(node): add bun.lock, update prettier config with schema + packagejson plugin
- style: apply ruff format to all Python files (comments, spacing, imports)
- style: apply prettier format to all JS/CSS files (comment styles, spacing)
- style: apply tombi format to pyproject.toml (reordered sections, consistent formatting)
- chore: remove emoji from bash script comments for consistency

BREAKING CHANGE: Django check and migration check hooks disabled in pre-commit config
This commit is contained in:
2025-11-05 14:34:08 +01:00
parent b1b5207888
commit c106792e78
35 changed files with 615 additions and 328 deletions

View File

@@ -1,2 +1,3 @@
# dashboard/management/__init__.py
# This file is intentionally left empty to mark the directory as a Python package

View File

@@ -1,2 +1,3 @@
# dashboard/management/commands/__init__.py
# This file is intentionally left empty to mark the directory as a Python package

View File

@@ -1,2 +1,3 @@
# dashboard/templatetags/__init__.py
# This file is intentionally left empty to mark the directory as a Python package

View File

@@ -200,12 +200,10 @@ def chat_session_detail_view(request, session_id):
# Check if this is an AJAX navigation request
if is_ajax_navigation(request):
html_content = render_to_string("dashboard/chat_session_detail.html", context, request=request)
return JsonResponse(
{
"html": html_content,
"title": f"Chat Session {session_id} | Chat Analytics",
}
)
return JsonResponse({
"html": html_content,
"title": f"Chat Session {session_id} | Chat Analytics",
})
return render(request, "dashboard/chat_session_detail.html", context)
@@ -282,12 +280,10 @@ def edit_dashboard_view(request, dashboard_id):
# Check if this is an AJAX navigation request
if is_ajax_navigation(request):
html_content = render_to_string("dashboard/dashboard_form.html", context, request=request)
return JsonResponse(
{
"html": html_content,
"title": f"Edit Dashboard: {dashboard.name} | Chat Analytics",
}
)
return JsonResponse({
"html": html_content,
"title": f"Edit Dashboard: {dashboard.name} | Chat Analytics",
})
return render(request, "dashboard/dashboard_form.html", context)
@@ -349,6 +345,8 @@ def delete_data_source_view(request, data_source_id):
# API views for dashboard data
@login_required
def dashboard_data_api(request, dashboard_id):
"""API endpoint for dashboard data"""
@@ -450,26 +448,24 @@ def search_chat_sessions(request):
# Check if this is an AJAX pagination request
if request.headers.get("X-Requested-With") == "XMLHttpRequest":
return JsonResponse(
{
"status": "success",
"html_data": render(request, "dashboard/partials/search_results_table.html", context).content.decode(
"utf-8"
),
"page_obj": {
"number": page_obj.number,
"has_previous": page_obj.has_previous(),
"has_next": page_obj.has_next(),
"previous_page_number": page_obj.previous_page_number() if page_obj.has_previous() else None,
"next_page_number": page_obj.next_page_number() if page_obj.has_next() else None,
"paginator": {
"num_pages": page_obj.paginator.num_pages,
"count": page_obj.paginator.count,
},
return JsonResponse({
"status": "success",
"html_data": render(request, "dashboard/partials/search_results_table.html", context).content.decode(
"utf-8"
),
"page_obj": {
"number": page_obj.number,
"has_previous": page_obj.has_previous(),
"has_next": page_obj.has_next(),
"previous_page_number": page_obj.previous_page_number() if page_obj.has_previous() else None,
"next_page_number": page_obj.next_page_number() if page_obj.has_next() else None,
"paginator": {
"num_pages": page_obj.paginator.num_pages,
"count": page_obj.paginator.count,
},
"query": query,
}
)
},
"query": query,
})
return render(request, "dashboard/search_results.html", context)
@@ -554,26 +550,24 @@ def data_view(request):
# Check if this is an AJAX pagination request
if request.headers.get("X-Requested-With") == "XMLHttpRequest":
return JsonResponse(
{
"status": "success",
"html_data": render(request, "dashboard/partials/data_table.html", context).content.decode("utf-8"),
"page_obj": {
"number": page_obj.number,
"has_previous": page_obj.has_previous(),
"has_next": page_obj.has_next(),
"previous_page_number": page_obj.previous_page_number() if page_obj.has_previous() else None,
"next_page_number": page_obj.next_page_number() if page_obj.has_next() else None,
"paginator": {
"num_pages": page_obj.paginator.num_pages,
"count": page_obj.paginator.count,
},
return JsonResponse({
"status": "success",
"html_data": render(request, "dashboard/partials/data_table.html", context).content.decode("utf-8"),
"page_obj": {
"number": page_obj.number,
"has_previous": page_obj.has_previous(),
"has_next": page_obj.has_next(),
"previous_page_number": page_obj.previous_page_number() if page_obj.has_previous() else None,
"next_page_number": page_obj.next_page_number() if page_obj.has_next() else None,
"paginator": {
"num_pages": page_obj.paginator.num_pages,
"count": page_obj.paginator.count,
},
"view": view,
"avg_response_time": avg_response_time,
"avg_messages": avg_messages,
"escalation_rate": escalation_rate,
}
)
},
"view": view,
"avg_response_time": avg_response_time,
"avg_messages": avg_messages,
"escalation_rate": escalation_rate,
})
return render(request, "dashboard/data_view.html", context)

View File

@@ -91,51 +91,47 @@ def export_chats_csv(request):
writer = csv.writer(response)
# Write CSV header
writer.writerow(
[
"Session ID",
"Start Time",
"End Time",
"IP Address",
"Country",
"Language",
"Messages Sent",
"Sentiment",
"Escalated",
"Forwarded HR",
"Full Transcript",
"Avg Response Time (s)",
"Tokens",
"Tokens EUR",
"Category",
"Initial Message",
"User Rating",
]
)
writer.writerow([
"Session ID",
"Start Time",
"End Time",
"IP Address",
"Country",
"Language",
"Messages Sent",
"Sentiment",
"Escalated",
"Forwarded HR",
"Full Transcript",
"Avg Response Time (s)",
"Tokens",
"Tokens EUR",
"Category",
"Initial Message",
"User Rating",
])
# Write data rows
for session in sessions:
writer.writerow(
[
session.session_id,
session.start_time,
session.end_time,
session.ip_address,
session.country,
session.language,
session.messages_sent,
session.sentiment,
"Yes" if session.escalated else "No",
"Yes" if session.forwarded_hr else "No",
session.full_transcript,
session.avg_response_time,
session.tokens,
session.tokens_eur,
session.category,
session.initial_msg,
session.user_rating,
]
)
writer.writerow([
session.session_id,
session.start_time,
session.end_time,
session.ip_address,
session.country,
session.language,
session.messages_sent,
session.sentiment,
"Yes" if session.escalated else "No",
"Yes" if session.forwarded_hr else "No",
session.full_transcript,
session.avg_response_time,
session.tokens,
session.tokens_eur,
session.category,
session.initial_msg,
session.user_rating,
])
return response