-
Notifications
You must be signed in to change notification settings - Fork 0
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
Pr for arbitrary html header injection for chainlit pai 362 #1
Pr for arbitrary html header injection for chainlit pai 362 #1
Conversation
@dokterbob As DMed, I'm unable to get Chainlit running locally on my system. I'm trying various ways to get this working but struggling a bit. Request your guidance here. Meanwhile, I have did my best to ensure no obvious errors in the code. |
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.
The first task here is, specifically, to leave existing functionality unmodified. That is, any pre-existing configuration options should stay working as they are.
That means all the config.ui.custom_js
, config.ui.custom_css
etc. configuration options should function exactly they way they did before. This is a hard requirement to having our code merged into chainlit: to maintain compatibility to prevent other people's setups breaking.
Only when we implement the templating, do we create a second PR with an additional configuration option, something like config.ui.custom_headers
, which, when set, will replace/disable all these other configuration options.
Note that, your PR should not be against main
of our own fork but rather against the main branch of the chainlit
repo, where you can engage directly with the maintainers of chainlit (I am happy to mentor you and/or provide an initial review there).
Hey @dokterbob , i'm clear on all other changes. I'll start working on those asap. However, i'm not 100% clear on the above quoted part. Also, in meanwhile, we'll continue working on this forked repo and we'll update in use this repo for our application? |
@dokterbob On further investigation, I found out that there are many steps involved in setting us this package. Here's what i found from build workflow (ref - https://github.com/Chainlit/chainlit/actions/runs/9941863666/workflow) in Chainlit repo - My understand here is that first we need to Build chainlit using
I'm looking for an approach this build the package. |
We'll create 2 PR's towards chainlit:
We're now focusing on 1. We split them to:
|
I think your analysis is correct. The 'proper' way for them to do this is to execute the NPM build as part of the Python package installation. Instead, it seems they seem to do this as part of the CI process only. For now, doing it 'by hand' seems to be the solution. The simplest seems to be, once you've installed the package as 'editable', to call the (p)npm commands specified. This should produce the required frontend directory. If you experience any issues with this, I am available tomorrow to take a shot at it. Please feel free to throw me error dumps over Slack, it's where I'm the most responsive. |
One more thing; you might want to change the name of |
I was able to solve it Mathijs. I made a simple script to do it ! It replicates the steps given under Chainlit's production workflow locally. By doing so, i'm able to build the wheel and use that in poetry for installation. This is working just fine. :-D |
9dd1eb5
to
5298c72
Compare
Hey @dokterbob, We have custom headers. Made the changes instructed by you. I was not able to change the index.html to index.html.j2. I got error - "Could not resolve entry module "index.html"." I checked and update all references, but still the error persists. Please suggest if it's a critical component, and i should invest more time on this. Kindly review. I really appreciate your patience with me on this ticket 😃🙏🏻.
|
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.
Getting there!
Apart from the specific comments, it's essential that you check whether generated index.html
as served from chainlit is (apart from whitespace) exactly equal as chainlit's one.
To test that: run chainlit from main, wget
the index (/
, I guess), then do that again from your branch and run a diff.
Also, I feel silly, I erroneously asked you to change something that was already in chainlit, which is perhaps better not to do (as it'll break backwards compatibility).
This is also achieved @dokterbob . Both index files are 100% same. |
@dokterbob In respect of your time🙏🏻, here's a brief for your review -
Please suggest - |
Implemented Jinja2 for dynamic header injection for Chainlit.
Refer to issue - Chainlit#1091