feat: Refactor code for better structure and UX #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the codebase to improve its structure, maintainability, and user experience. The changes include:
Major Improvements:
0_API_KEY.py
,functions.py
,pages/1_UPLOAD_PDF.py
,pages/2_CHAT_WITH_PDF.py
) to separate concerns and improve readability. This makes the code easier to understand, maintain, and extend.Specific Changes:
0_API_KEY.py
): The API key input and validation logic is now more robust and user-friendly.functions.py
): Common functions related to UI elements, document processing, and query engine setup are now organized into a dedicated module. The sidebar elements are now managed by aSidebarManager
class.pages/1_UPLOAD_PDF.py
): The page now supports multiple PDF uploads and allows users to select the OpenAI model and temperature settings.pages/2_CHAT_WITH_PDF.py
): The chat interface is more robust, with improved error handling and a more user-friendly design. The chat history is now managed more efficiently.These changes significantly improve the overall quality, maintainability, and user experience of the application. The modular design makes it easier to add new features and maintain the codebase in the long term. The improved error handling and logging make debugging and troubleshooting much simpler.