-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor api server by split it to smaller files #880
Conversation
- Added 'future' package - Removed 'networkx' package - Cleaned up commented sections - Maintained core dependencies - Simplified requirements structure
- Added FileResponse for webui root endpoint - Enabled directory check in StaticFiles mount - Improved webui static file handling - Ensured webui directory existence - Simplified webui access with root endpoint
- Added content fallback to content_summary - Handled missing fields gracefully - Made data copy to avoid modification - Added error logging for missing fields - Improved code readability and robustness
- Move parse_args and display_splash_screen functions from lightrag_server.py to utils_api.py - Move OllamaServerInfos class and instance from ollama_api.py to utils_api.py
- Fix refactoring error on pipeline_index_file - Delete unsed func: scan_directory - Add type hints of rag for better maintainability - Refine comments for better understanding
• Add rag param to function call • Fix argument mismatch error • Ensure proper pipeline execution
Hello, in this refactor. Could you extract Ollama please? Thanks 🙏🏻 |
without dependency on Ollama? I can't get the points. API server just emulates an Ollama model for LightRAG, so chat frontend supporting Ollama API can use LightRAG directly. |
I mean it is not possible to use the default defined LLM, otherwise if it is not defined use ollama? |
Previously, the set_logger function would always set the log level to DEBUG, overriding any user-specified log level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice step forward
return default | ||
|
||
|
||
def display_splash_screen(args: argparse.Namespace) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.
Where did you move this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK found it
|
||
# database packages | ||
networkx | ||
future |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approove
@@ -57,11 +57,17 @@ async def __aexit__(self, exc_type, exc, tb): | |||
logging.getLogger("httpx").setLevel(logging.WARNING) | |||
|
|||
|
|||
def set_logger(log_file: str): | |||
logger.setLevel(logging.DEBUG) | |||
def set_logger(log_file: str, level: int = logging.DEBUG): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
for k, v in self._data.items() | ||
if v["status"] == status.value | ||
} | ||
result = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
@@ -0,0 +1,554 @@ | |||
""" | |||
Utility functions for the LightRAG API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK found it!
Nice
Description
Refactor api server by split it to smaller files.
Changes Made
Refactor lightrag_server.py by by split it to smaller files, an put it in
./routes
Improve document status retrieval with content fallback for legacy storage file compatibility.
Change progress_lock for document scan from threading.Lock() to asyncio.Lock
Respect user-specified log level in set_logger
Checklist
Additional Notes
none