Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
lvwzhen committed May 8, 2023
1 parent 015d9a3 commit b8fa8b9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pages/api/vector-search.ts
Expand Up @@ -11,7 +11,6 @@ export const config = {
}

const openAiKey = process.env.OPENAI_KEY
const openAiBaseUrl = process.env.OPENAI_BASE_URL || 'api.openai.com';
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseServiceKey = process.env.SUPABASE_SERVICE_ROLE_KEY

Expand Down Expand Up @@ -45,7 +44,7 @@ export default async function handler(req: NextRequest) {

// Moderate the content to comply with OpenAI T&C
const sanitizedQuery = query.trim()
const moderationResponse = await fetch('https://' + openAiBaseUrl + '/v1/moderations', {
const moderationResponse = await fetch('https://api.openai.com/v1/moderations', {
method: 'POST',
headers: {
Authorization: `Bearer ${openAiKey}`,
Expand All @@ -65,7 +64,7 @@ export default async function handler(req: NextRequest) {
})
}

const embeddingResponse = await fetch('https://' + openAiBaseUrl + '/v1/embeddings', {
const embeddingResponse = await fetch('https://api.openai.com/v1/embeddings', {
method: 'POST',
headers: {
Authorization: `Bearer ${openAiKey}`,
Expand Down Expand Up @@ -144,7 +143,7 @@ export default async function handler(req: NextRequest) {
stream: true,
}

const response = await fetch('https://' + openAiBaseUrl + '/v1/chat/completions', {
const response = await fetch('https://api.openai.com/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: `Bearer ${openAiKey}`,
Expand Down

1 comment on commit b8fa8b9

@vercel
Copy link

@vercel vercel bot commented on b8fa8b9 May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.