We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried implementing CORS based on the documentation provided in edge-functions-cors but unfortunately, it's not functioning as expected.
import { OpenAIStream } from "@/utils/OpenAIStream"; import cors from "@/utils/cors"; import { NextRequest } from "next/server"; export const config = { runtime: "edge", }; const handler = async (req: NextRequest): Promise<Response> => { const { prompt } = (await req.json()) as { prompt?: string; }; const payload = { model: "gpt-3.5-turbo", messages: [{ role: 'user', content: prompt }], temperature: 0.9, stream: true, // max_tokens: maxWordLimit, }; const stream = await OpenAIStream(payload); return cors(req, new Response(stream, { headers: { 'Content-Type': 'application/octet-stream', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Content-Type', } })) }; export default handler;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I tried implementing CORS based on the documentation provided in edge-functions-cors
but unfortunately, it's not functioning as expected.
The text was updated successfully, but these errors were encountered: