I need n8n workflow file to import into n8n:
1. n8n Setup
n8n instance running (self-hosted, desktop, or cloud)
Access to n8n UI for importing and editing workflows
2. Workflow Nodes
Webhook node (entry point for your app to send files/URLs)
IF node (to branch between document and video processing)
Function node (to decode base64 file data)
Extract Text node (for extracting text from documents)
YouTube node (to fetch video details)
YouTube Transcript node (to get transcript from YouTube video)
AI Agent node (OpenAI GPT-4 for summarization)
Function node (to create embeddings using OpenAI API)
Supabase node (to store embeddings and metadata in your Supabase DB)
Respond to Webhook node (to send the result back to your app)
3. External Services & Credentials
OpenAI API Key (for GPT-4 and embeddings)
Supabase Project:
Supabase URL
Supabase Service Role Key (for secure inserts)
Supabase table for storing documents and embeddings (see SQL below)
YouTube Data API Key (if using YouTube node for transcript)
n8n Credentials:
Set up OpenAI credentials in n8n
Set up Supabase credentials in n8n
Set up YouTube credentials in n8n (if needed)
this is the sample,  I need the full fledge file:
{
  "name": "AI Document Assistant - Complete Workflow",
  "nodes": [
    {
      "parameters": {
        "path": "process-content",
        "options": {
          "responseMode": "lastNode"
        }
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [250, 300]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.type }}",
              "operation": "equal",
              "value2": "document"
            }
          ]
        }
      },
      "name": "Content Type Check",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [450, 300]
    },
    {
      "parameters": {
        "functionCode": "// Decode base64 file data\nconst fileData = $input.item.json.file_data;\nconst buffer = Buffer.from(fileData, 'base64');\nreturn { buffer, fileName: $input.item.json.file_name, fileType: $input.item.json.file_type };"
      },
      "name": "Decode File",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [650, 200]
    },
    {
      "parameters": {
        "operation": "extractText",
        "file": "={{ $json.buffer }}",
        "fileName": "={{ $json.fileName }}"
      },
      "name": "Extract Text",
      "type": "n8n-nodes-base.textExtract",
      "typeVersion": 1,
      "position": [850, 200]
    },
    {
      "parameters": {
        "operation": "getVideo",
        "videoId": "={{ $json.video_url.split('v=')[1] }}"
      },
      "name": "Get Video",
      "type": "n8n-nodes-base.youtube",
      "typeVersion": 1,
      "position": [650, 400]
    },
    {
      "parameters": {
        "videoId": "={{ $json.videoId }}"
      },
      "name": "Get Transcript",
      "type": "n8n-nodes-base.youtubeTranscript",
      "typeVersion": 1,
      "position": [850, 400]
    },
    {
      "parameters": {
        "model": "gpt-4",
        "prompt": "Split the following content into chunks of approximately 1000 tokens each, maintaining context and coherence. Return the chunks as a JSON array:\n\n{{ $json.text || $json.transcript }}",
        "options": {
          "temperature": 0.3,
          "maxTokens": 2000
        }
      },
      "name": "Chunk Content",
      "type": "n8n-nodes-base.aiAgent",
      "typeVersion": 1,
      "position": [1050, 300]
    },
    {
      "parameters": {
        "functionCode": "// Process chunks and create embeddings\nconst chunks = JSON.parse($input.item.json.chunks);\nconst embeddings = [];\n\nfor (const chunk of chunks) {\n  const response = await fetch('https://api.openai.com/v1/embeddings', {\n    method: 'POST',\n    headers: {\n      'Authorization': `Bearer ${$env.OPENAI_API_KEY}`,\n      'Content-Type': 'application/json'\n    },\n    body: JSON.stringify({\n      input: chunk,\n      model: 'text-embedding-ada-002'\n    })\n  });\n  \n  const data = await response.json();\n  embeddings.push({\n    text: chunk,\n    embedding: data.data[0].embedding,\n    metadata: {\n      user_id: $input.item.json.user_id,\n      source_type: $input.item.json.type,\n      source_name: $input.item.json.file_name || $input.item.json.video_url,\n      created_at: new Date().toISOString()\n    }\n  });\n}\n\nreturn { embeddings, metadata: $input.item.json };"
      },
      "name": "Create Embeddings",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [1250, 300]
    },
    {
      "parameters": {
        "operation": "upsert",
        "collection": "documents",
        "data": "={{ $json.embeddings }}"
      },
      "name": "Store in Vector DB",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [1450, 300]
    },
    {
      "parameters": {
        "functionCode": "// Perform semantic search\nconst query = $input.item.json.text || $input.item.json.transcript;\n\n// Create query embedding\nconst response = await fetch('https://api.openai.com/v1/embeddings', {\n  method: 'POST',\n  headers: {\n    'Authorization': `Bearer ${$env.OPENAI_API_KEY}`,\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    input: query,\n    model: 'text-embedding-ada-002'\n  })\n});\n\nconst data = await response.json();\nconst queryEmbedding = data.data[0].embedding;\n\n// Search in Supabase\nconst { data: similarDocs, error } = await $supabase.rpc('match_documents', {\n  query_embedding: queryEmbedding,\n  match_threshold: 0.7,\n  match_count: 5\n});\n\nif (error) throw error;\n\nreturn { ...$input.item.json, similar_documents: similarDocs };"
      },
      "name": "Semantic Search",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [1650, 300]
    },
    {
      "parameters": {
        "model": "gpt-4",
        "prompt": "Analyze the following content and its related documents. Provide:\n1. A comprehensive summary\n2. Key points and insights\n3. Main topics and themes\n4. Connections with related documents\n\nContent:\n{{ $json.text || $json.transcript }}\n\nRelated Documents:\n{{ $json.similar_documents }}\n\nFormat the response as a JSON object with the following structure:\n{\n  \"summary\": \"...\",\n  \"keyPoints\": [\"...\", \"...\"],\n  \"topics\": [\"...\", \"...\"],\n  \"connections\": [\"...\", \"...\"]\n}",
        "options": {
          "temperature": 0.7,
          "maxTokens": 2000
        }
      },
      "name": "AI Analysis",
      "type": "n8n-nodes-base.aiAgent",
      "typeVersion": 1,
      "position": [1850, 300]
    },
    {
      "parameters": {
        "functionCode": "// Generate semantic tags\nconst tagResponse = await fetch('https://api.openai.com/v1/chat/completions', {\n  method: 'POST',\n  headers: {\n    'Authorization': `Bearer ${$env.OPENAI_API_KEY}`,\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    model: 'gpt-4',\n    messages: [\n      {\n        role: 'system',\n        content: 'Generate relevant semantic tags for the following content. Return only the tags as a JSON array.'\n      },\n      {\n        role: 'user',\n        content: $input.item.json.text || $input.item.json.transcript\n      }\n    ],\n    temperature: 0.3\n  })\n});\n\nconst tagData = await tagResponse.json();\nconst tags = JSON.parse(tagData.choices[0].message.content);\n\n// Update document metadata\nconst { error } = await $supabase\n  .from('documents')\n  .update({\n    tags: tags,\n    analysis: $input.item.json.analysis,\n    updated_at: new Date().toISOString()\n  })\n  .eq('id', $input.item.json.metadata.id);\n\nif (error) throw error;\n\nreturn {\n  ...$input.item.json,\n  tags,\n  analysis: $input.item.json.analysis\n};"
      },
      "name": "Generate Tags and Update",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [2050, 300]
    },
    {
      "parameters": {
        "responseData": {
          "success": true,
          "message": "Content processed successfully",
          "data": {
            "content": "={{ $json.text || $json.transcript }}",
            "summary": "={{ $json.analysis.summary }}",
            "keyPoints": "={{ $json.analysis.keyPoints }}",
            "topics": "={{ $json.analysis.topics }}",
            "connections": "={{ $json.analysis.connections }}",
            "tags": "={{ $json.tags }}",
            "similarDocuments": "={{ $json.similar_documents }}"
          }
        }
      },
      "name": "Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [2250, 300]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [[{"node": "Content Type Check", "type": "main", "index": 0}]]
    },
    "Content Type Check": {
      "main": [
        [{"node": "Decode File", "type": "main", "index": 0}],
        [{"node": "Get Video", "type": "main", "index": 0}]
      ]
    },
    "Decode File": {
      "main": [[{"node": "Extract Text", "type": "main", "index": 0}]]
    },
    "Extract Text": {
      "main": [[{"node": "Chunk Content", "type": "main", "index": 0}]]
    },
    "Get Video": {
      "main": [[{"node": "Get Transcript", "type": "main", "index": 0}]]
    },
    "Get Transcript": {
      "main": [[{"node": "Chunk Content", "type": "main", "index": 0}]]
    },
    "Chunk Content": {
      "main": [[{"node": "Create Embeddings", "type": "main", "index": 0}]]
    },
    "Create Embeddings": {
      "main": [[{"node": "Store in Vector DB", "type": "main", "index": 0}]]
    },
    "Store in Vector DB": {
      "main": [[{"node": "Semantic Search", "type": "main", "index": 0}]]
    },
    "Semantic Search": {
      "main": [[{"node": "AI Analysis", "type": "main", "index": 0}]]
    },
    "AI Analysis": {
      "main": [[{"node": "Generate Tags and Update", "type": "main", "index": 0}]]
    },
    "Generate Tags and Update": {
      "main": [[{"node": "Response", "type": "main", "index": 0}]]
    }
  }
}