Skip to content

Commit b8e4bdc

Browse files
committed
Updated package v4.18
1 parent dbebfac commit b8e4bdc

File tree

7 files changed

+432
-270
lines changed

7 files changed

+432
-270
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
All notable changes to LocalLab will be documented in this file.
44

5+
## 0.4.18 - 2025-03-11
6+
7+
### Fixed
8+
9+
- Fixed import error: "cannot import name 'get_system_info' from 'locallab.utils.system'"
10+
- Added backward compatibility function for system information retrieval
11+
- Ensured proper display of system resources during server startup
12+
- Enhanced compatibility between UI components and system utilities
13+
- Improved error handling during server startup display
14+
- Added graceful error recovery for UI component failures
15+
- Ensured server continues to run even if display components fail
16+
- Enhanced robustness of startup process with comprehensive error handling
17+
- Added fallback mechanisms for all UI components to handle import errors
18+
- Improved system resource display with multiple fallback options
19+
- Enhanced model information display with graceful degradation
20+
- Ensured server can start even with missing or incompatible dependencies
21+
22+
### Added
23+
24+
- Added minimal mode fallback server for critical initialization failures
25+
- Implemented comprehensive error handling for configuration loading
26+
- Created fallback endpoints for basic server functionality
27+
- Added detailed error reporting in minimal mode
28+
- Enhanced server resilience with multi-level fallback mechanisms
29+
530
## 0.4.17 - 2025-03-11
631

732
### Fixed

locallab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
LocalLab - A lightweight AI inference server for running LLMs locally
33
"""
44

5-
__version__ = "0.4.17"
5+
__version__ = "0.4.18"
66

77
# Only import what's necessary initially, lazy-load the rest
88
from .logger import get_logger

locallab/core/minimal.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""
2+
Minimal FastAPI app for fallback when the main app fails to load.
3+
This provides basic functionality to indicate that the server is running
4+
but in a degraded state.
5+
"""
6+
7+
from fastapi import FastAPI, HTTPException
8+
from pydantic import BaseModel
9+
from typing import Dict, Any, List, Optional
10+
11+
# Create a minimal FastAPI app
12+
app = FastAPI(
13+
title="LocalLab (Minimal Mode)",
14+
description="LocalLab server running in minimal mode due to initialization errors",
15+
version="0.4.18"
16+
)
17+
18+
class StatusResponse(BaseModel):
19+
status: str
20+
message: str
21+
version: str
22+
23+
@app.get("/", response_model=StatusResponse)
24+
async def root():
25+
"""Root endpoint that returns basic server status."""
26+
return {
27+
"status": "minimal",
28+
"message": "LocalLab server is running in minimal mode due to initialization errors. Check logs for details.",
29+
"version": "0.4.18"
30+
}
31+
32+
@app.get("/health", response_model=StatusResponse)
33+
async def health():
34+
"""Health check endpoint."""
35+
return {
36+
"status": "minimal",
37+
"message": "LocalLab server is running in minimal mode. Limited functionality available.",
38+
"version": "0.4.18"
39+
}
40+
41+
@app.get("/status", response_model=StatusResponse)
42+
async def status():
43+
"""Status endpoint that provides more detailed information."""
44+
return {
45+
"status": "minimal",
46+
"message": "LocalLab server is running in minimal mode. The main application failed to initialize. Check server logs for details.",
47+
"version": "0.4.18"
48+
}
49+
50+
class ErrorResponse(BaseModel):
51+
error: str
52+
message: str
53+
54+
@app.get("/generate", response_model=ErrorResponse)
55+
async def generate():
56+
"""Generate endpoint that returns an error message."""
57+
raise HTTPException(
58+
status_code=503,
59+
detail="Text generation is not available in minimal mode. Server is running with limited functionality due to initialization errors."
60+
)
61+
62+
@app.get("/models", response_model=Dict[str, List[str]])
63+
async def models():
64+
"""Models endpoint that returns an empty list."""
65+
return {
66+
"models": [],
67+
"message": "Model information is not available in minimal mode."
68+
}
69+
70+
@app.get("/system", response_model=Dict[str, Any])
71+
async def system():
72+
"""System endpoint that returns minimal system information."""
73+
import platform
74+
import psutil
75+
76+
try:
77+
return {
78+
"status": "minimal",
79+
"python_version": platform.python_version(),
80+
"platform": platform.platform(),
81+
"cpu_count": psutil.cpu_count(),
82+
"memory_percent": psutil.virtual_memory().percent,
83+
"message": "Server is running in minimal mode with limited functionality."
84+
}
85+
except Exception:
86+
return {
87+
"status": "minimal",
88+
"message": "System information is not available in minimal mode."
89+
}

0 commit comments

Comments
 (0)