initialize project with Next.js, Tailwind CSS, and essential configurations
41
.gitignore
vendored
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.*
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# next.js
|
||||||
|
/.next/
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
*.pem
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# env files (can opt-in for committing if needed)
|
||||||
|
.env*
|
||||||
|
|
||||||
|
# vercel
|
||||||
|
.vercel
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
next-env.d.ts
|
||||||
36
README.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
First, run the development server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
# or
|
||||||
|
yarn dev
|
||||||
|
# or
|
||||||
|
pnpm dev
|
||||||
|
# or
|
||||||
|
bun dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||||
|
|
||||||
|
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||||
|
|
||||||
|
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
To learn more about Next.js, take a look at the following resources:
|
||||||
|
|
||||||
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||||
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||||
|
|
||||||
|
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||||
|
|
||||||
|
## Deploy on Vercel
|
||||||
|
|
||||||
|
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||||
|
|
||||||
|
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||||
13
app/api/chat/route.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { google } from "@ai-sdk/google";
|
||||||
|
import { streamText } from "ai";
|
||||||
|
|
||||||
|
export const maxDuration = 30;
|
||||||
|
|
||||||
|
export async function POST(req: Request) {
|
||||||
|
const { messages } = await req.json();
|
||||||
|
const result = streamText({
|
||||||
|
model: google("gemini-2.0-flash"),
|
||||||
|
messages,
|
||||||
|
});
|
||||||
|
return result.toDataStreamResponse();
|
||||||
|
}
|
||||||
21
app/assistant.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
||||||
|
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
||||||
|
import { Thread } from "@/components/assistant-ui/thread";
|
||||||
|
import { ThreadList } from "@/components/assistant-ui/thread-list";
|
||||||
|
|
||||||
|
export const Assistant = () => {
|
||||||
|
const runtime = useChatRuntime({
|
||||||
|
api: "/api/chat",
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AssistantRuntimeProvider runtime={runtime}>
|
||||||
|
<div className="grid h-dvh grid-cols-[200px_1fr] gap-x-2 px-4 py-4">
|
||||||
|
<ThreadList />
|
||||||
|
<Thread />
|
||||||
|
</div>
|
||||||
|
</AssistantRuntimeProvider>
|
||||||
|
);
|
||||||
|
};
|
||||||
69
app/extract_xml.ts
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import * as pako from 'pako';
|
||||||
|
|
||||||
|
export async function extractDiagramXML(xml_svg_string: string): Promise<string> {
|
||||||
|
try {
|
||||||
|
// 1. Parse the SVG string (using built-in DOMParser in a browser-like environment)
|
||||||
|
const svgString = atob(xml_svg_string.slice(26))
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const svgDoc = parser.parseFromString(svgString, "image/svg+xml");
|
||||||
|
const svgElement = svgDoc.querySelector('svg');
|
||||||
|
|
||||||
|
if (!svgElement) {
|
||||||
|
throw new Error("No SVG element found in the input string.");
|
||||||
|
}
|
||||||
|
console.log("svgElement", svgElement);
|
||||||
|
// 2. Extract the 'content' attribute
|
||||||
|
const encodedContent = svgElement.getAttribute('content');
|
||||||
|
|
||||||
|
if (!encodedContent) {
|
||||||
|
throw new Error("SVG element does not have a 'content' attribute.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Decode HTML entities (using a minimal function)
|
||||||
|
function decodeHtmlEntities(str: string) {
|
||||||
|
const textarea = document.createElement('textarea'); // Use built-in element
|
||||||
|
textarea.innerHTML = str;
|
||||||
|
return textarea.value;
|
||||||
|
}
|
||||||
|
const xmlContent = decodeHtmlEntities(encodedContent);
|
||||||
|
|
||||||
|
// 4. Parse the XML content
|
||||||
|
const xmlDoc = parser.parseFromString(xmlContent, "text/xml");
|
||||||
|
const diagramElement = xmlDoc.querySelector('diagram');
|
||||||
|
|
||||||
|
if (!diagramElement) {
|
||||||
|
throw new Error("No diagram element found");
|
||||||
|
}
|
||||||
|
console.log("diagramElement", diagramElement);
|
||||||
|
// 5. Extract base64 encoded data
|
||||||
|
const base64EncodedData = diagramElement.textContent;
|
||||||
|
console.log("base64EncodedData", base64EncodedData);
|
||||||
|
|
||||||
|
if (!base64EncodedData) {
|
||||||
|
throw new Error("No encoded data found in the diagram element");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Decode base64 data
|
||||||
|
const binaryString = atob(base64EncodedData);
|
||||||
|
|
||||||
|
// 7. Convert binary string to Uint8Array
|
||||||
|
const len = binaryString.length;
|
||||||
|
const bytes = new Uint8Array(len);
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
bytes[i] = binaryString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 8. Decompress data using pako (equivalent to zlib.decompress with wbits=-15)
|
||||||
|
const decompressedData = pako.inflate(bytes, { windowBits: -15 });
|
||||||
|
|
||||||
|
// 9. Convert the decompressed data to a string
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
const decodedString = decoder.decode(decompressedData);
|
||||||
|
|
||||||
|
return decodedString;
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error extracting diagram XML:", error);
|
||||||
|
throw error; // Re-throw for caller handling
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/favicon.ico
Normal file
|
After Width: | Height: | Size: 25 KiB |
123
app/globals.css
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
|
@plugin "tailwindcss-animate";
|
||||||
|
|
||||||
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
|
@theme inline {
|
||||||
|
--color-background: var(--background);
|
||||||
|
--color-foreground: var(--foreground);
|
||||||
|
--font-sans: var(--font-geist-sans);
|
||||||
|
--font-mono: var(--font-geist-mono);
|
||||||
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||||
|
--color-sidebar-accent: var(--sidebar-accent);
|
||||||
|
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||||
|
--color-sidebar-primary: var(--sidebar-primary);
|
||||||
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||||
|
--color-sidebar: var(--sidebar);
|
||||||
|
--color-chart-5: var(--chart-5);
|
||||||
|
--color-chart-4: var(--chart-4);
|
||||||
|
--color-chart-3: var(--chart-3);
|
||||||
|
--color-chart-2: var(--chart-2);
|
||||||
|
--color-chart-1: var(--chart-1);
|
||||||
|
--color-ring: var(--ring);
|
||||||
|
--color-input: var(--input);
|
||||||
|
--color-border: var(--border);
|
||||||
|
--color-destructive: var(--destructive);
|
||||||
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
|
--color-accent: var(--accent);
|
||||||
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
|
--color-muted: var(--muted);
|
||||||
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
|
--color-secondary: var(--secondary);
|
||||||
|
--color-primary-foreground: var(--primary-foreground);
|
||||||
|
--color-primary: var(--primary);
|
||||||
|
--color-popover-foreground: var(--popover-foreground);
|
||||||
|
--color-popover: var(--popover);
|
||||||
|
--color-card-foreground: var(--card-foreground);
|
||||||
|
--color-card: var(--card);
|
||||||
|
--radius-sm: calc(var(--radius) - 4px);
|
||||||
|
--radius-md: calc(var(--radius) - 2px);
|
||||||
|
--radius-lg: var(--radius);
|
||||||
|
--radius-xl: calc(var(--radius) + 4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--radius: 0.625rem;
|
||||||
|
--background: oklch(1 0 0);
|
||||||
|
--foreground: oklch(0.145 0 0);
|
||||||
|
--card: oklch(1 0 0);
|
||||||
|
--card-foreground: oklch(0.145 0 0);
|
||||||
|
--popover: oklch(1 0 0);
|
||||||
|
--popover-foreground: oklch(0.145 0 0);
|
||||||
|
--primary: oklch(0.205 0 0);
|
||||||
|
--primary-foreground: oklch(0.985 0 0);
|
||||||
|
--secondary: oklch(0.97 0 0);
|
||||||
|
--secondary-foreground: oklch(0.205 0 0);
|
||||||
|
--muted: oklch(0.97 0 0);
|
||||||
|
--muted-foreground: oklch(0.556 0 0);
|
||||||
|
--accent: oklch(0.97 0 0);
|
||||||
|
--accent-foreground: oklch(0.205 0 0);
|
||||||
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
|
--border: oklch(0.922 0 0);
|
||||||
|
--input: oklch(0.922 0 0);
|
||||||
|
--ring: oklch(0.708 0 0);
|
||||||
|
--chart-1: oklch(0.646 0.222 41.116);
|
||||||
|
--chart-2: oklch(0.6 0.118 184.704);
|
||||||
|
--chart-3: oklch(0.398 0.07 227.392);
|
||||||
|
--chart-4: oklch(0.828 0.189 84.429);
|
||||||
|
--chart-5: oklch(0.769 0.188 70.08);
|
||||||
|
--sidebar: oklch(0.985 0 0);
|
||||||
|
--sidebar-foreground: oklch(0.145 0 0);
|
||||||
|
--sidebar-primary: oklch(0.205 0 0);
|
||||||
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-accent: oklch(0.97 0 0);
|
||||||
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||||
|
--sidebar-border: oklch(0.922 0 0);
|
||||||
|
--sidebar-ring: oklch(0.708 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--background: oklch(0.145 0 0);
|
||||||
|
--foreground: oklch(0.985 0 0);
|
||||||
|
--card: oklch(0.205 0 0);
|
||||||
|
--card-foreground: oklch(0.985 0 0);
|
||||||
|
--popover: oklch(0.205 0 0);
|
||||||
|
--popover-foreground: oklch(0.985 0 0);
|
||||||
|
--primary: oklch(0.922 0 0);
|
||||||
|
--primary-foreground: oklch(0.205 0 0);
|
||||||
|
--secondary: oklch(0.269 0 0);
|
||||||
|
--secondary-foreground: oklch(0.985 0 0);
|
||||||
|
--muted: oklch(0.269 0 0);
|
||||||
|
--muted-foreground: oklch(0.708 0 0);
|
||||||
|
--accent: oklch(0.269 0 0);
|
||||||
|
--accent-foreground: oklch(0.985 0 0);
|
||||||
|
--destructive: oklch(0.704 0.191 22.216);
|
||||||
|
--border: oklch(1 0 0 / 10%);
|
||||||
|
--input: oklch(1 0 0 / 15%);
|
||||||
|
--ring: oklch(0.556 0 0);
|
||||||
|
--chart-1: oklch(0.488 0.243 264.376);
|
||||||
|
--chart-2: oklch(0.696 0.17 162.48);
|
||||||
|
--chart-3: oklch(0.769 0.188 70.08);
|
||||||
|
--chart-4: oklch(0.627 0.265 303.9);
|
||||||
|
--chart-5: oklch(0.645 0.246 16.439);
|
||||||
|
--sidebar: oklch(0.205 0 0);
|
||||||
|
--sidebar-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||||
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-accent: oklch(0.269 0 0);
|
||||||
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||||
|
--sidebar-border: oklch(1 0 0 / 10%);
|
||||||
|
--sidebar-ring: oklch(0.556 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border outline-ring/50;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
}
|
||||||
|
}
|
||||||
34
app/layout.tsx
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import type { Metadata } from "next";
|
||||||
|
import { Geist, Geist_Mono } from "next/font/google";
|
||||||
|
import "./globals.css";
|
||||||
|
|
||||||
|
const geistSans = Geist({
|
||||||
|
variable: "--font-geist-sans",
|
||||||
|
subsets: ["latin"],
|
||||||
|
});
|
||||||
|
|
||||||
|
const geistMono = Geist_Mono({
|
||||||
|
variable: "--font-geist-mono",
|
||||||
|
subsets: ["latin"],
|
||||||
|
});
|
||||||
|
|
||||||
|
export const metadata: Metadata = {
|
||||||
|
title: "Create Next App",
|
||||||
|
description: "Generated by create next app",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
}: Readonly<{
|
||||||
|
children: React.ReactNode;
|
||||||
|
}>) {
|
||||||
|
return (
|
||||||
|
<html lang="en">
|
||||||
|
<body
|
||||||
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
);
|
||||||
|
}
|
||||||
83
app/page.tsx
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
"use client";
|
||||||
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
||||||
|
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
||||||
|
import { DrawIoEmbed, DrawIoEmbedRef } from "react-drawio";
|
||||||
|
|
||||||
|
import { Thread } from "@/components/assistant-ui/thread";
|
||||||
|
import { useRef, useState } from "react";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { extractDiagramXML } from "./extract_xml"
|
||||||
|
export default function Home() {
|
||||||
|
const runtime = useChatRuntime({
|
||||||
|
api: "/api/chat",
|
||||||
|
});
|
||||||
|
|
||||||
|
const drawioRef = useRef<DrawIoEmbedRef>(null);
|
||||||
|
const [imgData, setImgData] = useState<string | null>(null);
|
||||||
|
const [diagram, setDiagram] = useState<string>("");
|
||||||
|
// const handleExport = () => {};
|
||||||
|
const handleExport = () => {
|
||||||
|
if (drawioRef.current) {
|
||||||
|
drawioRef.current.exportDiagram({
|
||||||
|
format: "xmlsvg",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (drawioRef.current) {
|
||||||
|
drawioRef.current.load({
|
||||||
|
xml: diagram,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
console.log("imgData", imgData);
|
||||||
|
return (
|
||||||
|
<AssistantRuntimeProvider runtime={runtime}>
|
||||||
|
<div className="grid h-dvh grid-cols-[1fr_400px] gap-x-2 px-4 py-4">
|
||||||
|
<DrawIoEmbed
|
||||||
|
ref={drawioRef}
|
||||||
|
onExport={(data) => setImgData(data.data)}
|
||||||
|
urlParameters={{
|
||||||
|
// ui: "kennedy",
|
||||||
|
spin: true,
|
||||||
|
libraries: false,
|
||||||
|
saveAndExit: false,
|
||||||
|
noExitBtn: true,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{/* <Thread /> */}
|
||||||
|
<div className="flex flex-col gap-2">
|
||||||
|
<form>
|
||||||
|
<div className="mb-4">
|
||||||
|
<label htmlFor="diagramXml" className="block text-sm font-medium mb-1">
|
||||||
|
Diagram XML
|
||||||
|
</label>
|
||||||
|
<textarea
|
||||||
|
id="diagramXml"
|
||||||
|
className="w-full p-2 border border-gray-300 rounded-md min-h-[200px]"
|
||||||
|
placeholder="Paste your diagram XML here..."
|
||||||
|
value={diagram || ''}
|
||||||
|
onChange={(e) => setDiagram(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Button onClick={handleSubmit}>submit</Button>
|
||||||
|
</form>
|
||||||
|
<div>
|
||||||
|
<div className="bg-amber-300 w-full h-[400px]">{imgData &&
|
||||||
|
<>
|
||||||
|
{/* <img src={imgData} /> */}
|
||||||
|
<div className="bg-blue-100 h-[400px]">
|
||||||
|
<h1>Extracted XML</h1>
|
||||||
|
<div>imgData</div>
|
||||||
|
<div>{extractDiagramXML(imgData)}</div>
|
||||||
|
</div>
|
||||||
|
</>}
|
||||||
|
<Button onClick={handleExport}>Export</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</AssistantRuntimeProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
components.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://ui.shadcn.com/schema.json",
|
||||||
|
"style": "new-york",
|
||||||
|
"rsc": true,
|
||||||
|
"tsx": true,
|
||||||
|
"tailwind": {
|
||||||
|
"config": "",
|
||||||
|
"css": "app/globals.css",
|
||||||
|
"baseColor": "neutral",
|
||||||
|
"cssVariables": true,
|
||||||
|
"prefix": ""
|
||||||
|
},
|
||||||
|
"aliases": {
|
||||||
|
"components": "@/components",
|
||||||
|
"utils": "@/lib/utils",
|
||||||
|
"ui": "@/components/ui",
|
||||||
|
"lib": "@/lib",
|
||||||
|
"hooks": "@/hooks"
|
||||||
|
},
|
||||||
|
"iconLibrary": "lucide"
|
||||||
|
}
|
||||||
132
components/assistant-ui/markdown-text.tsx
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import "@assistant-ui/react-markdown/styles/dot.css";
|
||||||
|
|
||||||
|
import {
|
||||||
|
CodeHeaderProps,
|
||||||
|
MarkdownTextPrimitive,
|
||||||
|
unstable_memoizeMarkdownComponents as memoizeMarkdownComponents,
|
||||||
|
useIsMarkdownCodeBlock,
|
||||||
|
} from "@assistant-ui/react-markdown";
|
||||||
|
import remarkGfm from "remark-gfm";
|
||||||
|
import { FC, memo, useState } from "react";
|
||||||
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
||||||
|
|
||||||
|
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
const MarkdownTextImpl = () => {
|
||||||
|
return (
|
||||||
|
<MarkdownTextPrimitive
|
||||||
|
remarkPlugins={[remarkGfm]}
|
||||||
|
className="aui-md"
|
||||||
|
components={defaultComponents}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MarkdownText = memo(MarkdownTextImpl);
|
||||||
|
|
||||||
|
const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
|
||||||
|
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
||||||
|
const onCopy = () => {
|
||||||
|
if (!code || isCopied) return;
|
||||||
|
copyToClipboard(code);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white">
|
||||||
|
<span className="lowercase [&>span]:text-xs">{language}</span>
|
||||||
|
<TooltipIconButton tooltip="Copy" onClick={onCopy}>
|
||||||
|
{!isCopied && <CopyIcon />}
|
||||||
|
{isCopied && <CheckIcon />}
|
||||||
|
</TooltipIconButton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const useCopyToClipboard = ({
|
||||||
|
copiedDuration = 3000,
|
||||||
|
}: {
|
||||||
|
copiedDuration?: number;
|
||||||
|
} = {}) => {
|
||||||
|
const [isCopied, setIsCopied] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const copyToClipboard = (value: string) => {
|
||||||
|
if (!value) return;
|
||||||
|
|
||||||
|
navigator.clipboard.writeText(value).then(() => {
|
||||||
|
setIsCopied(true);
|
||||||
|
setTimeout(() => setIsCopied(false), copiedDuration);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return { isCopied, copyToClipboard };
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultComponents = memoizeMarkdownComponents({
|
||||||
|
h1: ({ className, ...props }) => (
|
||||||
|
<h1 className={cn("mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
h2: ({ className, ...props }) => (
|
||||||
|
<h2 className={cn("mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
h3: ({ className, ...props }) => (
|
||||||
|
<h3 className={cn("mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
h4: ({ className, ...props }) => (
|
||||||
|
<h4 className={cn("mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
h5: ({ className, ...props }) => (
|
||||||
|
<h5 className={cn("my-4 text-lg font-semibold first:mt-0 last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
h6: ({ className, ...props }) => (
|
||||||
|
<h6 className={cn("my-4 font-semibold first:mt-0 last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
p: ({ className, ...props }) => (
|
||||||
|
<p className={cn("mb-5 mt-5 leading-7 first:mt-0 last:mb-0", className)} {...props} />
|
||||||
|
),
|
||||||
|
a: ({ className, ...props }) => (
|
||||||
|
<a className={cn("text-primary font-medium underline underline-offset-4", className)} {...props} />
|
||||||
|
),
|
||||||
|
blockquote: ({ className, ...props }) => (
|
||||||
|
<blockquote className={cn("border-l-2 pl-6 italic", className)} {...props} />
|
||||||
|
),
|
||||||
|
ul: ({ className, ...props }) => (
|
||||||
|
<ul className={cn("my-5 ml-6 list-disc [&>li]:mt-2", className)} {...props} />
|
||||||
|
),
|
||||||
|
ol: ({ className, ...props }) => (
|
||||||
|
<ol className={cn("my-5 ml-6 list-decimal [&>li]:mt-2", className)} {...props} />
|
||||||
|
),
|
||||||
|
hr: ({ className, ...props }) => (
|
||||||
|
<hr className={cn("my-5 border-b", className)} {...props} />
|
||||||
|
),
|
||||||
|
table: ({ className, ...props }) => (
|
||||||
|
<table className={cn("my-5 w-full border-separate border-spacing-0 overflow-y-auto", className)} {...props} />
|
||||||
|
),
|
||||||
|
th: ({ className, ...props }) => (
|
||||||
|
<th className={cn("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} />
|
||||||
|
),
|
||||||
|
td: ({ className, ...props }) => (
|
||||||
|
<td className={cn("border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right", className)} {...props} />
|
||||||
|
),
|
||||||
|
tr: ({ className, ...props }) => (
|
||||||
|
<tr className={cn("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} />
|
||||||
|
),
|
||||||
|
sup: ({ className, ...props }) => (
|
||||||
|
<sup className={cn("[&>a]:text-xs [&>a]:no-underline", className)} {...props} />
|
||||||
|
),
|
||||||
|
pre: ({ className, ...props }) => (
|
||||||
|
<pre className={cn("overflow-x-auto rounded-b-lg bg-black p-4 text-white", className)} {...props} />
|
||||||
|
),
|
||||||
|
code: function Code({ className, ...props }) {
|
||||||
|
const isCodeBlock = useIsMarkdownCodeBlock();
|
||||||
|
return (
|
||||||
|
<code
|
||||||
|
className={cn(!isCodeBlock && "bg-muted rounded border font-semibold", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
CodeHeader,
|
||||||
|
});
|
||||||
66
components/assistant-ui/thread-list.tsx
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import type { FC } from "react";
|
||||||
|
import {
|
||||||
|
ThreadListItemPrimitive,
|
||||||
|
ThreadListPrimitive,
|
||||||
|
} from "@assistant-ui/react";
|
||||||
|
import { ArchiveIcon, PlusIcon } from "lucide-react";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
||||||
|
|
||||||
|
export const ThreadList: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadListPrimitive.Root className="flex flex-col items-stretch gap-1.5">
|
||||||
|
<ThreadListNew />
|
||||||
|
<ThreadListItems />
|
||||||
|
</ThreadListPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadListNew: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadListPrimitive.New asChild>
|
||||||
|
<Button className="data-[active]:bg-muted hover:bg-muted flex items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start" variant="ghost">
|
||||||
|
<PlusIcon />
|
||||||
|
New Thread
|
||||||
|
</Button>
|
||||||
|
</ThreadListPrimitive.New>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadListItems: FC = () => {
|
||||||
|
return <ThreadListPrimitive.Items components={{ ThreadListItem }} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadListItem: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadListItemPrimitive.Root className="data-[active]:bg-muted hover:bg-muted focus-visible:bg-muted focus-visible:ring-ring flex items-center gap-2 rounded-lg transition-all focus-visible:outline-none focus-visible:ring-2">
|
||||||
|
<ThreadListItemPrimitive.Trigger className="flex-grow px-3 py-2 text-start">
|
||||||
|
<ThreadListItemTitle />
|
||||||
|
</ThreadListItemPrimitive.Trigger>
|
||||||
|
<ThreadListItemArchive />
|
||||||
|
</ThreadListItemPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadListItemTitle: FC = () => {
|
||||||
|
return (
|
||||||
|
<p className="text-sm">
|
||||||
|
<ThreadListItemPrimitive.Title fallback="New Chat" />
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadListItemArchive: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadListItemPrimitive.Archive asChild>
|
||||||
|
<TooltipIconButton
|
||||||
|
className="hover:text-primary text-foreground ml-auto mr-3 size-4 p-0"
|
||||||
|
variant="ghost"
|
||||||
|
tooltip="Archive thread"
|
||||||
|
>
|
||||||
|
<ArchiveIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ThreadListItemPrimitive.Archive>
|
||||||
|
);
|
||||||
|
};
|
||||||
287
components/assistant-ui/thread.tsx
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
import {
|
||||||
|
ActionBarPrimitive,
|
||||||
|
BranchPickerPrimitive,
|
||||||
|
ComposerPrimitive,
|
||||||
|
MessagePrimitive,
|
||||||
|
ThreadPrimitive,
|
||||||
|
} from "@assistant-ui/react";
|
||||||
|
import type { FC } from "react";
|
||||||
|
import {
|
||||||
|
ArrowDownIcon,
|
||||||
|
CheckIcon,
|
||||||
|
ChevronLeftIcon,
|
||||||
|
ChevronRightIcon,
|
||||||
|
CopyIcon,
|
||||||
|
PencilIcon,
|
||||||
|
RefreshCwIcon,
|
||||||
|
SendHorizontalIcon,
|
||||||
|
} from "lucide-react";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { MarkdownText } from "@/components/assistant-ui/markdown-text";
|
||||||
|
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
||||||
|
|
||||||
|
export const Thread: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadPrimitive.Root
|
||||||
|
className="bg-background box-border flex h-full flex-col overflow-hidden"
|
||||||
|
style={{
|
||||||
|
["--thread-max-width" as string]: "42rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ThreadPrimitive.Viewport className="flex h-full flex-col items-center overflow-y-scroll scroll-smooth bg-inherit px-4 pt-8">
|
||||||
|
<ThreadWelcome />
|
||||||
|
|
||||||
|
<ThreadPrimitive.Messages
|
||||||
|
components={{
|
||||||
|
UserMessage: UserMessage,
|
||||||
|
EditComposer: EditComposer,
|
||||||
|
AssistantMessage: AssistantMessage,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ThreadPrimitive.If empty={false}>
|
||||||
|
<div className="min-h-8 flex-grow" />
|
||||||
|
</ThreadPrimitive.If>
|
||||||
|
|
||||||
|
<div className="sticky bottom-0 mt-3 flex w-full max-w-[var(--thread-max-width)] flex-col items-center justify-end rounded-t-lg bg-inherit pb-4">
|
||||||
|
<ThreadScrollToBottom />
|
||||||
|
<Composer />
|
||||||
|
</div>
|
||||||
|
</ThreadPrimitive.Viewport>
|
||||||
|
</ThreadPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadScrollToBottom: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadPrimitive.ScrollToBottom asChild>
|
||||||
|
<TooltipIconButton
|
||||||
|
tooltip="Scroll to bottom"
|
||||||
|
variant="outline"
|
||||||
|
className="absolute -top-8 rounded-full disabled:invisible"
|
||||||
|
>
|
||||||
|
<ArrowDownIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ThreadPrimitive.ScrollToBottom>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadWelcome: FC = () => {
|
||||||
|
return (
|
||||||
|
<ThreadPrimitive.Empty>
|
||||||
|
<div className="flex w-full max-w-[var(--thread-max-width)] flex-grow flex-col">
|
||||||
|
<div className="flex w-full flex-grow flex-col items-center justify-center">
|
||||||
|
<p className="mt-4 font-medium">
|
||||||
|
How can I help you today?
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{/* <ThreadWelcomeSuggestions /> */}
|
||||||
|
</div>
|
||||||
|
</ThreadPrimitive.Empty>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThreadWelcomeSuggestions: FC = () => {
|
||||||
|
return (
|
||||||
|
<div className="mt-3 flex w-full items-stretch justify-center gap-4">
|
||||||
|
<ThreadPrimitive.Suggestion
|
||||||
|
className="hover:bg-muted/80 flex max-w-sm grow basis-0 flex-col items-center justify-center rounded-lg border p-3 transition-colors ease-in"
|
||||||
|
prompt="What is the weather in Tokyo?"
|
||||||
|
method="replace"
|
||||||
|
autoSend
|
||||||
|
>
|
||||||
|
<span className="line-clamp-2 text-ellipsis text-sm font-semibold">
|
||||||
|
What is the weather in Tokyo?
|
||||||
|
</span>
|
||||||
|
</ThreadPrimitive.Suggestion>
|
||||||
|
<ThreadPrimitive.Suggestion
|
||||||
|
className="hover:bg-muted/80 flex max-w-sm grow basis-0 flex-col items-center justify-center rounded-lg border p-3 transition-colors ease-in"
|
||||||
|
prompt="What is assistant-ui?"
|
||||||
|
method="replace"
|
||||||
|
autoSend
|
||||||
|
>
|
||||||
|
<span className="line-clamp-2 text-ellipsis text-sm font-semibold">
|
||||||
|
What is assistant-ui?
|
||||||
|
</span>
|
||||||
|
</ThreadPrimitive.Suggestion>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Composer: FC = () => {
|
||||||
|
return (
|
||||||
|
<ComposerPrimitive.Root className="focus-within:border-ring/20 flex w-full flex-wrap items-end rounded-lg border bg-inherit px-2.5 shadow-sm transition-colors ease-in">
|
||||||
|
<ComposerPrimitive.Input
|
||||||
|
rows={1}
|
||||||
|
autoFocus
|
||||||
|
placeholder="Write a message..."
|
||||||
|
className="placeholder:text-muted-foreground max-h-40 flex-grow resize-none border-none bg-transparent px-2 py-4 text-sm outline-none focus:ring-0 disabled:cursor-not-allowed"
|
||||||
|
/>
|
||||||
|
<ComposerAction />
|
||||||
|
</ComposerPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ComposerAction: FC = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ThreadPrimitive.If running={false}>
|
||||||
|
<ComposerPrimitive.Send asChild>
|
||||||
|
<TooltipIconButton
|
||||||
|
tooltip="Send"
|
||||||
|
variant="default"
|
||||||
|
className="my-2.5 size-8 p-2 transition-opacity ease-in"
|
||||||
|
>
|
||||||
|
<SendHorizontalIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ComposerPrimitive.Send>
|
||||||
|
</ThreadPrimitive.If>
|
||||||
|
<ThreadPrimitive.If running>
|
||||||
|
<ComposerPrimitive.Cancel asChild>
|
||||||
|
<TooltipIconButton
|
||||||
|
tooltip="Cancel"
|
||||||
|
variant="default"
|
||||||
|
className="my-2.5 size-8 p-2 transition-opacity ease-in"
|
||||||
|
>
|
||||||
|
<CircleStopIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ComposerPrimitive.Cancel>
|
||||||
|
</ThreadPrimitive.If>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const UserMessage: FC = () => {
|
||||||
|
return (
|
||||||
|
<MessagePrimitive.Root className="grid auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 [&:where(>*)]:col-start-2 w-full max-w-[var(--thread-max-width)] py-4">
|
||||||
|
<UserActionBar />
|
||||||
|
|
||||||
|
<div className="bg-muted text-foreground max-w-[calc(var(--thread-max-width)*0.8)] break-words rounded-3xl px-5 py-2.5 col-start-2 row-start-2">
|
||||||
|
<MessagePrimitive.Content />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<BranchPicker className="col-span-full col-start-1 row-start-3 -mr-1 justify-end" />
|
||||||
|
</MessagePrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const UserActionBar: FC = () => {
|
||||||
|
return (
|
||||||
|
<ActionBarPrimitive.Root
|
||||||
|
hideWhenRunning
|
||||||
|
autohide="not-last"
|
||||||
|
className="flex flex-col items-end col-start-1 row-start-2 mr-3 mt-2.5"
|
||||||
|
>
|
||||||
|
<ActionBarPrimitive.Edit asChild>
|
||||||
|
<TooltipIconButton tooltip="Edit">
|
||||||
|
<PencilIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ActionBarPrimitive.Edit>
|
||||||
|
</ActionBarPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const EditComposer: FC = () => {
|
||||||
|
return (
|
||||||
|
<ComposerPrimitive.Root className="bg-muted my-4 flex w-full max-w-[var(--thread-max-width)] flex-col gap-2 rounded-xl">
|
||||||
|
<ComposerPrimitive.Input className="text-foreground flex h-8 w-full resize-none bg-transparent p-4 pb-0 outline-none" />
|
||||||
|
|
||||||
|
<div className="mx-3 mb-3 flex items-center justify-center gap-2 self-end">
|
||||||
|
<ComposerPrimitive.Cancel asChild>
|
||||||
|
<Button variant="ghost">Cancel</Button>
|
||||||
|
</ComposerPrimitive.Cancel>
|
||||||
|
<ComposerPrimitive.Send asChild>
|
||||||
|
<Button>Send</Button>
|
||||||
|
</ComposerPrimitive.Send>
|
||||||
|
</div>
|
||||||
|
</ComposerPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AssistantMessage: FC = () => {
|
||||||
|
return (
|
||||||
|
<MessagePrimitive.Root className="grid grid-cols-[auto_auto_1fr] grid-rows-[auto_1fr] relative w-full max-w-[var(--thread-max-width)] py-4">
|
||||||
|
<div className="text-foreground max-w-[calc(var(--thread-max-width)*0.8)] break-words leading-7 col-span-2 col-start-2 row-start-1 my-1.5">
|
||||||
|
<MessagePrimitive.Content components={{ Text: MarkdownText }} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AssistantActionBar />
|
||||||
|
|
||||||
|
<BranchPicker className="col-start-2 row-start-2 -ml-2 mr-2" />
|
||||||
|
</MessagePrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AssistantActionBar: FC = () => {
|
||||||
|
return (
|
||||||
|
<ActionBarPrimitive.Root
|
||||||
|
hideWhenRunning
|
||||||
|
autohide="not-last"
|
||||||
|
autohideFloat="single-branch"
|
||||||
|
className="text-muted-foreground flex gap-1 col-start-3 row-start-2 -ml-1 data-[floating]:bg-background data-[floating]:absolute data-[floating]:rounded-md data-[floating]:border data-[floating]:p-1 data-[floating]:shadow-sm"
|
||||||
|
>
|
||||||
|
<ActionBarPrimitive.Copy asChild>
|
||||||
|
<TooltipIconButton tooltip="Copy">
|
||||||
|
<MessagePrimitive.If copied>
|
||||||
|
<CheckIcon />
|
||||||
|
</MessagePrimitive.If>
|
||||||
|
<MessagePrimitive.If copied={false}>
|
||||||
|
<CopyIcon />
|
||||||
|
</MessagePrimitive.If>
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ActionBarPrimitive.Copy>
|
||||||
|
<ActionBarPrimitive.Reload asChild>
|
||||||
|
<TooltipIconButton tooltip="Refresh">
|
||||||
|
<RefreshCwIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</ActionBarPrimitive.Reload>
|
||||||
|
</ActionBarPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
|
||||||
|
className,
|
||||||
|
...rest
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<BranchPickerPrimitive.Root
|
||||||
|
hideWhenSingleBranch
|
||||||
|
className={cn(
|
||||||
|
"text-muted-foreground inline-flex items-center text-xs",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
<BranchPickerPrimitive.Previous asChild>
|
||||||
|
<TooltipIconButton tooltip="Previous">
|
||||||
|
<ChevronLeftIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</BranchPickerPrimitive.Previous>
|
||||||
|
<span className="font-medium">
|
||||||
|
<BranchPickerPrimitive.Number /> /{" "}
|
||||||
|
<BranchPickerPrimitive.Count />
|
||||||
|
</span>
|
||||||
|
<BranchPickerPrimitive.Next asChild>
|
||||||
|
<TooltipIconButton tooltip="Next">
|
||||||
|
<ChevronRightIcon />
|
||||||
|
</TooltipIconButton>
|
||||||
|
</BranchPickerPrimitive.Next>
|
||||||
|
</BranchPickerPrimitive.Root>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const CircleStopIcon = () => {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
fill="currentColor"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
>
|
||||||
|
<rect width="10" height="10" x="3" y="3" rx="2" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
};
|
||||||
44
components/assistant-ui/tooltip-icon-button.tsx
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ComponentPropsWithoutRef, forwardRef } from "react";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipProvider,
|
||||||
|
TooltipTrigger,
|
||||||
|
} from "@/components/ui/tooltip";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
export type TooltipIconButtonProps = ComponentPropsWithoutRef<typeof Button> & {
|
||||||
|
tooltip: string;
|
||||||
|
side?: "top" | "bottom" | "left" | "right";
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TooltipIconButton = forwardRef<
|
||||||
|
HTMLButtonElement,
|
||||||
|
TooltipIconButtonProps
|
||||||
|
>(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
|
||||||
|
return (
|
||||||
|
<TooltipProvider>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
{...rest}
|
||||||
|
className={cn("size-6 p-1", className)}
|
||||||
|
ref={ref}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<span className="sr-only">{tooltip}</span>
|
||||||
|
</Button>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side={side}>{tooltip}</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</TooltipProvider>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
TooltipIconButton.displayName = "TooltipIconButton";
|
||||||
59
components/ui/button.tsx
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { Slot } from "@radix-ui/react-slot"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const buttonVariants = cva(
|
||||||
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default:
|
||||||
|
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||||
|
outline:
|
||||||
|
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
||||||
|
ghost:
|
||||||
|
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||||
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||||
|
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
||||||
|
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||||
|
icon: "size-9",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Button({
|
||||||
|
className,
|
||||||
|
variant,
|
||||||
|
size,
|
||||||
|
asChild = false,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"button"> &
|
||||||
|
VariantProps<typeof buttonVariants> & {
|
||||||
|
asChild?: boolean
|
||||||
|
}) {
|
||||||
|
const Comp = asChild ? Slot : "button"
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
data-slot="button"
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Button, buttonVariants }
|
||||||
61
components/ui/tooltip.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
function TooltipProvider({
|
||||||
|
delayDuration = 0,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
||||||
|
return (
|
||||||
|
<TooltipPrimitive.Provider
|
||||||
|
data-slot="tooltip-provider"
|
||||||
|
delayDuration={delayDuration}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Tooltip({
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||||
|
return (
|
||||||
|
<TooltipProvider>
|
||||||
|
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||||
|
</TooltipProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function TooltipTrigger({
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
||||||
|
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
|
function TooltipContent({
|
||||||
|
className,
|
||||||
|
sideOffset = 0,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||||
|
return (
|
||||||
|
<TooltipPrimitive.Portal>
|
||||||
|
<TooltipPrimitive.Content
|
||||||
|
data-slot="tooltip-content"
|
||||||
|
sideOffset={sideOffset}
|
||||||
|
className={cn(
|
||||||
|
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
|
||||||
|
</TooltipPrimitive.Content>
|
||||||
|
</TooltipPrimitive.Portal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||||
6
lib/utils.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { clsx, type ClassValue } from "clsx"
|
||||||
|
import { twMerge } from "tailwind-merge"
|
||||||
|
|
||||||
|
export function cn(...inputs: ClassValue[]) {
|
||||||
|
return twMerge(clsx(inputs))
|
||||||
|
}
|
||||||
7
next.config.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
|
const nextConfig: NextConfig = {
|
||||||
|
/* config options here */
|
||||||
|
};
|
||||||
|
|
||||||
|
export default nextConfig;
|
||||||
4906
package-lock.json
generated
Normal file
43
package.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "next-ai-draw-io",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "next dev --turbopack",
|
||||||
|
"build": "next build",
|
||||||
|
"start": "next start",
|
||||||
|
"lint": "next lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@ai-sdk/google": "^1.1.25",
|
||||||
|
"@ai-sdk/openai": "^1.2.5",
|
||||||
|
"@assistant-ui/react": "^0.8.6",
|
||||||
|
"@assistant-ui/react-ai-sdk": "^0.8.0",
|
||||||
|
"@assistant-ui/react-markdown": "^0.8.0",
|
||||||
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
|
"@radix-ui/react-tooltip": "^1.1.8",
|
||||||
|
"@xmldom/xmldom": "^0.9.8",
|
||||||
|
"ai": "^4.1.62",
|
||||||
|
"base-64": "^1.0.0",
|
||||||
|
"class-variance-authority": "^0.7.1",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"jsdom": "^26.0.0",
|
||||||
|
"lucide-react": "^0.483.0",
|
||||||
|
"next": "15.2.3",
|
||||||
|
"pako": "^2.1.0",
|
||||||
|
"react": "^19.0.0",
|
||||||
|
"react-dom": "^19.0.0",
|
||||||
|
"react-drawio": "^1.0.3",
|
||||||
|
"remark-gfm": "^4.0.1",
|
||||||
|
"tailwind-merge": "^3.0.2",
|
||||||
|
"tailwindcss-animate": "^1.0.7"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tailwindcss/postcss": "^4",
|
||||||
|
"@types/node": "^20",
|
||||||
|
"@types/react": "^19",
|
||||||
|
"@types/react-dom": "^19",
|
||||||
|
"tailwindcss": "^4",
|
||||||
|
"typescript": "^5"
|
||||||
|
}
|
||||||
|
}
|
||||||
5
postcss.config.mjs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const config = {
|
||||||
|
plugins: ["@tailwindcss/postcss"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
1
public/file.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||||
|
After Width: | Height: | Size: 391 B |
1
public/globe.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
1
public/next.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
1
public/vercel.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||||
|
After Width: | Height: | Size: 128 B |
1
public/window.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||||
|
After Width: | Height: | Size: 385 B |
87
test.html
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
style="background: transparent; background-color: transparent"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
version="1.1"
|
||||||
|
width="261px"
|
||||||
|
height="191px"
|
||||||
|
viewBox="-0.5 -0.5 261 191"
|
||||||
|
content='<mxfile host="embed.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" version="26.1.1"><diagram name="Page-1" id="NsivuNt5aJDXaP8udwGv">zZTBboMwDIafhjsQVrXXsa697MRh54h4JFIgKE0L7OkXFoeQsUm7bOoF2Z9tbP+BJKRsx5OmPX9RDGSSp2xMyFOS5+RQ2OcMJgd2OwSNFsyhLIBKvAPCFOlVMLhEiUYpaUQfw1p1HdQmYlRrNcRpb0rGXXvawAZUNZVb+iqY4Y7uH9LAzyAa7jtnKUZa6pMRXDhlalghckxIqZUyzmrHEuSsndfF1T3/EF0G09CZ3xTkruBG5RV3w7nM5Je1BVZX6zwOXBioelrPkcGerGXctNJ6mTW3vXGcG2gD4wrhLCdQLRg92RQfJajL9MUfgsyZ146vJN4jo3iyzfLqsLw1cP/vtSB3pkUaa5EX/6hFcV9aLLv77+Lwd1pYN/x/n7HVJUaOHw==</diagram></mxfile>'
|
||||||
|
>
|
||||||
|
<defs />
|
||||||
|
<g>
|
||||||
|
<g data-cell-id="0">
|
||||||
|
<g data-cell-id="1">
|
||||||
|
<g data-cell-id="2">
|
||||||
|
<g>
|
||||||
|
<ellipse
|
||||||
|
cx="90"
|
||||||
|
cy="40"
|
||||||
|
rx="60"
|
||||||
|
ry="40"
|
||||||
|
fill="#ffffff"
|
||||||
|
stroke="#000000"
|
||||||
|
pointer-events="all"
|
||||||
|
style="
|
||||||
|
fill: light-dark(
|
||||||
|
#ffffff,
|
||||||
|
var(--ge-dark-color, #121212)
|
||||||
|
);
|
||||||
|
stroke: light-dark(
|
||||||
|
rgb(0, 0, 0),
|
||||||
|
rgb(255, 255, 255)
|
||||||
|
);
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g data-cell-id="3">
|
||||||
|
<g>
|
||||||
|
<ellipse
|
||||||
|
cx="60"
|
||||||
|
cy="150"
|
||||||
|
rx="60"
|
||||||
|
ry="40"
|
||||||
|
fill="#ffffff"
|
||||||
|
stroke="#000000"
|
||||||
|
pointer-events="all"
|
||||||
|
style="
|
||||||
|
fill: light-dark(
|
||||||
|
#ffffff,
|
||||||
|
var(--ge-dark-color, #121212)
|
||||||
|
);
|
||||||
|
stroke: light-dark(
|
||||||
|
rgb(0, 0, 0),
|
||||||
|
rgb(255, 255, 255)
|
||||||
|
);
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g data-cell-id="4">
|
||||||
|
<g>
|
||||||
|
<ellipse
|
||||||
|
cx="200"
|
||||||
|
cy="100"
|
||||||
|
rx="60"
|
||||||
|
ry="40"
|
||||||
|
fill="#ffffff"
|
||||||
|
stroke="#000000"
|
||||||
|
pointer-events="all"
|
||||||
|
style="
|
||||||
|
fill: light-dark(
|
||||||
|
#ffffff,
|
||||||
|
var(--ge-dark-color, #121212)
|
||||||
|
);
|
||||||
|
stroke: light-dark(
|
||||||
|
rgb(0, 0, 0),
|
||||||
|
rgb(255, 255, 255)
|
||||||
|
);
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.7 KiB |
27
tsconfig.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2017",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"incremental": true,
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "next"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
||||||