Skip to content

Commit f5ea3ea

Browse files
committed
description and tags for use cases | performance upgrade for database loading | create custom prompt now takes example as list of dictionries as well
1 parent 011ee82 commit f5ea3ea

File tree

6 files changed

+399
-574
lines changed

6 files changed

+399
-574
lines changed

app/core/config.py

Lines changed: 194 additions & 356 deletions
Large diffs are not rendered by default.

app/core/database.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,39 @@ def get_all_generate_metadata(self) -> List[Dict]:
821821
print(f"Error retrieving all metadata: {str(e)}")
822822
return []
823823

824+
def get_paginated_generate_metadata_light(self, page: int, page_size: int) -> Tuple[int, List[Dict]]:
825+
"""Retrieve paginated metadata with only fields needed for list view"""
826+
try:
827+
with self.get_connection() as conn:
828+
conn.row_factory = sqlite3.Row
829+
cursor = conn.cursor()
830+
831+
# Get total count
832+
count_query = "SELECT COUNT(*) FROM generation_metadata"
833+
cursor.execute(count_query)
834+
total_count = cursor.fetchone()[0]
835+
836+
# Get only fields needed for list view
837+
offset = (page - 1) * page_size
838+
query = """
839+
SELECT
840+
id, timestamp, display_name, generate_file_name, model_id,
841+
num_questions, total_count, use_case, job_status,
842+
local_export_path, hf_export_path, completed_rows
843+
FROM generation_metadata
844+
ORDER BY timestamp DESC
845+
LIMIT ? OFFSET ?
846+
"""
847+
cursor.execute(query, (page_size, offset))
848+
849+
results = [dict(row) for row in cursor.fetchall()]
850+
return total_count, results
851+
852+
except Exception as e:
853+
print(f"Error retrieving paginated metadata: {str(e)}")
854+
return 0, []
855+
856+
824857
def get_paginated_generate_metadata(self, page: int, page_size: int) -> Tuple[int, List[Dict]]:
825858
"""Retrieve paginated metadata entries for generations"""
826859
try:

0 commit comments

Comments
 (0)