Make the chat empty-state greeting configurable via CHAT_GREETING#227
Open
noramxiao wants to merge 2 commits into
Open
Make the chat empty-state greeting configurable via CHAT_GREETING#227noramxiao wants to merge 2 commits into
noramxiao wants to merge 2 commits into
Conversation
The empty-state greeting in e2e-chatbot-app-next was hardcoded to "What would you like to know?" in greeting.tsx, forcing downstream template users to patch the shared frontend for a common customization. Surface it through the existing /api/config mechanism: the server now returns a `greeting` field sourced from the CHAT_GREETING env var, and the Greeting component reads it from AppConfigContext, falling back to the previous default when unset. Documented the new var in .env.example. Fixes #177 Co-authored-by: Isaac
Verifies /api/config omits greeting when CHAT_GREETING is unset (client falls back to the default). Part of #177. Co-authored-by: Isaac
Author
Verified locallyInstalled deps and ran the toolchain on this branch:
So the change is functionally verified (route tests green) without introducing new lint/type violations. |
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.
Problem
The empty-state greeting in
e2e-chatbot-app-nextis hardcoded to "What would you like to know?" inclient/src/components/greeting.tsx. Because this frontend is the shared chat UI used by the agent templates, customizing the greeting (a very common ask) currently requires patching the shared frontend instead of simple configuration. Reported in #177.Change
Surface the greeting through the existing
/api/configmechanism (the same one used forfeedback/chatHistoryflags):server/src/routes/config.ts—/api/confignow returnsgreeting: process.env.CHAT_GREETING || undefined.client/src/contexts/AppConfigContext.tsx— addsgreetingto the config type/context, defaulting toDEFAULT_GREETING("What would you like to know?") when unset.client/src/components/greeting.tsx— rendersuseAppConfig().greetinginstead of the hardcoded string..env.example— documents the new optionalCHAT_GREETINGvar.Backward compatible: with
CHAT_GREETINGunset, the UI shows the exact same default as before.Testing
I could not run
npm run lint/npm testin my environment (no network to the npm registry, deps not installed). The change is small and mirrors the existingfeedbackEnabled/chatHistoryEnabledconfig plumbing, but a maintainer should run the Biome lint + Playwright tests before merge.Out of scope: the chat input placeholder (
elements/prompt-input.tsx) uses the same default string — could be wired toCHAT_GREETINGtoo in a follow-up if desired.Fixes #177