diff --git a/apps/nextjs/app/api/copilotkit/openai/route.ts b/apps/nextjs/app/api/copilotkit/openai/route.ts new file mode 100644 index 000000000..ecae35fab --- /dev/null +++ b/apps/nextjs/app/api/copilotkit/openai/route.ts @@ -0,0 +1,9 @@ +import { CopilotBackend, OpenAIAdapter } from "@copilotkit/backend"; + +export const runtime = "edge"; + +export async function POST(req: Request): Promise { + const copilotKit = new CopilotBackend(); + + return copilotKit.response(req, new OpenAIAdapter()); +} diff --git a/apps/nextjs/app/api/dfda/[dfdaPath]/route.ts b/apps/nextjs/app/api/dfda/[dfdaPath]/route.ts index 4a1b4219f..bf21eea40 100644 --- a/apps/nextjs/app/api/dfda/[dfdaPath]/route.ts +++ b/apps/nextjs/app/api/dfda/[dfdaPath]/route.ts @@ -39,10 +39,10 @@ async function fetchDfdaApi(req: Request, method: 'GET' | 'POST', context: z.inf const requestBody = await req.json(); init.body = JSON.stringify(requestBody); } - console.log(`Making ${method} request to ${dfdaUrl} with init:`, init); + console.log(`Making ${method} request to ${dfdaUrl}`); // with init:`, init); const response = await fetch(dfdaUrl, init); const data = await response.json(); - console.log("Response data:", data); + //console.log("Response data:", data); return new Response(JSON.stringify(data), { status: 200, headers: { 'Content-Type': 'application/json' } }) } catch (error) { return handleError(error); diff --git a/apps/nextjs/app/layout.tsx b/apps/nextjs/app/layout.tsx index de0e7c31a..7cb8072d4 100644 --- a/apps/nextjs/app/layout.tsx +++ b/apps/nextjs/app/layout.tsx @@ -8,6 +8,9 @@ import { siteConfig } from "@/config/site" import { cn } from "@/lib/utils" import { Toaster } from "@/components/ui/toaster" import { ThemeProvider } from "@/components/theme-provider" +import { CopilotKit } from "@copilotkit/react-core"; +import { CopilotSidebar } from "@copilotkit/react-ui"; +//import "@copilotkit/react-ui/styles.css"; const inter = Inter({ subsets: ["latin"] }) @@ -73,6 +76,8 @@ export default async function RootLayout({ children }: RootLayoutProps) { + {/**/} + {/* */}
+ {/* */} + {/**/} diff --git a/apps/nextjs/components/chat-component.tsx b/apps/nextjs/components/chat-component.tsx index 7ecbcc1e1..a551b4bfe 100644 --- a/apps/nextjs/components/chat-component.tsx +++ b/apps/nextjs/components/chat-component.tsx @@ -4,10 +4,10 @@ import { FullPageChat } from 'flowise-embed-react'; export default function ChatComponent() { return