Fix get_build_dir when custom_build is enabled #1500
+22
−15
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.
Hello,
I've noticed that when
custom_build
is set in the configuration, theget_build_dir
function doesn’t uselocal_target
orpackaged_target
at all, causing Chainlit to return the same build path for bothbuild_dir
andcopilot_build_dir
. As a result, the static mount "/copilot" (server.py, line 225) does not point to the copilot directory, and the/copilot/index.js
route doesn’t exist, making the copilot unavailable.Currently, users can work around this by moving the copilot
index.js
file into the frontend’sdist
folder. However, I believe it would be better to maintain the same structure as the one of the package, with separate folders for each component. Also, I don't feel it is necessary to have two separate (yet the same) parameters for theget_build_dir
function.Example structure:
Before:
custom_build = "build" → doesn’t work at all
custom_build = "build/frontend/dist" → frontend works, copilot doesn’t (unless we move index.js to it)
After:
custom_build = "build" → both work (and seems more natural to me)
Feel free to modify the way I’ve implemented it if you see a better approach! :)
P.S. Haven't created any new tests, as at first glance the function didn't seem to be used elsewhere.