Dashboard
41 |48 | Projects: 49 |
-
50 | {projects.map((project) => (
51 |
-
52 |
53 |
{project.name}
54 | 55 |
56 | ))}
57 |
59 |
{project.name}
54 | 55 |36 |42 |37 | “We want to create the best developer experience for 38 | people developing with AI.” 39 |
40 | 41 |
51 | We will get back to you as soon as possible with how to use your 52 | account. 53 |
54 |Indexes:
93 |{index.name}
98 | 99 |
2 |
3 |
4 |
49 |55 |50 | “This platform helped go to production fast, without 51 | having to study a line of AI.” 52 |
53 | 54 |
64 | Enter your credentials below to create your account 65 |
66 |69 | By clicking continue, you agree to our{' '} 70 | 74 | Terms of Service 75 | {' '} 76 | and{' '} 77 | 81 | Privacy Policy 82 | 83 | . 84 |
*/} 85 |49 |55 |50 | “We want to create the best developer experience for 51 | people developing with AI.” 52 |
53 | 54 |
64 | Enter your credentials below to create your account 65 |
66 |Upload document
106 | 116 |135 | {document.content.slice(0, 50) + 136 | (document.content.length > 15 ? '...' : '')} 137 |
138 |162 | {body} 163 |
164 | ); 165 | }); 166 | FormMessage.displayName = 'FormMessage'; 167 | 168 | export { 169 | useFormField, 170 | Form, 171 | FormItem, 172 | FormLabel, 173 | FormControl, 174 | FormDescription, 175 | FormMessage, 176 | FormField, 177 | }; 178 | -------------------------------------------------------------------------------- /supabase/config.toml: -------------------------------------------------------------------------------- 1 | # A string used to distinguish different Supabase projects on the same host. Defaults to the 2 | # working directory name when running `supabase init`. 3 | project_id = "studio" 4 | 5 | [api] 6 | enabled = true 7 | # Port to use for the API URL. 8 | port = 54321 9 | # Schemas to expose in your API. Tables, views and stored procedures in this schema will get API 10 | # endpoints. public and storage are always included. 11 | schemas = ["public", "storage", "graphql_public"] 12 | # Extra schemas to add to the search_path of every request. public is always included. 13 | extra_search_path = ["public", "extensions"] 14 | # The maximum number of rows returns from a view, table, or stored procedure. Limits payload size 15 | # for accidental or malicious requests. 16 | max_rows = 1000 17 | 18 | [db] 19 | # Port to use for the local database URL. 20 | port = 54322 21 | # Port used by db diff command to initialise the shadow database. 22 | shadow_port = 54320 23 | # The database major version to use. This has to be the same as your remote database's. Run `SHOW 24 | # server_version;` on the remote database to check. 25 | major_version = 15 26 | 27 | [db.pooler] 28 | enabled = false 29 | # Port to use for the local connection pooler. 30 | port = 54329 31 | # Specifies when a server connection can be reused by other clients. 32 | # Configure one of the supported pooler modes: `transaction`, `session`. 33 | pool_mode = "transaction" 34 | # How many server connections to allow per user/database pair. 35 | default_pool_size = 20 36 | # Maximum number of client connections allowed. 37 | max_client_conn = 100 38 | 39 | [realtime] 40 | enabled = true 41 | # Bind realtime via either IPv4 or IPv6. (default: IPv6) 42 | # ip_version = "IPv6" 43 | 44 | [studio] 45 | enabled = true 46 | # Port to use for Supabase Studio. 47 | port = 54323 48 | # External URL of the API server that frontend connects to. 49 | api_url = "http://localhost" 50 | 51 | # Email testing server. Emails sent with the local dev setup are not actually sent - rather, they 52 | # are monitored, and you can view the emails that would have been sent from the web interface. 53 | [inbucket] 54 | enabled = true 55 | # Port to use for the email testing server web interface. 56 | port = 54324 57 | # Uncomment to expose additional ports for testing user applications that send emails. 58 | # smtp_port = 54325 59 | # pop3_port = 54326 60 | 61 | [storage] 62 | enabled = true 63 | # The maximum file size allowed (e.g. "5MB", "500KB"). 64 | file_size_limit = "50MiB" 65 | 66 | [auth] 67 | enabled = true 68 | # The base URL of your website. Used as an allow-list for redirects and for constructing URLs used 69 | # in emails. 70 | site_url = "http://localhost:3000" 71 | # A list of *exact* URLs that auth providers are permitted to redirect to post authentication. 72 | additional_redirect_urls = ["https://localhost:3000"] 73 | # How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week). 74 | jwt_expiry = 3600 75 | # If disabled, the refresh token will never expire. 76 | enable_refresh_token_rotation = true 77 | # Allows refresh tokens to be reused after expiry, up to the specified interval in seconds. 78 | # Requires enable_refresh_token_rotation = true. 79 | refresh_token_reuse_interval = 10 80 | # Allow/disallow new user signups to your project. 81 | enable_signup = true 82 | 83 | [auth.email] 84 | # Allow/disallow new user signups via email to your project. 85 | enable_signup = true 86 | # If enabled, a user will be required to confirm any email change on both the old, and new email 87 | # addresses. If disabled, only the new email is required to confirm. 88 | double_confirm_changes = true 89 | # If enabled, users need to confirm their email address before signing in. 90 | enable_confirmations = false 91 | 92 | # Uncomment to customize email template 93 | # [auth.email.template.invite] 94 | # subject = "You have been invited" 95 | # content_path = "./supabase/templates/invite.html" 96 | 97 | [auth.sms] 98 | # Allow/disallow new user signups via SMS to your project. 99 | enable_signup = true 100 | # If enabled, users need to confirm their phone number before signing in. 101 | enable_confirmations = false 102 | 103 | # Use pre-defined map of phone number to OTP for testing. 104 | [auth.sms.test_otp] 105 | # 4152127777 = "123456" 106 | 107 | # Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`. 108 | [auth.sms.twilio] 109 | enabled = false 110 | account_sid = "" 111 | message_service_sid = "" 112 | # DO NOT commit your Twilio auth token to git. Use environment variable substitution instead: 113 | auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)" 114 | 115 | # Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`, 116 | # `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `notion`, `twitch`, 117 | # `twitter`, `slack`, `spotify`, `workos`, `zoom`. 118 | [auth.external.apple] 119 | enabled = false 120 | client_id = "" 121 | # DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead: 122 | secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)" 123 | # Overrides the default auth redirectUrl. 124 | redirect_uri = "" 125 | # Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure, 126 | # or any other third-party OIDC providers. 127 | url = "" 128 | 129 | [analytics] 130 | enabled = false 131 | port = 54327 132 | vector_port = 54328 133 | # Configure one of the supported backends: `postgres`, `bigquery`. 134 | backend = "postgres" -------------------------------------------------------------------------------- /src/app/api/documents/route.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @swagger 3 | * /api/documents: 4 | * get: 5 | * summary: Get all documents from a index 6 | * description: Returns all documents from the specified index 7 | * tags: 8 | * - Documents 9 | * parameters: 10 | * - in: query 11 | * name: knowledge_base_id 12 | * schema: 13 | * type: string 14 | * required: true 15 | * description: The ID of the index to retrieve documents from 16 | * responses: 17 | * 200: 18 | * description: Returns all documents from the specified index 19 | * content: 20 | * application/json: 21 | * schema: 22 | * type: array 23 | * 400: 24 | * description: Bad request 25 | * content: 26 | * application/json: 27 | * schema: 28 | * type: object 29 | * properties: 30 | * error: 31 | * type: string 32 | * description: The error message 33 | * 34 | * post: 35 | * summary: Add documents to a index 36 | * description: Adds new documents to the specified index 37 | * tags: 38 | * - Documents 39 | * parameters: 40 | * - in: query 41 | * name: knowledge_base_id 42 | * schema: 43 | * type: string 44 | * required: true 45 | * description: The ID of the index to add documents to 46 | * requestBody: 47 | * description: The document content, source, and metadata 48 | * required: true 49 | * responses: 50 | * 200: 51 | * description: Returns the inserted document 52 | * content: 53 | * application/json: 54 | * schema: 55 | * $ref: '#/components/schemas/Document' 56 | * 400: 57 | * description: Bad request 58 | * content: 59 | * application/json: 60 | * schema: 61 | * type: object 62 | * properties: 63 | * error: 64 | * type: string 65 | * description: The error message 66 | */ 67 | 68 | import { headers } from 'next/headers'; 69 | import { NextRequest, NextResponse } from 'next/server'; 70 | import { authApiKey } from '@/lib/public-api/auth'; 71 | import { Document, DocumentInsert } from '@/types/supabase-entities'; 72 | import { supabaseExecute } from '@/lib/public-api/database'; 73 | import { OpenAIEmbeddings } from 'langchain/embeddings/openai'; 74 | 75 | // Get all documents from a index 76 | export async function GET(request: NextRequest) { 77 | const { data: project, error: authError } = await authApiKey(headers()); 78 | 79 | if (!project || authError) { 80 | return NextResponse.json({ error: authError }, { status: 401 }); 81 | } 82 | 83 | const indexId = request.nextUrl.searchParams.get('index_id'); 84 | if (!indexId) { 85 | return NextResponse.json( 86 | { error: 'Missing index_id query parameter' }, 87 | { status: 400 } 88 | ); 89 | } 90 | 91 | const query = `select id, content, metadata, index_id, source, user_id, created_at 92 | from documents where index_id = '${indexId}' limit 50;`; 93 | 94 | const { data, error } = await supabaseExecute