From af30e379174e1fcb72b7ea45d4aeed80f7ad6f5d Mon Sep 17 00:00:00 2001 From: John Byrd Date: Sat, 16 Aug 2025 12:37:04 -0700 Subject: [PATCH 1/3] Permit changing the name of the application in the environment --- .env.example | 1 + src/app/layout.tsx | 5 +++-- src/components/thread/index.tsx | 5 +++-- src/lib/app-config.ts | 1 + src/providers/Stream.tsx | 5 +++-- 5 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/lib/app-config.ts diff --git a/.env.example b/.env.example index a38138d3..f2418832 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ # LangGraph Configuration NEXT_PUBLIC_API_URL=http://localhost:2024 NEXT_PUBLIC_ASSISTANT_ID=agent +NEXT_PUBLIC_APP_TITLE=Agent Chat # Do NOT prefix this with "NEXT_PUBLIC_" as we do not want this exposed in the client. LANGSMITH_API_KEY= diff --git a/src/app/layout.tsx b/src/app/layout.tsx index af31f8e5..817f594b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,6 +3,7 @@ import "./globals.css"; import { Inter } from "next/font/google"; import React from "react"; import { NuqsAdapter } from "nuqs/adapters/next/app"; +import { APP_TITLE } from "@/lib/app-config"; const inter = Inter({ subsets: ["latin"], @@ -11,8 +12,8 @@ const inter = Inter({ }); export const metadata: Metadata = { - title: "Agent Chat", - description: "Agent Chat UX by LangChain", + title: APP_TITLE, + description: `${APP_TITLE} UX by LangChain`, }; export default function RootLayout({ diff --git a/src/components/thread/index.tsx b/src/components/thread/index.tsx index d52a1594..0dd89853 100644 --- a/src/components/thread/index.tsx +++ b/src/components/thread/index.tsx @@ -46,6 +46,7 @@ import { ArtifactTitle, useArtifactContext, } from "./artifact"; +import { APP_TITLE } from "@/lib/app-config"; function StickyToBottomContent(props: { content: ReactNode; @@ -362,7 +363,7 @@ export function Thread() { height={32} /> - Agent Chat + {APP_TITLE} @@ -435,7 +436,7 @@ export function Thread() {

- Agent Chat + {APP_TITLE}

)} diff --git a/src/lib/app-config.ts b/src/lib/app-config.ts new file mode 100644 index 00000000..d21dd2ea --- /dev/null +++ b/src/lib/app-config.ts @@ -0,0 +1 @@ +export const APP_TITLE = process.env.NEXT_PUBLIC_APP_TITLE || "Agent Chat"; \ No newline at end of file diff --git a/src/providers/Stream.tsx b/src/providers/Stream.tsx index b6d0c091..3968847b 100644 --- a/src/providers/Stream.tsx +++ b/src/providers/Stream.tsx @@ -24,6 +24,7 @@ import { PasswordInput } from "@/components/ui/password-input"; import { getApiKey } from "@/lib/api-key"; import { useThreads } from "./Thread"; import { toast } from "sonner"; +import { APP_TITLE } from "@/lib/app-config"; export type StateType = { messages: Message[]; ui?: UIMessage[] }; @@ -169,11 +170,11 @@ export const StreamProvider: React.FC<{ children: ReactNode }> = ({

- Agent Chat + {APP_TITLE}

- Welcome to Agent Chat! Before you get started, you need to enter + Welcome to {APP_TITLE}! Before you get started, you need to enter the URL of the deployment and the assistant / graph ID.

From b8115c85c57bc4bfa789077d0800db8bda4004e2 Mon Sep 17 00:00:00 2001 From: John Byrd Date: Sat, 16 Aug 2025 16:10:25 -0700 Subject: [PATCH 2/3] Add ability to disable file upload UI elements via .env setting --- .env.example | 2 ++ README.md | 10 ++++++ src/components/thread/index.tsx | 56 ++++++++++++++++++--------------- src/lib/app-config.ts | 5 ++- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/.env.example b/.env.example index f2418832..d252e131 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,8 @@ NEXT_PUBLIC_API_URL=http://localhost:2024 NEXT_PUBLIC_ASSISTANT_ID=agent NEXT_PUBLIC_APP_TITLE=Agent Chat +# File Upload Configuration - Default is enabled, set to 'false' to disable +# NEXT_PUBLIC_ENABLE_FILE_UPLOAD=false # Do NOT prefix this with "NEXT_PUBLIC_" as we do not want this exposed in the client. LANGSMITH_API_KEY= diff --git a/README.md b/README.md index 6a0a74e3..142abcb5 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,16 @@ To use these variables: When these environment variables are set, the application will use them instead of showing the setup form. +### File Upload Configuration + +You can control file upload functionality using the `NEXT_PUBLIC_ENABLE_FILE_UPLOAD` environment variable: + +- **Default behavior**: File uploads are **enabled** (upload button, drag & drop, paste functionality) +- **To disable**: Set `NEXT_PUBLIC_ENABLE_FILE_UPLOAD=false` in your `.env` file +- **Supported file types**: JPEG, PNG, GIF, WEBP images and PDF files + +When disabled, all file upload UI elements are hidden and file handling is disabled. + ## Hiding Messages in the Chat You can control the visibility of messages within the Agent Chat UI in two main ways: diff --git a/src/components/thread/index.tsx b/src/components/thread/index.tsx index 0dd89853..d2c070d4 100644 --- a/src/components/thread/index.tsx +++ b/src/components/thread/index.tsx @@ -46,7 +46,7 @@ import { ArtifactTitle, useArtifactContext, } from "./artifact"; -import { APP_TITLE } from "@/lib/app-config"; +import { APP_TITLE, ENABLE_FILE_UPLOAD } from "@/lib/app-config"; function StickyToBottomContent(props: { content: ReactNode; @@ -444,10 +444,10 @@ export function Thread() {
- + {ENABLE_FILE_UPLOAD && ( + + )}