Skip to content

Commit 37b3c6f

Browse files
committed
fix: extract JSX object literals to avoid Handlebars double-brace conflict
Handlebars interprets `={{` in JSX (e.g., `labels={{ title: "..." }}`) as template syntax, causing parse errors during template rendering. Fix: extract labels and suggestions as const variables before JSX, using single-brace `{labels}` which Handlebars ignores.
1 parent b7bf662 commit 37b3c6f

1 file changed

Lines changed: 14 additions & 21 deletions

File tree

  • src/assets/frontend/copilotkit/src/app

src/assets/frontend/copilotkit/src/app/page.tsx

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ import { CopilotChat } from "@copilotkit/react-ui";
88
import { CopilotSidebar } from "@copilotkit/react-ui";
99
{{/if}}{{/if}}
1010

11+
const labels = {
12+
title: "{{name}}",
13+
initial: "Hi! I'm your AI assistant. How can I help?",
14+
};
15+
16+
const suggestions = [
17+
{ title: "Get started", message: "What can you do?" },
18+
{ title: "Help", message: "Show me some examples." },
19+
];
20+
1121
export default function Home() {
1222
return (
1323
<main>
@@ -18,13 +28,7 @@ export default function Home() {
1828
<p className="text-gray-600 mb-8">Click the chat bubble to talk to your agent.</p>
1929
</div>
2030
</div>
21-
<CopilotPopup
22-
labels={{
23-
title: "{{name}}",
24-
initial: "Hi! I'm your AI assistant. How can I help?",
25-
}}
26-
defaultOpen={false}
27-
/>
31+
<CopilotPopup labels={labels} defaultOpen={false} />
2832
{{else}}{{#if (eq frontendLayout "chat")}}
2933
<div className="flex h-screen">
3034
<div className="flex-1 flex items-center justify-center bg-gradient-to-br from-indigo-50 to-white">
@@ -34,26 +38,15 @@ export default function Home() {
3438
</div>
3539
</div>
3640
<div className="w-[420px] border-l">
37-
<CopilotChat
38-
labels={{
39-
title: "{{name}}",
40-
initial: "Hi! I'm your AI assistant. How can I help?",
41-
}}
42-
/>
41+
<CopilotChat labels={labels} />
4342
</div>
4443
</div>
4544
{{else}}
4645
<CopilotSidebar
4746
clickOutsideToClose={false}
4847
defaultOpen={true}
49-
labels={{
50-
title: "{{name}}",
51-
initial: "Hi! I'm your AI assistant. How can I help?",
52-
}}
53-
suggestions={[
54-
{ title: "Get started", message: "What can you do?" },
55-
{ title: "Help", message: "Show me some examples." },
56-
]}
48+
labels={labels}
49+
suggestions={suggestions}
5750
>
5851
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-indigo-50 to-white">
5952
<div className="text-center">

0 commit comments

Comments
 (0)