mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-18 21:15:16 +02:00
truncate document processing notification titles
This commit is contained in:
parent
a987ef81b2
commit
5d3079c2e6
1 changed files with 9 additions and 2 deletions
|
|
@ -6,6 +6,8 @@ import hashlib
|
|||
from datetime import UTC, datetime
|
||||
from typing import Any
|
||||
|
||||
from app.notifications.service.messages.text import format_title
|
||||
|
||||
|
||||
def operation_id(document_type: str, filename: str, search_space_id: int) -> str:
|
||||
"""Build a unique id for a document processing run."""
|
||||
|
|
@ -14,6 +16,11 @@ def operation_id(document_type: str, filename: str, search_space_id: int) -> str
|
|||
return f"doc_{document_type}_{search_space_id}_{timestamp}_{filename_hash}"
|
||||
|
||||
|
||||
def started_title(document_name: str) -> str:
|
||||
"""Title shown when document processing is queued."""
|
||||
return format_title("Processing: ", document_name)
|
||||
|
||||
|
||||
def progress(
|
||||
stage: str,
|
||||
stage_message: str | None = None,
|
||||
|
|
@ -44,11 +51,11 @@ def completion(
|
|||
) -> tuple[str, str, str, dict[str, Any]]:
|
||||
"""Compute the final title, message, status, and metadata for a finished run."""
|
||||
if error_message:
|
||||
title = f"Failed: {document_name}"
|
||||
title = format_title("Failed: ", document_name)
|
||||
message = f"Processing failed: {error_message}"
|
||||
status = "failed"
|
||||
else:
|
||||
title = f"Ready: {document_name}"
|
||||
title = format_title("Ready: ", document_name)
|
||||
message = "Now searchable!"
|
||||
status = "completed"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue