From 8b057082bb2b666c9679f24e5fede1fdcb2868d2 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Thu, 6 Mar 2025 20:08:53 -0800 Subject: [PATCH 01/13] fix: White out all components below input --- src/components/thread/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/thread/index.tsx b/src/components/thread/index.tsx index 2107630..fab269a 100644 --- a/src/components/thread/index.tsx +++ b/src/components/thread/index.tsx @@ -304,7 +304,7 @@ export function Thread() { } footer={ -
+
{!chatStarted && (
@@ -316,7 +316,7 @@ export function Thread() { -
+
Date: Thu, 6 Mar 2025 20:13:52 -0800 Subject: [PATCH 02/13] fix: Render ai message text above tool/gen ui components --- src/components/thread/messages/ai.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/thread/messages/ai.tsx b/src/components/thread/messages/ai.tsx index 57c441c..03c321f 100644 --- a/src/components/thread/messages/ai.tsx +++ b/src/components/thread/messages/ai.tsx @@ -73,13 +73,13 @@ export function AssistantMessage({ ) : (
- {hasToolCalls && } - {contentString.length > 0 && (
{contentString}
)} + {hasToolCalls && } +
Date: Fri, 7 Mar 2025 10:22:53 +0100 Subject: [PATCH 03/13] Remove _INTERNAL_docker_tag --- langgraph.json | 1 - 1 file changed, 1 deletion(-) diff --git a/langgraph.json b/langgraph.json index 4c8d865..fc849e5 100644 --- a/langgraph.json +++ b/langgraph.json @@ -6,7 +6,6 @@ "ui": { "agent": "./agent/uis/index.tsx" }, - "_INTERNAL_docker_tag": "20", "env": ".env", "dependencies": ["."] } From 517e36aad612b984bd5248c038a1ed1cf8fe7a8c Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Fri, 7 Mar 2025 14:35:45 +0100 Subject: [PATCH 04/13] Do not assume http://localhost:2024 --- src/components/thread/messages/ai.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/thread/messages/ai.tsx b/src/components/thread/messages/ai.tsx index 03c321f..f606c1a 100644 --- a/src/components/thread/messages/ai.tsx +++ b/src/components/thread/messages/ai.tsx @@ -7,6 +7,7 @@ import { MarkdownText } from "../markdown-text"; import { LoadExternalComponent } from "@langchain/langgraph-sdk/react-ui"; import { cn } from "@/lib/utils"; import { ToolCalls, ToolResult } from "./tool-calls"; +import { StringParam, useQueryParam } from "use-query-params"; function CustomComponent({ message, @@ -15,6 +16,7 @@ function CustomComponent({ message: Message; thread: ReturnType; }) { + const [apiUrl] = useQueryParam("apiUrl", StringParam); const meta = thread.getMessagesMetadata(message); const seenState = meta?.firstSeenState; const customComponent = seenState?.values.ui @@ -33,6 +35,7 @@ function CustomComponent({
{customComponent && ( Date: Fri, 7 Mar 2025 14:35:51 +0100 Subject: [PATCH 05/13] Add dockerignore --- .dockerignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d97359f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.next +.git +.env \ No newline at end of file From cb27e5eb4ba7f5f52c44d8f1043424d6a0169478 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Fri, 7 Mar 2025 14:46:49 +0100 Subject: [PATCH 06/13] Use `ts` extension instead of `tsx` --- agent/{agent.tsx => agent.ts} | 0 langgraph.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename agent/{agent.tsx => agent.ts} (100%) diff --git a/agent/agent.tsx b/agent/agent.ts similarity index 100% rename from agent/agent.tsx rename to agent/agent.ts diff --git a/langgraph.json b/langgraph.json index fc849e5..0856fb4 100644 --- a/langgraph.json +++ b/langgraph.json @@ -1,7 +1,7 @@ { "node_version": "20", "graphs": { - "agent": "./agent/agent.tsx:graph" + "agent": "./agent/agent.ts:graph" }, "ui": { "agent": "./agent/uis/index.tsx" From 2e7587cb9670b37801d21a2ebe0325c4f41a4910 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Fri, 7 Mar 2025 14:58:55 +0100 Subject: [PATCH 07/13] Rename to Chat LangGraph --- index.html | 2 +- src/components/thread/history/index.tsx | 2 +- src/components/thread/index.tsx | 8 ++++---- src/providers/Stream.tsx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 5084932..790eb70 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - LangGraph Chat + Chat LangGraph diff --git a/src/components/thread/history/index.tsx b/src/components/thread/history/index.tsx index f0e3169..62a88ee 100644 --- a/src/components/thread/history/index.tsx +++ b/src/components/thread/history/index.tsx @@ -97,7 +97,7 @@ export default function ThreadHistory() { variant="ghost" onClick={() => setChatHistoryOpen((p) => !p)} > - +

Thread History diff --git a/src/components/thread/index.tsx b/src/components/thread/index.tsx index fab269a..710144b 100644 --- a/src/components/thread/index.tsx +++ b/src/components/thread/index.tsx @@ -218,7 +218,7 @@ export function Thread() { variant="ghost" onClick={() => setChatHistoryOpen((p) => !p)} > - + )}

@@ -233,7 +233,7 @@ export function Thread() { variant="ghost" onClick={() => setChatHistoryOpen((p) => !p)} > - + )}
@@ -251,7 +251,7 @@ export function Thread() { > - LangGraph Chat + Chat LangGraph
@@ -309,7 +309,7 @@ export function Thread() {

- LangGraph Chat + Chat LangGraph

)} diff --git a/src/providers/Stream.tsx b/src/providers/Stream.tsx index bd2911a..f1b9027 100644 --- a/src/providers/Stream.tsx +++ b/src/providers/Stream.tsx @@ -94,11 +94,11 @@ export const StreamProvider: React.FC<{ children: ReactNode }> = ({

- LangGraph Chat + Chat LangGraph

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

From 9fc221e88a7c9394da1b66e8f891e763943df54a Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Fri, 7 Mar 2025 15:18:57 +0100 Subject: [PATCH 08/13] Support multiline input --- src/components/thread/index.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/thread/index.tsx b/src/components/thread/index.tsx index 710144b..a1fa7e9 100644 --- a/src/components/thread/index.tsx +++ b/src/components/thread/index.tsx @@ -4,7 +4,6 @@ import { motion } from "framer-motion"; import { cn } from "@/lib/utils"; import { useStreamContext } from "@/providers/Stream"; import { useState, FormEvent } from "react"; -import { Input } from "../ui/input"; import { Button } from "../ui/button"; import { Checkpoint, Message } from "@langchain/langgraph-sdk"; import { AssistantMessage, AssistantMessageLoading } from "./messages/ai"; @@ -316,17 +315,24 @@ export function Thread() { -
+
- setInput(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Enter" && !e.shiftKey && !e.metaKey) { + e.preventDefault(); + const el = e.target as HTMLElement | undefined; + const form = el?.closest("form"); + form?.requestSubmit(); + } + }} placeholder="Type your message..." - className="px-4 py-6 border-none bg-transparent shadow-none ring-0 outline-none focus:outline-none focus:ring-0" + className="p-3.5 pb-0 border-none bg-transparent field-sizing-content shadow-none ring-0 outline-none focus:outline-none focus:ring-0 resize-none" />
@@ -338,6 +344,7 @@ export function Thread() { ) : (