chore(docs-gpt): update env variable names

This commit is contained in:
Greg Richardson committed 2023-01-30 08:27:19 -07:00
1 parent f93e97cf6d
commit 33c376486f
3 files changed
+11 -13

No files matched your search

+5 -5
View File
@@ -185,18 +185,18 @@ async function walk(dir: string): Promise<string[]> {
async function generateEmbeddings() {
if (
!process.env.DOCS_SEARCH_SUPABASE_URL ||
!process.env.DOCS_SEARCH_SUPABASE_SERVICE_KEY ||
!process.env.NEXT_PUBLIC_SUPABASE_URL ||
!process.env.META_SUPABASE_SERVICE_KEY ||
!process.env.OPENAI_KEY
) {
return console.log(
'Environment variables DOCS_SEARCH_SUPABASE_URL, DOCS_SEARCH_SUPABASE_SERVICE_KEY, and OPENAI_KEY are required: skipping embeddings generation'
'Environment variables NEXT_PUBLIC_SUPABASE_URL, META_SUPABASE_SERVICE_KEY, and OPENAI_KEY are required: skipping embeddings generation'
)
}
const supabaseClient = createClient(
process.env.DOCS_SEARCH_SUPABASE_URL,
process.env.DOCS_SEARCH_SUPABASE_SERVICE_KEY
process.env.NEXT_PUBLIC_SUPABASE_URL,
process.env.META_SUPABASE_SERVICE_KEY
)
const markdownFiles = (await walk('pages'))
+1 -1
View File
@@ -1,6 +1,6 @@
# A string used to distinguish different Supabase projects on the same host. Defaults to the working
# directory name when running `supabase init`.
project_id = "docs"
project_id = "supabase"
[api]
# Port to use for the API URL.
+5 -7
View File
@@ -5,8 +5,8 @@ import GPT3Tokenizer from 'https://esm.sh/gpt3-tokenizer@1.1.5'
import { Configuration, OpenAIApi } from 'https://esm.sh/openai@3.1.0'
const openAiKey = Deno.env.get('OPENAI_KEY')
const supabaseUrl = Deno.env.get('DOCS_SEARCH_SUPABASE_URL')
const supabaseServiceKey = Deno.env.get('DOCS_SEARCH_SUPABASE_SERVICE_KEY')
const supabaseUrl = Deno.env.get('META_SUPABASE_URL')
const supabaseServiceKey = Deno.env.get('META_SUPABASE_SERVICE_KEY')
export const corsHeaders = {
'Access-Control-Allow-Origin': '*',
@@ -34,7 +34,7 @@ serve(async (req) => {
if (!supabaseUrl) {
return new Response(
JSON.stringify({
error: 'Missing environment variable DOCS_SEARCH_SUPABASE_URL',
error: 'Missing environment variable META_SUPABASE_URL',
}),
{
status: 400,
@@ -46,7 +46,7 @@ serve(async (req) => {
if (!supabaseServiceKey) {
return new Response(
JSON.stringify({
error: 'Missing environment variable DOCS_SEARCH_SUPABASE_SERVICE_KEY',
error: 'Missing environment variable META_SUPABASE_SERVICE_KEY',
}),
{
status: 400,
@@ -71,9 +71,7 @@ serve(async (req) => {
const { query } = requestData
console.log(supabaseUrl, supabaseServiceKey)
const supabaseClient = createClient('http://supabase_kong_docs:8000', supabaseServiceKey)
const supabaseClient = createClient(supabaseUrl, supabaseServiceKey)
const configuration = new Configuration({ apiKey: openAiKey })
const openai = new OpenAIApi(configuration)