Skip to content

Commit 362125e

Browse files
committed
add prettier scripts and format code
1 parent 47739e2 commit 362125e

23 files changed

+4226
-2229
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ First, add your langgraph API url and assistant id to `.env.local` file:
77
```
88
LANGCHAIN_API_KEY=your_langchain_api_key
99
LANGGRAPH_API_URL=your_langgraph_api_url
10-
NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_assistant_id_or_graph_id
10+
NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_assistant_id_or_graph_id
1111
```
1212

1313
Then, run the development server:

app/api/[..._path]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function handleRequest(req: NextRequest, method: string) {
3636

3737
const res = await fetch(
3838
`${process.env["LANGGRAPH_API_URL"]}/${path}${queryString}`,
39-
options
39+
options,
4040
);
4141

4242
return new NextResponse(res.body, {

components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"hooks": "@/hooks"
1919
},
2020
"iconLibrary": "lucide"
21-
}
21+
}

components/assistant-ui/attachment.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ const AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {
9696
{children}
9797
</DialogTrigger>
9898
<DialogContent className="aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&_svg]:text-background [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:!ring-0 [&>button]:hover:[&_svg]:text-destructive">
99-
<DialogTitle className="aui-sr-only sr-only">Image Attachment Preview</DialogTitle>
99+
<DialogTitle className="aui-sr-only sr-only">
100+
Image Attachment Preview
101+
</DialogTitle>
100102
<div className="aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background">
101103
<AttachmentPreview src={src} />
102104
</div>
@@ -146,15 +148,17 @@ const AttachmentUI: FC = () => {
146148
<AttachmentPrimitive.Root
147149
className={cn(
148150
"aui-attachment-root relative",
149-
isImage && "aui-attachment-root-composer only:[&>#attachment-tile]:size-24",
151+
isImage &&
152+
"aui-attachment-root-composer only:[&>#attachment-tile]:size-24",
150153
)}
151154
>
152155
<AttachmentPreviewDialog>
153156
<TooltipTrigger asChild>
154157
<div
155158
className={cn(
156159
"aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75",
157-
isComposer && "aui-attachment-tile-composer border-foreground/20",
160+
isComposer &&
161+
"aui-attachment-tile-composer border-foreground/20",
158162
)}
159163
role="button"
160164
id="attachment-tile"

components/assistant-ui/markdown-text.tsx

Lines changed: 115 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
3636

3737
return (
3838
<div className="aui-code-header-root mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-muted-foreground/15 px-4 py-2 text-sm font-semibold text-foreground dark:bg-muted-foreground/20">
39-
<span className="aui-code-header-language lowercase [&>span]:text-xs">{language}</span>
39+
<span className="aui-code-header-language lowercase [&>span]:text-xs">
40+
{language}
41+
</span>
4042
<TooltipIconButton tooltip="Copy" onClick={onCopy}>
4143
{!isCopied && <CopyIcon />}
4244
{isCopied && <CheckIcon />}
@@ -66,64 +68,158 @@ const useCopyToClipboard = ({
6668

6769
const defaultComponents = memoizeMarkdownComponents({
6870
h1: ({ className, ...props }) => (
69-
<h1 className={cn("aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0", className)} {...props} />
71+
<h1
72+
className={cn(
73+
"aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",
74+
className,
75+
)}
76+
{...props}
77+
/>
7078
),
7179
h2: ({ className, ...props }) => (
72-
<h2 className={cn("aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0", className)} {...props} />
80+
<h2
81+
className={cn(
82+
"aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",
83+
className,
84+
)}
85+
{...props}
86+
/>
7387
),
7488
h3: ({ className, ...props }) => (
75-
<h3 className={cn("aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0", className)} {...props} />
89+
<h3
90+
className={cn(
91+
"aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",
92+
className,
93+
)}
94+
{...props}
95+
/>
7696
),
7797
h4: ({ className, ...props }) => (
78-
<h4 className={cn("aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0", className)} {...props} />
98+
<h4
99+
className={cn(
100+
"aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",
101+
className,
102+
)}
103+
{...props}
104+
/>
79105
),
80106
h5: ({ className, ...props }) => (
81-
<h5 className={cn("aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0", className)} {...props} />
107+
<h5
108+
className={cn(
109+
"aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0",
110+
className,
111+
)}
112+
{...props}
113+
/>
82114
),
83115
h6: ({ className, ...props }) => (
84-
<h6 className={cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0", className)} {...props} />
116+
<h6
117+
className={cn(
118+
"aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",
119+
className,
120+
)}
121+
{...props}
122+
/>
85123
),
86124
p: ({ className, ...props }) => (
87-
<p className={cn("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0", className)} {...props} />
125+
<p
126+
className={cn(
127+
"aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",
128+
className,
129+
)}
130+
{...props}
131+
/>
88132
),
89133
a: ({ className, ...props }) => (
90-
<a className={cn("aui-md-a font-medium text-primary underline underline-offset-4", className)} {...props} />
134+
<a
135+
className={cn(
136+
"aui-md-a font-medium text-primary underline underline-offset-4",
137+
className,
138+
)}
139+
{...props}
140+
/>
91141
),
92142
blockquote: ({ className, ...props }) => (
93-
<blockquote className={cn("aui-md-blockquote border-l-2 pl-6 italic", className)} {...props} />
143+
<blockquote
144+
className={cn("aui-md-blockquote border-l-2 pl-6 italic", className)}
145+
{...props}
146+
/>
94147
),
95148
ul: ({ className, ...props }) => (
96-
<ul className={cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2", className)} {...props} />
149+
<ul
150+
className={cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2", className)}
151+
{...props}
152+
/>
97153
),
98154
ol: ({ className, ...props }) => (
99-
<ol className={cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2", className)} {...props} />
155+
<ol
156+
className={cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2", className)}
157+
{...props}
158+
/>
100159
),
101160
hr: ({ className, ...props }) => (
102161
<hr className={cn("aui-md-hr my-5 border-b", className)} {...props} />
103162
),
104163
table: ({ className, ...props }) => (
105-
<table className={cn("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto", className)} {...props} />
164+
<table
165+
className={cn(
166+
"aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",
167+
className,
168+
)}
169+
{...props}
170+
/>
106171
),
107172
th: ({ className, ...props }) => (
108-
<th className={cn("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right", className)} {...props} />
173+
<th
174+
className={cn(
175+
"aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",
176+
className,
177+
)}
178+
{...props}
179+
/>
109180
),
110181
td: ({ className, ...props }) => (
111-
<td className={cn("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right", className)} {...props} />
182+
<td
183+
className={cn(
184+
"aui-md-td border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",
185+
className,
186+
)}
187+
{...props}
188+
/>
112189
),
113190
tr: ({ className, ...props }) => (
114-
<tr className={cn("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg", className)} {...props} />
191+
<tr
192+
className={cn(
193+
"aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",
194+
className,
195+
)}
196+
{...props}
197+
/>
115198
),
116199
sup: ({ className, ...props }) => (
117-
<sup className={cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className)} {...props} />
200+
<sup
201+
className={cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className)}
202+
{...props}
203+
/>
118204
),
119205
pre: ({ className, ...props }) => (
120-
<pre className={cn("aui-md-pre overflow-x-auto !rounded-t-none rounded-b-lg bg-black p-4 text-white", className)} {...props} />
206+
<pre
207+
className={cn(
208+
"aui-md-pre overflow-x-auto !rounded-t-none rounded-b-lg bg-black p-4 text-white",
209+
className,
210+
)}
211+
{...props}
212+
/>
121213
),
122214
code: function Code({ className, ...props }) {
123215
const isCodeBlock = useIsMarkdownCodeBlock();
124216
return (
125217
<code
126-
className={cn(!isCodeBlock && "aui-md-inline-code rounded border bg-muted font-semibold", className)}
218+
className={cn(
219+
!isCodeBlock &&
220+
"aui-md-inline-code rounded border bg-muted font-semibold",
221+
className,
222+
)}
127223
{...props}
128224
/>
129225
);

components/assistant-ui/thread-list.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button
1010

1111
export const ThreadList: FC = () => {
1212
return (
13-
<ThreadListPrimitive.Root className="aui-root * border-border outline-ring/50 aui-thread-list-root flex flex-col items-stretch gap-1.5">
13+
<ThreadListPrimitive.Root className="aui-root * aui-thread-list-root flex flex-col items-stretch gap-1.5 border-border outline-ring/50">
1414
<ThreadListNew />
1515
<ThreadListItems />
1616
</ThreadListPrimitive.Root>
@@ -20,7 +20,10 @@ export const ThreadList: FC = () => {
2020
const ThreadListNew: FC = () => {
2121
return (
2222
<ThreadListPrimitive.New asChild>
23-
<Button className="aui-thread-list-new flex items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start hover:bg-muted data-active:bg-muted" variant="ghost">
23+
<Button
24+
className="aui-thread-list-new flex items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start hover:bg-muted data-active:bg-muted"
25+
variant="ghost"
26+
>
2427
<PlusIcon />
2528
New Thread
2629
</Button>

components/assistant-ui/thread.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const Thread: FC = () => {
3737
<LazyMotion features={domAnimation}>
3838
<MotionConfig reducedMotion="user">
3939
<ThreadPrimitive.Root
40-
className="aui-root * border-border outline-ring/50 aui-thread-root @container flex h-full flex-col bg-background"
40+
className="aui-root * aui-thread-root @container flex h-full flex-col border-border bg-background outline-ring/50"
4141
style={{
4242
["--thread-max-width" as string]: "44rem",
4343
}}
@@ -363,7 +363,10 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
363363
return (
364364
<BranchPickerPrimitive.Root
365365
hideWhenSingleBranch
366-
className={cn("aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-xs text-muted-foreground", className)}
366+
className={cn(
367+
"aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-xs text-muted-foreground",
368+
className,
369+
)}
367370
{...rest}
368371
>
369372
<BranchPickerPrimitive.Previous asChild>
@@ -381,4 +384,4 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
381384
</BranchPickerPrimitive.Next>
382385
</BranchPickerPrimitive.Root>
383386
);
384-
};
387+
};

components/assistant-ui/threadlist-sidebar.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ export function ThreadListSidebar({
2323
<SidebarMenu>
2424
<SidebarMenuItem>
2525
<SidebarMenuButton size="lg" asChild>
26-
<Link href="https://assistant-ui.com" target="_blank" rel="noopener noreferrer">
26+
<Link
27+
href="https://assistant-ui.com"
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
>
2731
<div className="aui-sidebar-header-icon-wrapper flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
2832
<MessagesSquare className="aui-sidebar-header-icon size-4" />
2933
</div>
@@ -54,7 +58,9 @@ export function ThreadListSidebar({
5458
<Github className="aui-sidebar-footer-icon size-4" />
5559
</div>
5660
<div className="aui-sidebar-footer-heading flex flex-col gap-0.5 leading-none">
57-
<span className="aui-sidebar-footer-title font-semibold">GitHub</span>
61+
<span className="aui-sidebar-footer-title font-semibold">
62+
GitHub
63+
</span>
5864
<span>View Source</span>
5965
</div>
6066
</Link>

components/assistant-ui/tool-fallback.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ export const ToolFallback: ToolCallMessagePartComponent = ({
2323
{!isCollapsed && (
2424
<div className="aui-tool-fallback-content flex flex-col gap-2 border-t pt-2">
2525
<div className="aui-tool-fallback-args-root px-4">
26-
<pre className="aui-tool-fallback-args-value whitespace-pre-wrap">{argsText}</pre>
26+
<pre className="aui-tool-fallback-args-value whitespace-pre-wrap">
27+
{argsText}
28+
</pre>
2729
</div>
2830
{result !== undefined && (
2931
<div className="aui-tool-fallback-result-root border-t border-dashed px-4 pt-2">
30-
<p className="aui-tool-fallback-result-header font-semibold">Result:</p>
32+
<p className="aui-tool-fallback-result-header font-semibold">
33+
Result:
34+
</p>
3135
<pre className="aui-tool-fallback-result-content whitespace-pre-wrap">
3236
{typeof result === "string"
3337
? result

components/ui/avatar.tsx

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

3-
import * as React from "react"
4-
import * as AvatarPrimitive from "@radix-ui/react-avatar"
3+
import * as React from "react";
4+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
55

6-
import { cn } from "@/lib/utils"
6+
import { cn } from "@/lib/utils";
77

88
function Avatar({
99
className,
@@ -14,11 +14,11 @@ function Avatar({
1414
data-slot="avatar"
1515
className={cn(
1616
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
17-
className
17+
className,
1818
)}
1919
{...props}
2020
/>
21-
)
21+
);
2222
}
2323

2424
function AvatarImage({
@@ -31,7 +31,7 @@ function AvatarImage({
3131
className={cn("aspect-square size-full", className)}
3232
{...props}
3333
/>
34-
)
34+
);
3535
}
3636

3737
function AvatarFallback({
@@ -42,12 +42,12 @@ function AvatarFallback({
4242
<AvatarPrimitive.Fallback
4343
data-slot="avatar-fallback"
4444
className={cn(
45-
"bg-muted flex size-full items-center justify-center rounded-full",
46-
className
45+
"flex size-full items-center justify-center rounded-full bg-muted",
46+
className,
4747
)}
4848
{...props}
4949
/>
50-
)
50+
);
5151
}
5252

53-
export { Avatar, AvatarImage, AvatarFallback }
53+
export { Avatar, AvatarImage, AvatarFallback };

0 commit comments

Comments
 (0)