diff --git a/app/legal/action.ts b/app/legal/action.ts deleted file mode 100644 index 3af45bd8..00000000 --- a/app/legal/action.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NextResponse } from 'next/server' -import fs from 'fs' -import path from 'path' - -export async function readFile(dir: string, file: string) { - 'use server' - - const filePath = path.join(process.cwd(), dir, file) - const fileContents = fs.readFileSync(filePath, 'utf8') - - return NextResponse.json({ fileContents }) -} diff --git a/app/legal/privacy/layout.tsx b/app/legal/privacy/layout.tsx new file mode 100644 index 00000000..2af683f0 --- /dev/null +++ b/app/legal/privacy/layout.tsx @@ -0,0 +1,9 @@ +export default function MdxLayout({ children }: { children: React.ReactNode }) { + return ( +
+
+ {children} +
+
+ ) +} diff --git a/app/legal/privacy/page.tsx b/app/legal/privacy/page.tsx index 954069dd..c35a54a7 100644 --- a/app/legal/privacy/page.tsx +++ b/app/legal/privacy/page.tsx @@ -1,9 +1,5 @@ -import MdContents from '@/components/md-contents' -import { readFile } from '../action' +import Privacy from '@/markdown/privacy.mdx' -export default async function PrivacyPage() { - const res = await readFile('./public/legal', 'privacy.md') - const { fileContents } = await res.json() - - return +export default function Page() { + return } diff --git a/app/legal/terms/layout.tsx b/app/legal/terms/layout.tsx new file mode 100644 index 00000000..2af683f0 --- /dev/null +++ b/app/legal/terms/layout.tsx @@ -0,0 +1,9 @@ +export default function MdxLayout({ children }: { children: React.ReactNode }) { + return ( +
+
+ {children} +
+
+ ) +} diff --git a/app/legal/terms/page.tsx b/app/legal/terms/page.tsx index e855a2d8..4f99e1dd 100644 --- a/app/legal/terms/page.tsx +++ b/app/legal/terms/page.tsx @@ -1,9 +1,5 @@ -import MdContents from '@/components/md-contents' -import { readFile } from '../action' +import Terms from '@/markdown/terms.mdx' -export default async function TermsOfUsePage() { - const res = await readFile('./public/legal', 'terms.md') - const { fileContents } = await res.json() - - return +export default function Page() { + return } diff --git a/bun.lockb b/bun.lockb index 80845fdf..cc6a2e6c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/lib/agents/inquire.tsx b/lib/agents/inquire.tsx index 79fb9be5..468eb0fa 100644 --- a/lib/agents/inquire.tsx +++ b/lib/agents/inquire.tsx @@ -1,4 +1,4 @@ -import { OpenAI } from 'ai/openai' +import { OpenAI } from '@ai-sdk/openai' import { Copilot } from '@/components/copilot' import { createStreamableUI, createStreamableValue } from 'ai/rsc' import { ExperimentalMessage, experimental_streamObject } from 'ai' diff --git a/lib/agents/query-suggestor.tsx b/lib/agents/query-suggestor.tsx index ef2319d8..13d30a8f 100644 --- a/lib/agents/query-suggestor.tsx +++ b/lib/agents/query-suggestor.tsx @@ -3,7 +3,7 @@ import { ExperimentalMessage, experimental_streamObject } from 'ai' import { PartialRelated, relatedSchema } from '@/lib/schema/related' import { Section } from '@/components/section' import SearchRelated from '@/components/search-related' -import { OpenAI } from 'ai/openai' +import { OpenAI } from '@ai-sdk/openai' import type { AgentOptions } from './types' import { DEFAULT_MODEL } from '../aiModel/utils' diff --git a/lib/agents/researcher.tsx b/lib/agents/researcher.tsx index 9be921e3..d6f95a72 100644 --- a/lib/agents/researcher.tsx +++ b/lib/agents/researcher.tsx @@ -7,7 +7,7 @@ import { } from 'ai' import { searchSchema } from '@/lib/schema/search' import { Section } from '@/components/section' -import { OpenAI } from 'ai/openai' +import { OpenAI } from '@ai-sdk/openai' import { ToolBadge } from '@/components/tool-badge' import { SearchSkeleton } from '@/components/search-skeleton' import { SearchResults } from '@/components/search-results' diff --git a/lib/agents/task-manager.tsx b/lib/agents/task-manager.tsx index 66b49255..e76920ea 100644 --- a/lib/agents/task-manager.tsx +++ b/lib/agents/task-manager.tsx @@ -1,5 +1,5 @@ import { ExperimentalMessage, experimental_generateObject } from 'ai' -import { OpenAI } from 'ai/openai' +import { OpenAI } from '@ai-sdk/openai' import { nextActionSchema } from '../schema/next-action' import type { AgentOptions } from './types' import { DEFAULT_MODEL } from '../aiModel/utils' diff --git a/public/legal/privacy.md b/markdown/privacy.mdx similarity index 100% rename from public/legal/privacy.md rename to markdown/privacy.mdx diff --git a/public/legal/terms.md b/markdown/terms.mdx similarity index 100% rename from public/legal/terms.md rename to markdown/terms.mdx diff --git a/mdx-components.tsx b/mdx-components.tsx new file mode 100644 index 00000000..d5d1fc9f --- /dev/null +++ b/mdx-components.tsx @@ -0,0 +1,7 @@ +import type { MDXComponents } from 'mdx/types' + +export function useMDXComponents(components: MDXComponents): MDXComponents { + return { + ...components + } +} diff --git a/next.config.mjs b/next.config.mjs index 4678774e..a2ffa5cf 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,9 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = {}; +import createMDX from '@next/mdx' -export default nextConfig; +const nextConfig = { + pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'] +} + +const withMDX = createMDX() + +export default withMDX(nextConfig) diff --git a/package.json b/package.json index 6c03f7ca..3eee9125 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,10 @@ "preinstall": "bunx prisma generate" }, "dependencies": { + "@ai-sdk/openai": "^0.0.2", + "@mdx-js/loader": "^3.0.1", + "@mdx-js/react": "^3.0.1", + "@next/mdx": "^14.2.2", "@prisma/client": "^5.12.1", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-checkbox": "^1.0.4", @@ -24,6 +28,7 @@ "@supabase/ssr": "^0.1.0", "@supabase/supabase-js": "^2.42.0", "@tailwindcss/typography": "^0.5.12", + "@types/mdx": "^2.0.13", "@vercel/analytics": "^1.2.2", "ai": "^3.0.14", "class-variance-authority": "^0.7.0", @@ -31,7 +36,7 @@ "embla-carousel-react": "^8.0.0", "exa-js": "^1.0.12", "lucide-react": "^0.363.0", - "next": "v14.2.0-canary.60", + "next": "latest", "next-themes": "^0.3.0", "react": "^18", "react-dom": "^18",