Skip to content

Commit fd34bbf

Browse files
committed
style: format all example files with prettier
Run prettier on ~1,865 files across examples/ to match the monorepo's formatting standards. These files were imported as-is from standalone repos that used different prettier configs.
1 parent eab4855 commit fd34bbf

1,081 files changed

Lines changed: 170824 additions & 89593 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/README.md

Lines changed: 63 additions & 89 deletions
Large diffs are not rendered by default.

examples/canvas/gemini/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,46 @@ It includes two agents, exposed through a **Next.js frontend** and a **FastAPI b
1919

2020
## 🛠️ Tech Stack
2121

22-
- **Frontend**: Next.js
23-
- **Backend**: FastAPI
24-
- **Agents**: Google Gemini + LangGraph
22+
- **Frontend**: Next.js
23+
- **Backend**: FastAPI
24+
- **Agents**: Google Gemini + LangGraph
2525
- **UI Layer**: CopilotKit
2626

27-
2827
## 📌 About
2928

3029
This demo illustrates how CopilotKit can be paired with LangGraph and Gemini to create agents that are:
30+
3131
- **Context-aware** (understand the input you provide)
3232
- **Task-focused** (generate content or analyze stacks)
3333
- **UI-integrated** (feels like part of your app, not just a chatbox)
3434

35-
3635
---
3736

3837
## Project Structure
3938

40-
- `/` — Next.js 15 app (UI) in the Project Root
39+
- `/` — Next.js 15 app (UI) in the Project Root
4140
- `agent/` — FastAPI backend agent (Python)
4241

4342
---
4443

4544
## 🚀 Getting Started
4645

4746
### 1. Clone the repository
48-
Clone this repo `git clone <project URL>`
4947

48+
Clone this repo `git clone <project URL>`
5049

5150
### 2. Environment Configuration
5251

53-
Create a `.env` file in each relevant directory as needed.
52+
Create a `.env` file in each relevant directory as needed.
5453

5554
#### Backend (`agent/.env`):
55+
5656
```env
5757
GOOGLE_API_KEY=<<your-gemini-key-here>>
5858
```
5959

6060
#### Frontend (`/.env`):
61+
6162
```env
6263
GOOGLE_API_KEY=<<your-gemini-key-here>>
6364
```
@@ -78,6 +79,7 @@ Open [http://localhost:3000](http://localhost:3000) in your browser to view the
7879
---
7980

8081
## Notes
82+
8183
- Ensure the backend agent is running before using the frontend.
8284
- Update environment variables as needed for your deployment.
8385

examples/canvas/gemini/app/api/copilotkit/route.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,29 @@ import {
22
CopilotRuntime,
33
copilotRuntimeNextJSAppRouterEndpoint,
44
GoogleGenerativeAIAdapter,
5-
LangGraphAgent
5+
LangGraphAgent,
66
} from "@copilotkit/runtime";
77
import { NextRequest } from "next/server";
8-
8+
99
// You can use any service adapter here for multi-agent support.
1010
const serviceAdapter = new GoogleGenerativeAIAdapter();
11-
11+
1212
const runtime = new CopilotRuntime({
13-
remoteEndpoints : [{
14-
url : process.env.NEXT_PUBLIC_LANGGRAPH_URL || "http://localhost:8000/copilotkit",
15-
}]
13+
remoteEndpoints: [
14+
{
15+
url:
16+
process.env.NEXT_PUBLIC_LANGGRAPH_URL ||
17+
"http://localhost:8000/copilotkit",
18+
},
19+
],
1620
});
17-
21+
1822
export const POST = async (req: NextRequest) => {
1923
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
2024
runtime,
2125
serviceAdapter,
2226
endpoint: "/api/copilotkit",
2327
});
24-
28+
2529
return handleRequest(req);
26-
};
30+
};
Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,60 @@
1-
"use client"
1+
"use client";
22

3-
import { usePathname } from 'next/navigation'
4-
import React, { createContext, useContext, useState, ReactNode } from 'react'
3+
import { usePathname } from "next/navigation";
4+
import React, { createContext, useContext, useState, ReactNode } from "react";
55

66
interface LayoutState {
7-
title: string
8-
description: string
9-
showHeader: boolean
10-
headerContent?: ReactNode
11-
sidebarContent?: ReactNode
12-
theme: 'light' | 'dark' | 'auto'
13-
agent: string
7+
title: string;
8+
description: string;
9+
showHeader: boolean;
10+
headerContent?: ReactNode;
11+
sidebarContent?: ReactNode;
12+
theme: "light" | "dark" | "auto";
13+
agent: string;
1414
}
1515

1616
interface LayoutContextType {
17-
layoutState: LayoutState
18-
updateLayout: (updates: Partial<LayoutState>) => void
17+
layoutState: LayoutState;
18+
updateLayout: (updates: Partial<LayoutState>) => void;
1919
}
2020

2121
const defaultLayoutState: LayoutState = {
2222
title: "DeepMind × Gemini",
23-
description: "Powered by Google's most advanced AI models for generating LinkedIn and X posts",
23+
description:
24+
"Powered by Google's most advanced AI models for generating LinkedIn and X posts",
2425
showHeader: true,
25-
theme: 'light',
26-
agent: "post_generation_agent"
27-
}
26+
theme: "light",
27+
agent: "post_generation_agent",
28+
};
2829

29-
const LayoutContext = createContext<LayoutContextType | undefined>(undefined)
30+
const LayoutContext = createContext<LayoutContextType | undefined>(undefined);
3031

3132
export function LayoutProvider({ children }: { children: ReactNode }) {
32-
const pathname = usePathname()
33-
console.log(pathname)
34-
const [layoutState, setLayoutState] = useState<LayoutState>({...defaultLayoutState, agent: (pathname == '/post-generator' ? "post_generation_agent" : "stack_analysis_agent")})
35-
console.log(layoutState)
33+
const pathname = usePathname();
34+
console.log(pathname);
35+
const [layoutState, setLayoutState] = useState<LayoutState>({
36+
...defaultLayoutState,
37+
agent:
38+
pathname == "/post-generator"
39+
? "post_generation_agent"
40+
: "stack_analysis_agent",
41+
});
42+
console.log(layoutState);
3643
const updateLayout = (updates: Partial<LayoutState>) => {
37-
setLayoutState(prev => ({ ...prev, ...updates }))
38-
}
39-
44+
setLayoutState((prev) => ({ ...prev, ...updates }));
45+
};
4046

4147
return (
4248
<LayoutContext.Provider value={{ layoutState, updateLayout }}>
4349
{children}
4450
</LayoutContext.Provider>
45-
)
51+
);
4652
}
4753

4854
export function useLayout() {
49-
const context = useContext(LayoutContext)
55+
const context = useContext(LayoutContext);
5056
if (context === undefined) {
51-
throw new Error('useLayout must be used within a LayoutProvider')
57+
throw new Error("useLayout must be used within a LayoutProvider");
5258
}
53-
return context
54-
}
59+
return context;
60+
}
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
import type React from "react"
2-
import type { Metadata } from "next"
3-
import { Inter } from "next/font/google"
4-
import "./globals.css"
5-
import { CopilotKit } from "@copilotkit/react-core"
6-
import { LayoutProvider } from "./contexts/LayoutContext"
7-
import Wrapper from "./wrapper"
1+
import type React from "react";
2+
import type { Metadata } from "next";
3+
import { Inter } from "next/font/google";
4+
import "./globals.css";
5+
import { CopilotKit } from "@copilotkit/react-core";
6+
import { LayoutProvider } from "./contexts/LayoutContext";
7+
import Wrapper from "./wrapper";
88

9-
const inter = Inter({ subsets: ["latin"] })
9+
const inter = Inter({ subsets: ["latin"] });
1010

1111
export const metadata: Metadata = {
1212
title: "Open Gemini Canvas",
13-
description: "Powered by Google's most advanced AI models for generating LinkedIn and X posts",
14-
generator: 'v0.dev'
15-
}
13+
description:
14+
"Powered by Google's most advanced AI models for generating LinkedIn and X posts",
15+
generator: "v0.dev",
16+
};
1617

1718
export default function RootLayout({
1819
children,
1920
}: {
20-
children: React.ReactNode
21+
children: React.ReactNode;
2122
}) {
2223
return (
2324
<html lang="en">
2425
<LayoutProvider>
2526
<Wrapper>
26-
<body className={inter.className}>
27-
{children}
28-
</body>
27+
<body className={inter.className}>{children}</body>
2928
</Wrapper>
3029
</LayoutProvider>
3130
</html>
32-
)
31+
);
3332
}

examples/canvas/gemini/app/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use client"
1+
"use client";
22

33
import "@copilotkit/react-ui/styles.css";
44
import { useEffect } from "react";
@@ -12,7 +12,5 @@ export default function GoogleDeepMindChatUI() {
1212
router.push("/post-generator");
1313
}, [router]);
1414

15-
return (
16-
<></>
17-
)
15+
return <></>;
1816
}

0 commit comments

Comments
 (0)