fix: Adjust asset resource lookup and set .env path#1067
Merged
Conversation
Use the package assets root (files("tui._assets") / "subdir") when locating sample documents and flows instead of the previous dotted resource path. Add logic to persist the resolved documents directory into OPENRAG_DOCUMENTS_PATH in the .env file (via dotenv.set_key) when the config is empty or still set to common defaults, so Docker Compose volume mounts point to the actual copied PDFs. All writes are guarded with try/except and logged as debug to avoid breaking startup on failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Use the package assets root (files("tui._assets") / "subdir") when locating sample documents and flows instead of the previous dotted resource path. Add logic to persist the resolved documents directory into OPENRAG_DOCUMENTS_PATH in the .env file (via dotenv.set_key) when the config is empty or still set to common defaults, so Docker Compose volume mounts point to the actual copied PDFs. All writes are guarded with try/except and logged as debug to avoid breaking startup on failure.
This pull request updates the logic for copying sample documents and flows in
src/tui/main.pyto improve asset discovery and environment configuration. The changes ensure that assets are found correctly and that the application's environment is set up more robustly, particularly for Docker Compose deployments.Asset discovery improvements:
files()to reference the parenttui._assetsdirectory and then access subdirectories with/ "openrag-documents"and/ "flows". This makes asset discovery more reliable and compatible with the latest importlib resources API. [1] [2]Environment configuration enhancements:
OPENRAG_DOCUMENTS_PATHvariable in the.envfile to the resolved documents directory if it is unset or set to a default value. This helps Docker Compose mount the correct volume and ensures the application can always find the sample documents.