feat: integrate Supabase for database operations and migrations

Add support for Supabase database operations, including migrations and queries. Implement new Supabase-related types, actions, and components to handle database interactions. Enhance the prompt system to include Supabase-specific instructions and constraints. Ensure data integrity and security by enforcing row-level security and proper migration practices.
This commit is contained in:
KevIsDev
2025-03-19 23:11:31 +00:00
parent 9fd5f149c9
commit 02974089de
18 changed files with 1316 additions and 12 deletions

View File

@@ -37,11 +37,15 @@ function parseCookies(cookieHeader: string): Record<string, string> {
}
async function chatAction({ context, request }: ActionFunctionArgs) {
const { messages, files, promptId, contextOptimization } = await request.json<{
const { messages, files, promptId, contextOptimization, supabase } = await request.json<{
messages: Messages;
files: any;
promptId?: string;
contextOptimization: boolean;
supabase?: {
isConnected: boolean;
hasSelectedProject: boolean;
};
}>();
const cookieHeader = request.headers.get('Cookie');
@@ -181,6 +185,7 @@ async function chatAction({ context, request }: ActionFunctionArgs) {
// Stream the text
const options: StreamingOptions = {
supabaseConnection: supabase,
toolChoice: 'none',
onFinish: async ({ text: content, finishReason, usage }) => {
logger.debug('usage', JSON.stringify(usage));