Add get_available_models function

- Added function to retrieve only available models for frontend/API use
parent 357f1b96
...@@ -1910,6 +1910,16 @@ def get_all_models() -> List[Dict[str, Any]]: ...@@ -1910,6 +1910,16 @@ def get_all_models() -> List[Dict[str, Any]]:
return [dict(row) for row in rows] return [dict(row) for row in rows]
def get_available_models() -> List[Dict[str, Any]]:
"""Get all available models."""
conn = get_db_connection()
cursor = conn.cursor()
cursor.execute('SELECT * FROM models WHERE available = 1 ORDER BY name')
rows = cursor.fetchall()
conn.close()
return [dict(row) for row in rows]
def create_model(name: str, model_type: str, path: str, vram_estimate: int = 0, available: bool = False) -> bool: def create_model(name: str, model_type: str, path: str, vram_estimate: int = 0, available: bool = False) -> bool:
"""Create a new model.""" """Create a new model."""
conn = get_db_connection() conn = get_db_connection()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment