Skip to content

Commit

Permalink
getting credentials from env instead of cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
naqi committed Oct 2, 2023
1 parent 353eca5 commit ad5ac3d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ export const runtime = "edge"

export async function POST(request: NextRequest) {
const body = await request.json()
// Get credentials from cookies
const credentials = JSON.parse(
request.cookies.get("credentials")?.value || null
)
// Get credentials from ENV
const credentials = {
pineconeIndex: process.env.PINECONE_INDEX_NAME,
pineconeEnvironment: process.env.PINECONE_ENVIRONMENT,
pineconeApiKey: process.env.PINECONE_API_KEY,
openaiApiKey: process.env.OPENAI_API_KEY,
supabaseKey: process.env.SUPABASE_KEY,
supabaseUrl: process.env.SUPABASE_URL,
supabaseBucket: process.env.SUPABASE_BUCKET,
supabaseDatabaseUrl: process.env.DATABASE_URL,
supabaseDirectUrl: process.env.DIRECT_URL
}
if (
!credentials ||
!credentials.pineconeIndex ||
Expand Down

0 comments on commit ad5ac3d

Please sign in to comment.