a70f0c52a9
CI / test (pull_request) Failing after 8s
- Added CORS handling for the create-chat-conversation function. - Implemented health check endpoint for the function. - Created endpoints for managing conversations and messages with OpenAI. - Added error handling and response formatting for better API usability. - Introduced utility functions for environment variable management and Supabase client creation. - Enhanced schema handling for structured responses from OpenAI. - Implemented conversation archiving and retrieval logic.
13 lines
457 B
TypeScript
13 lines
457 B
TypeScript
export const corsHeaders: Record<string, string> = {
|
|
"access-control-allow-origin": "*",
|
|
"access-control-allow-headers":
|
|
"authorization, x-client-info, apikey, content-type",
|
|
"access-control-allow-methods": "GET,POST,OPTIONS",
|
|
};
|
|
|
|
export function withCors(res: Response) {
|
|
const h = new Headers(res.headers);
|
|
for (const [k, v] of Object.entries(corsHeaders)) h.set(k, v);
|
|
return new Response(res.body, { status: res.status, headers: h });
|
|
}
|