Skip to content

fix: Adjust asset resource lookup and set .env path#1067

Merged
edwinjosechittilappilly merged 1 commit into
mainfrom
fix-main-tui
Mar 5, 2026
Merged

fix: Adjust asset resource lookup and set .env path#1067
edwinjosechittilappilly merged 1 commit into
mainfrom
fix-main-tui

Conversation

@edwinjosechittilappilly

Copy link
Copy Markdown
Collaborator

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.py to 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:

  • Changed how asset files are located by updating the usage of files() to reference the parent tui._assets directory 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:

  • Added logic to automatically update the OPENRAG_DOCUMENTS_PATH variable in the .env file 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.

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.

@lucaseduoli lucaseduoli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@github-actions github-actions Bot added backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. lgtm labels Mar 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@edwinjosechittilappilly edwinjosechittilappilly merged commit ee0500f into main Mar 5, 2026
13 checks passed
@github-actions github-actions Bot deleted the fix-main-tui branch March 5, 2026 17:57
@mpawlow mpawlow removed their request for review March 5, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants