Refactor processing logic and enhance error handling

- Cleaned up code in processing.py by removing inline semicolons and improving readability.
- Updated upsert_file_relation calls to ensure consistent handling of file relations.
- Enhanced query_file_relations in db_schema.py to support filtering by file existence.
- Improved API error handling in index.ts with user-friendly messages for 401 and 403 errors.
- Added online/offline status tracking in Layout.vue.
- Implemented debounced search functionality across multiple views to optimize performance.
- Introduced loading skeletons in Dashboard.vue for better user experience during data fetching.
- Enhanced file preview cleanup logic in Images.vue, Orders.vue, and Tables.vue to prevent memory leaks.
- Updated global styles to include new loading and notification animations.
This commit is contained in:
2026-05-12 18:37:23 +08:00
parent 81bafaf557
commit e441ac82a8
20 changed files with 455 additions and 76 deletions
+7
View File
@@ -53,6 +53,7 @@ class MemoryListResponse(BaseModel):
total: int
page: int
page_size: int
stats: Optional[Dict] = None
def _get_db():
@@ -96,11 +97,17 @@ async def list_memory(
start = (page - 1) * page_size
page_items = results[start:start + page_size]
# Compute confidence stats from all results (not just current page)
high = sum(1 for r in results if r.get("confidence", 0) > 50)
medium = sum(1 for r in results if 10 <= r.get("confidence", 0) <= 50)
low = sum(1 for r in results if r.get("confidence", 0) < 10)
return MemoryListResponse(
items=[_row_to_item(r) for r in page_items],
total=total,
page=page,
page_size=page_size,
stats={"high": high, "medium": medium, "low": low, "total": total},
)