diff --git a/.env.local.example b/.env.local.example index 212afab..d4d865d 100644 --- a/.env.local.example +++ b/.env.local.example @@ -1,3 +1,4 @@ OPENAI_API_KEY=xxxxxxx OPENAI_MODEL=gpt-4-1106-preview TAVILY_API_KEY=xxxxxxx +UNIFY_API_KEY=xxxxxxx \ No newline at end of file diff --git a/src/app/api/copilotkit/route.ts b/src/app/api/copilotkit/route.ts index 747e59c..561d012 100644 --- a/src/app/api/copilotkit/route.ts +++ b/src/app/api/copilotkit/route.ts @@ -4,7 +4,7 @@ import { NextRequest } from "next/server"; import { CopilotRuntime, copilotRuntimeNextJSAppRouterEndpoint, - OpenAIAdapter, + UnifyAdapter, } from "@copilotkit/runtime"; const UNSPLASH_ACCESS_KEY_ENV = "UNSPLASH_ACCESS_KEY"; @@ -72,13 +72,14 @@ export const POST = async (req: NextRequest) => { actions.push(researchAction); } - const openaiModel = process.env["OPENAI_MODEL"]; - console.log("ENV.COPILOT_CLOUD_API_KEY", process.env.COPILOT_CLOUD_API_KEY); const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({ runtime: new CopilotRuntime({ actions }), - serviceAdapter: new OpenAIAdapter({ model: openaiModel }), + serviceAdapter: new UnifyAdapter({ + apiKey: process.env.UNIFY_API_KEY, + model: "router@q:0.5|c:0.013|models:gpt-4o,gpt-3.5-turbo|providers:openai" + }), endpoint: req.nextUrl.pathname, }); diff --git a/src/app/page.tsx b/src/app/page.tsx index 37780fe..4f42178 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -11,7 +11,7 @@ export default function AIPresentation() { return (