feat(ui): configurable headline and subtitle via env vars#1350
feat(ui): configurable headline and subtitle via env vars#1350opspawn wants to merge 4 commits intokagent-dev:mainfrom
Conversation
Add support for two optional environment variables: - NEXT_PUBLIC_HEADLINE: Replaces the default "Start a conversation" text shown in the chat interface before the first message - NEXT_PUBLIC_SUBTITLE: Optional tagline displayed below the "Agents" heading on the landing page When env vars are not set, behavior is identical to before. Closes kagent-dev#1345 Signed-off-by: opspawn <opspawn@users.noreply.github.com>
93c706a to
fbf8d12
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for customizing two UI strings via environment variables, enabling deployments to override the default chat greeting and optionally display a subtitle on Agents/landing pages.
Changes:
- Add optional
headlineprop toChatInterfaceand render it in the empty-chat state. - Add optional
subtitleprop toAgentListand render it beneath the “Agents” heading when provided. - Read
NEXT_PUBLIC_HEADLINE/NEXT_PUBLIC_SUBTITLEfrom app routes and pass through to components; force dynamic rendering via root layout.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/components/chat/ChatInterface.tsx | Accepts headline?: string and uses it instead of a hardcoded empty-chat heading. |
| ui/src/components/AgentList.tsx | Accepts subtitle?: string and conditionally renders it under the Agents heading. |
| ui/src/app/page.tsx | Reads NEXT_PUBLIC_SUBTITLE and passes it to AgentList on the root page. |
| ui/src/app/agents/page.tsx | Reads NEXT_PUBLIC_SUBTITLE and passes it to AgentList on the agents page. |
| ui/src/app/layout.tsx | Forces dynamic rendering (intended to enable runtime env-var reads). |
| ui/src/app/agents/[namespace]/[name]/chat/page.tsx | Reads NEXT_PUBLIC_HEADLINE and passes it to ChatInterface for new chats. |
| ui/src/app/agents/[namespace]/[name]/chat/[chatId]/page.tsx | Reads NEXT_PUBLIC_HEADLINE and passes it to ChatInterface for existing chats. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export default function ChatPageView({ params }: { params: Promise<{ name: string; namespace: string; chatId: string }> }) { | ||
| const { name, namespace, chatId } = use(params); | ||
| const headline = process.env.NEXT_PUBLIC_HEADLINE; | ||
|
|
There was a problem hiding this comment.
This page is a client component ("use client"), so process.env.NEXT_PUBLIC_HEADLINE will be inlined at build time in the browser bundle and won’t support runtime env-var overrides. To actually read the headline at runtime, move the env lookup into a server component (e.g., remove "use client" from this page, or add a server wrapper that reads the env var and passes it down as a prop).
ui/src/app/layout.tsx
Outdated
| subsets: ["latin"], | ||
| }); | ||
|
|
||
| export const dynamic = "force-dynamic"; |
There was a problem hiding this comment.
export const dynamic = "force-dynamic" on the root layout forces the entire app subtree to render dynamically, which can disable static optimization/caching site-wide and may not be “zero impact” operationally. Consider scoping dynamic rendering to only the routes that need runtime env reading (e.g., export dynamic = "force-dynamic" in the specific pages, or use a small server wrapper for just those pages/components).
| export const dynamic = "force-dynamic"; | |
| export const dynamic = "auto"; |
…er components - Remove "use client" from chat/[chatId]/page.tsx so process.env reads happen at runtime (server-side), not build time - Convert chat pages from use() to async/await (proper server components) - Move force-dynamic from root layout to only the 4 pages that read env vars, preserving static optimization for all other routes Signed-off-by: opspawn <opspawn@users.noreply.github.com>
Signed-off-by: opspawn <opspawn@users.noreply.github.com>
Signed-off-by: opspawn <opspawn@users.noreply.github.com>
|
Closing in favor of #1347 by frank-bee which covers the same configurable headline/subtitle functionality. |
Summary
Closes #1345
Adds two optional environment variables for customizing the kagent UI:
NEXT_PUBLIC_HEADLINE: Replaces the default "Start a conversation" text shown in the chat interface before the first message is sentNEXT_PUBLIC_SUBTITLE: Optional tagline displayed below the "Agents" heading on the landing/agents pagesWhen neither variable is set, the UI behaves exactly as before — zero impact on default deployments.
Changes
ChatInterface.tsxheadlineprop, fall back to "Start a conversation"chat/page.tsxNEXT_PUBLIC_HEADLINEand pass toChatInterfacechat/[chatId]/page.tsxNEXT_PUBLIC_HEADLINEand pass toChatInterfaceAgentList.tsxsubtitleprop, render below "Agents" heading when setpage.tsx(root)NEXT_PUBLIC_SUBTITLEand pass toAgentListagents/page.tsxNEXT_PUBLIC_SUBTITLEand pass toAgentListlayout.tsxexport const dynamic = "force-dynamic"for runtime env var readingTesting
tsc --noEmit)Usage