Skip to content

Commit 34f53d4

Browse files
tylerslatonclaude
andcommitted
feat(showcase/google-adk/hitl-in-chat): port frontend from langgraph-python
Copy page.tsx and time-picker-card.tsx verbatim from the langgraph-python north-star demo. Delete README.md (not present upstream). Frontend now uses agent="hitl-in-chat" / agentId="hitl-in-chat" exactly as LP — registry and route.ts currently key on "hitl_in_chat", which will need a follow-up rename to wire end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9d8870a commit 34f53d4

3 files changed

Lines changed: 19 additions & 138 deletions

File tree

showcase/integrations/google-adk/src/app/demos/hitl-in-chat/README.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

showcase/integrations/google-adk/src/app/demos/hitl-in-chat/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import { TimePickerCard, TimeSlot } from "./time-picker-card";
1212

1313
// @region[time-slots]
1414
const DEFAULT_SLOTS: TimeSlot[] = [
15-
{ label: "Tomorrow 10:00 AM", iso: "2026-04-30T10:00:00-07:00" },
16-
{ label: "Tomorrow 2:00 PM", iso: "2026-04-30T14:00:00-07:00" },
17-
{ label: "Monday 9:00 AM", iso: "2026-05-04T09:00:00-07:00" },
18-
{ label: "Monday 3:30 PM", iso: "2026-05-04T15:30:00-07:00" },
15+
{ label: "Tomorrow 10:00 AM", iso: "2026-04-19T10:00:00-07:00" },
16+
{ label: "Tomorrow 2:00 PM", iso: "2026-04-19T14:00:00-07:00" },
17+
{ label: "Monday 9:00 AM", iso: "2026-04-21T09:00:00-07:00" },
18+
{ label: "Monday 3:30 PM", iso: "2026-04-21T15:30:00-07:00" },
1919
];
2020
// @endregion[time-slots]
2121

2222
export default function HitlInChatDemo() {
2323
return (
24-
<CopilotKit runtimeUrl="/api/copilotkit" agent="hitl_in_chat">
24+
<CopilotKit runtimeUrl="/api/copilotkit" agent="hitl-in-chat">
2525
<div className="flex justify-center items-center h-screen w-full">
2626
<div className="h-full w-full max-w-4xl">
2727
<Chat />
@@ -49,7 +49,7 @@ function Chat() {
4949

5050
// @region[hitl-hook]
5151
useHumanInTheLoop({
52-
agentId: "hitl_in_chat",
52+
agentId: "hitl-in-chat",
5353
name: "book_call",
5454
description:
5555
"Ask the user to pick a time slot for a call. The picker UI presents fixed candidate slots; the user's choice is returned to the agent.",
@@ -73,5 +73,5 @@ function Chat() {
7373
});
7474
// @endregion[hitl-hook]
7575

76-
return <CopilotChat agentId="hitl_in_chat" className="h-full rounded-2xl" />;
76+
return <CopilotChat agentId="hitl-in-chat" className="h-full rounded-2xl" />;
7777
}

showcase/integrations/google-adk/src/app/demos/hitl-in-chat/time-picker-card.tsx

Lines changed: 12 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ export function TimePickerCard({
3838
if (cancelled) {
3939
return (
4040
<div
41-
style={{
42-
borderRadius: "16px",
43-
border: "1px solid #DBDBE5",
44-
background: "#F7F7F9",
45-
padding: "16px",
46-
fontSize: "14px",
47-
color: "#57575B",
48-
maxWidth: "28rem",
49-
}}
41+
className="rounded-2xl border border-[#DBDBE5] bg-[#F7F7F9] p-4 text-sm text-[#57575B] max-w-md"
5042
data-testid="time-picker-cancelled"
5143
>
5244
Cancelled — no time picked.
@@ -57,78 +49,31 @@ export function TimePickerCard({
5749
if (picked) {
5850
return (
5951
<div
60-
style={{
61-
borderRadius: "16px",
62-
border: "1px solid #85ECCE4D",
63-
background: "rgba(133, 236, 206, 0.1)",
64-
padding: "16px",
65-
maxWidth: "28rem",
66-
}}
52+
className="rounded-2xl border border-[#85ECCE4D] bg-[#85ECCE]/10 p-4 max-w-md"
6753
data-testid="time-picker-picked"
6854
>
69-
<p style={{ fontSize: "14px", color: "#010507" }}>
70-
Booked for <span style={{ fontWeight: 600 }}>{picked.label}</span>
55+
<p className="text-sm text-[#010507]">
56+
Booked for <span className="font-semibold">{picked.label}</span>
7157
</p>
7258
</div>
7359
);
7460
}
7561

7662
return (
7763
<div
78-
style={{
79-
borderRadius: "16px",
80-
border: "1px solid #DBDBE5",
81-
background: "#fff",
82-
padding: "20px",
83-
boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
84-
maxWidth: "28rem",
85-
}}
64+
className="rounded-2xl border border-[#DBDBE5] bg-white p-5 shadow-sm max-w-md"
8665
data-testid="time-picker-card"
8766
>
88-
<p
89-
style={{
90-
fontSize: "10px",
91-
textTransform: "uppercase",
92-
letterSpacing: "0.14em",
93-
color: "#57575B",
94-
fontWeight: 500,
95-
}}
96-
>
67+
<p className="text-[10px] uppercase tracking-[0.14em] text-[#57575B] font-medium">
9768
Book a call
9869
</p>
99-
<h3
100-
style={{
101-
fontSize: "16px",
102-
fontWeight: 600,
103-
color: "#010507",
104-
marginTop: "6px",
105-
}}
106-
>
107-
{topic}
108-
</h3>
70+
<h3 className="text-base font-semibold text-[#010507] mt-1.5">{topic}</h3>
10971
{attendee && (
110-
<p style={{ fontSize: "14px", color: "#57575B", marginTop: "2px" }}>
111-
With {attendee}
112-
</p>
72+
<p className="text-sm text-[#57575B] mt-0.5">With {attendee}</p>
11373
)}
11474

115-
<p
116-
style={{
117-
fontSize: "14px",
118-
color: "#57575B",
119-
marginTop: "16px",
120-
marginBottom: "8px",
121-
}}
122-
>
123-
Pick a time:
124-
</p>
125-
<div
126-
style={{
127-
display: "grid",
128-
gridTemplateColumns: "1fr 1fr",
129-
gap: "8px",
130-
}}
131-
>
75+
<p className="text-sm text-[#57575B] mt-4 mb-2">Pick a time:</p>
76+
<div className="grid grid-cols-2 gap-2">
13277
{slots.map((s) => (
13378
<button
13479
key={s.iso}
@@ -138,18 +83,7 @@ export function TimePickerCard({
13883
setPicked(s);
13984
onSubmit({ chosen_time: s.iso, chosen_label: s.label });
14085
}}
141-
style={{
142-
borderRadius: "12px",
143-
border: "1px solid #DBDBE5",
144-
background: "#fff",
145-
padding: "8px 12px",
146-
fontSize: "14px",
147-
fontWeight: 500,
148-
color: "#010507",
149-
opacity: disabled ? 0.5 : 1,
150-
cursor: disabled ? "not-allowed" : "pointer",
151-
transition: "border-color 0.15s, background 0.15s",
152-
}}
86+
className="rounded-xl border border-[#DBDBE5] bg-white px-3 py-2 text-sm font-medium text-[#010507] hover:border-[#BEC2FF] hover:bg-[#BEC2FF1A] disabled:opacity-50 transition-colors"
15387
>
15488
{s.label}
15589
</button>
@@ -161,18 +95,7 @@ export function TimePickerCard({
16195
setCancelled(true);
16296
onSubmit({ cancelled: true });
16397
}}
164-
style={{
165-
marginTop: "12px",
166-
width: "100%",
167-
borderRadius: "12px",
168-
border: "1px solid #E9E9EF",
169-
padding: "6px 12px",
170-
fontSize: "12px",
171-
color: "#838389",
172-
background: "transparent",
173-
opacity: disabled ? 0.5 : 1,
174-
cursor: disabled ? "not-allowed" : "pointer",
175-
}}
98+
className="mt-3 w-full rounded-xl border border-[#E9E9EF] px-3 py-1.5 text-xs text-[#838389] hover:bg-[#FAFAFC] disabled:opacity-50 transition-colors"
17699
>
177100
None of these work
178101
</button>

0 commit comments

Comments
 (0)