{ "updatedAt": "2026-05-22T21:55:33.272Z", "createdAt": "2026-05-10T02:04:29.809Z", "id": "g9JRtBA5lR0OAwVo", "name": "Class Recording → Transcribe → RAG", "description": null, "active": true, "isArchived": false, "nodes": [ { "parameters": { "httpMethod": "POST", "path": "class/upload", "responseMode": "lastNode", "responseData": "allEntries", "options": { "rawBody": true } }, "id": "cfc95f6c-cec1-4f2b-9746-761762e99afb", "name": "Class Upload Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 0, 0 ], "webhookId": "d0ee8226-db56-477e-8a3f-572a9129aea9" }, { "parameters": { "jsCode": "const data = $input.first().json;\nconst body = data.body || data;\nconst incomingBinary = $input.first().binary || {};\n\nconst className = body.class_name || data.headers?.['x-class-name'] || data.query?.class || 'unclassified';\nconst rawTitle = body.lecture_title || data.headers?.['x-lecture-title'] || data.query?.title || body.filename || 'Untitled Lecture';\nconst lectureTitle = rawTitle.replace(/\\.(wav|mp3|m4a|ogg)$/i, '').replace(/[-_]/g, ' ');\nconst classSlug = className.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n\nreturn [{\n json: {\n className,\n classSlug,\n lectureTitle,\n uploadedAt: new Date().toISOString()\n },\n binary: incomingBinary\n}];" }, "id": "2ed58ecd-a1cd-45e2-a80c-faf35da1a5b1", "name": "Extract Class Info", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 224, 0 ] }, { "parameters": { "method": "POST", "url": "http://10.5.30.7:8786/v1/audio/transcriptions", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Accept", "value": "application/json" } ] }, "sendBody": true, "contentType": "multipart-form-data", "bodyParameters": { "parameters": [ { "parameterType": "formBinaryData", "name": "file", "inputDataFieldName": "data" }, { "name": "model", "value": "Systran/faster-whisper-large-v3" }, { "name": "language", "value": "en" }, { "name": "response_format", "value": "verbose_json" } ] }, "options": { "timeout": 600000 } }, "id": "23663476-1dbd-45fa-b9df-e27a2f230dae", "name": "Whisper Transcribe", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 448, 0 ] }, { "parameters": { "jsCode": "const result = $input.first().json;\nconst classInfo = $('Extract Class Info').first().json;\n\nconst segments = result.segments || [];\nconst fullText = result.text || segments.map(s => s.text).join(' ');\nconst duration = result.duration || segments[segments.length - 1]?.end || 0;\n\nconst timestamped = segments.map(s => {\n const mins = Math.floor(s.start / 60);\n const secs = Math.floor(s.start % 60);\n return `[${mins}:${String(secs).padStart(2, '0')}] ${s.text.trim()}`;\n}).join('\\n');\n\nreturn [{\n json: {\n className: classInfo.className,\n classSlug: classInfo.classSlug,\n lectureTitle: classInfo.lectureTitle,\n fullText: fullText.trim(),\n timestampedText: timestamped,\n durationMinutes: Math.round(duration / 60),\n segmentCount: segments.length\n }\n}];" }, "id": "d61a4f61-4934-46de-a334-2493c0617b7e", "name": "Format Transcript", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 672, 0 ] }, { "parameters": { "method": "POST", "url": "http://10.5.30.6:4000/v1/chat/completions", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" }, { "name": "Authorization", "value": "={{ \"Bearer \" + $env.LITELLM_API_KEY }}" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"model\": \"medium\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an academic note-taking assistant. Given a class lecture transcription, provide:\\n1. A concise summary (3-5 sentences)\\n2. Key concepts covered (as a list)\\n3. Important definitions or formulas\\n4. Any assignments or deadlines mentioned\\n\\nRespond in JSON with keys: summary, key_concepts (array), definitions (array of {term, definition}), assignments (array)\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Class: {{ $json.className }}\\nLecture: {{ $json.lectureTitle }}\\n\\nTranscription (first 3000 chars):\\n{{ $json.fullText.substring(0, 3000) }}\"\n }\n ],\n \"max_tokens\": 600,\n \"temperature\": 0.2,\n \"response_format\": { \"type\": \"json_object\" }\n}", "options": {} }, "id": "d61b60ea-3e3e-4776-a715-c042a0da574c", "name": "AI Extract Notes", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 880, 0 ] }, { "parameters": { "jsCode": "const llmResponse = $input.first().json;\nconst transcriptData = $('Format Transcript').first().json;\n\nlet notes;\ntry {\n notes = JSON.parse(llmResponse.choices?.[0]?.message?.content || '{}');\n} catch(e) {\n notes = { summary: 'Could not parse notes', key_concepts: [], definitions: [], assignments: [] };\n}\n\nconst ragText = [\n `Class: ${transcriptData.className}`,\n `Lecture: ${transcriptData.lectureTitle}`,\n `Duration: ${transcriptData.durationMinutes} minutes`,\n `Summary: ${notes.summary}`,\n `Key Concepts: ${(notes.key_concepts || []).join(', ')}`,\n '',\n 'Full Transcript:',\n transcriptData.fullText\n].join('\\n');\n\nreturn [{\n json: {\n className: transcriptData.className,\n classSlug: transcriptData.classSlug,\n lectureTitle: transcriptData.lectureTitle,\n durationMinutes: transcriptData.durationMinutes,\n notes,\n ragText,\n source: `class-${transcriptData.classSlug}-${Date.now()}`,\n metadata: {\n class_name: transcriptData.className,\n class_slug: transcriptData.classSlug,\n lecture_title: transcriptData.lectureTitle,\n duration_minutes: transcriptData.durationMinutes,\n type: 'class_recording',\n recorded_at: new Date().toISOString()\n }\n }\n}];" }, "id": "b89dc0d0-ae38-4056-b5d4-4ed1a01ca2d8", "name": "Prepare for RAG", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1104, 0 ] }, { "parameters": { "jsCode": "const input = $input.first().json;\nconst text = input.ragText || '';\nconst source = input.source;\nconst metadata = input.metadata;\n\nconst CHUNK_SIZE = 500;\nconst OVERLAP = 50;\n\nconst chunks = [];\nconst sentences = text.split(/(?<=[.!?])\\s+/);\nlet current = '';\n\nfor (const sentence of sentences) {\n if ((current + ' ' + sentence).length > CHUNK_SIZE && current.length > 0) {\n chunks.push(current.trim());\n const words = current.split(' ');\n current = words.slice(-OVERLAP).join(' ') + ' ' + sentence;\n } else {\n current = current ? current + ' ' + sentence : sentence;\n }\n}\nif (current.trim()) chunks.push(current.trim());\n\nreturn chunks.map((chunk, i) => ({\n json: {\n chunk,\n chunkIndex: i,\n totalChunks: chunks.length,\n source,\n metadata\n }\n}));" }, "id": "0e2248b6-30fa-4e5b-8b41-61fda6864c8a", "name": "Chunk Text", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1328, 0 ] }, { "parameters": { "method": "POST", "url": "http://10.5.30.7:11434/v1/embeddings", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ ({ model: 'nomic-embed-text:v1.5', input: $json.chunk }) }}", "options": { "batching": { "batch": { "batchSize": 5, "batchInterval": 500 } } } }, "id": "eda997ea-bd9a-4698-ba71-09aa73b6b0cb", "name": "Get Embedding", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1552, 0 ] }, { "parameters": { "jsCode": "const embeddingResponse = $input.first().json;\nconst chunkData = $('Chunk Text').item;\nconst embedding = embeddingResponse.data?.[0]?.embedding || [];\n\nconst pointId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0;\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n});\n\nreturn [{\n json: {\n id: pointId,\n vector: embedding,\n payload: {\n text: chunkData.json.chunk,\n source: chunkData.json.source,\n chunkIndex: chunkData.json.chunkIndex,\n totalChunks: chunkData.json.totalChunks,\n metadata: chunkData.json.metadata,\n ingested_at: new Date().toISOString()\n }\n }\n}];" }, "id": "fa0b1600-5e53-44cc-aea9-34bb30417a9d", "name": "Prepare Qdrant Point", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1760, 0 ] }, { "parameters": { "method": "PUT", "url": "http://10.5.30.6:6333/collections/knowledge_base/points", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"points\": [\n {\n \"id\": \"{{ $json.id }}\",\n \"vector\": {{ JSON.stringify($json.vector) }},\n \"payload\": {{ JSON.stringify($json.payload) }}\n }\n ]\n}", "options": {} }, "id": "df7ac34b-37a0-4492-8387-f30a43800ec7", "name": "Upsert to Qdrant", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1904, -208 ] }, { "parameters": { "jsCode": "const rag = $('Prepare for RAG').first().json;\nreturn [{\n json: {\n title: `🎓 ${rag.className} Lecture Processed`,\n message: `${rag.lectureTitle} (${rag.durationMinutes}min)\\nSummary: ${rag.notes.summary}\\nKey concepts: ${(rag.notes.key_concepts || []).slice(0, 5).join(', ')}`,\n priority: 5\n }\n}];" }, "id": "17d050cb-4c6f-488c-835c-f0b5cb43df0f", "name": "Format Gotify Message", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2208, 0 ] }, { "parameters": { "message": "={{ $json.message }}", "additionalFields": { "priority": "={{ $json.priority }}", "title": "={{ $json.title }}" }, "options": { "contentType": "text/plain" } }, "id": "dd07e577-2bed-4100-9b37-f79b8dd59db3", "name": "Notify via Gotify", "type": "n8n-nodes-base.gotify", "typeVersion": 1, "position": [ 2448, 0 ], "credentials": { "gotifyApi": { "id": "MzvuWWDoIzIBNW5k", "name": "Whisper" } } }, { "parameters": { "jsCode": "const rag = $('Prepare for RAG').first().json;\nconst notes = rag.notes || {};\nconst concepts = (notes.key_concepts || []).map((c,i) => `${i+1}. ${c}`).join('\\n');\nconst defs = Object.entries(notes.definitions || {}).map(([k,v]) => `${k}: ${v}`).join('\\n');\nconst assignments = (notes.assignments || []).map((a,i) => `${i+1}. ${a}`).join('\\n');\nconst content = [\n `Lecture Notes: ${rag.lectureTitle}`,\n `Class: ${rag.className}`,\n `Duration: ${rag.durationMinutes} minutes`,\n `Date: ${new Date().toISOString()}`, '',\n `Summary`, `=======`, notes.summary || '', '',\n `Key Concepts`, `=============`, concepts,\n ...(defs ? ['', `Definitions`, `===========`, defs] : []),\n ...(assignments ? ['', `Assignments`, `===========`, assignments] : []),\n].join('\\n');\nconst title = `${rag.className} — ${rag.lectureTitle}`;\nreturn [{ binary: { document: { data: Buffer.from(content,'utf-8').toString('base64'), mimeType:'text/plain', fileName:`${title}.txt` }}, json: { title, className: rag.className } }];\n" }, "id": "ed77ded0-36ae-469a-8144-904a7105adda", "name": "Prepare Notes Doc", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2208, -208 ] }, { "parameters": { "method": "POST", "url": "https://paperless.paccoco.com/api/documents/post_document/", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Authorization", "value": "Bearer ${PAPERLESS_API_TOKEN}" } ] }, "sendBody": true, "contentType": "multipart-form-data", "bodyParameters": { "parameters": [ { "parameterType": "formBinaryData", "name": "document" }, { "name": "title", "value": "={{ $json.title }}" }, { "name": "tags[]", "value": "${PAPERLESS_TAG_LECTURE_NOTES}" } ] }, "options": {} }, "id": "df288dd8-584b-476d-bbe0-a4fb9f55904e", "name": "Save Notes to Paperless", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 2432, -208 ], "continueOnFail": true } ], "connections": { "Class Upload Webhook": { "main": [ [ { "node": "Extract Class Info", "type": "main", "index": 0 } ] ] }, "Extract Class Info": { "main": [ [ { "node": "Whisper Transcribe", "type": "main", "index": 0 } ] ] }, "Whisper Transcribe": { "main": [ [ { "node": "Format Transcript", "type": "main", "index": 0 } ] ] }, "Format Transcript": { "main": [ [ { "node": "AI Extract Notes", "type": "main", "index": 0 } ] ] }, "AI Extract Notes": { "main": [ [ { "node": "Prepare for RAG", "type": "main", "index": 0 } ] ] }, "Prepare for RAG": { "main": [ [ { "node": "Chunk Text", "type": "main", "index": 0 } ] ] }, "Chunk Text": { "main": [ [ { "node": "Get Embedding", "type": "main", "index": 0 } ] ] }, "Get Embedding": { "main": [ [ { "node": "Prepare Qdrant Point", "type": "main", "index": 0 } ] ] }, "Prepare Qdrant Point": { "main": [ [ { "node": "Upsert to Qdrant", "type": "main", "index": 0 } ] ] }, "Upsert to Qdrant": { "main": [ [ { "node": "Format Gotify Message", "type": "main", "index": 0 }, { "node": "Prepare Notes Doc", "type": "main", "index": 0 } ] ] }, "Format Gotify Message": { "main": [ [ { "node": "Notify via Gotify", "type": "main", "index": 0 } ] ] }, "Prepare Notes Doc": { "main": [ [ { "node": "Save Notes to Paperless", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1", "binaryMode": "separate" }, "staticData": null, "meta": { "templateCredsSetupCompleted": true }, "pinData": {}, "versionId": "987fe225-b99f-421a-a76e-b839a0a9bef5", "activeVersionId": "987fe225-b99f-421a-a76e-b839a0a9bef5", "versionCounter": 46, "triggerCount": 1, "shared": [ { "updatedAt": "2026-05-10T02:04:29.809Z", "createdAt": "2026-05-10T02:04:29.809Z", "role": "workflow:owner", "workflowId": "g9JRtBA5lR0OAwVo", "projectId": "dxCRnBdX5uJizCGa", "project": { "updatedAt": "2026-05-06T01:10:37.484Z", "createdAt": "2026-05-06T01:08:07.721Z", "id": "dxCRnBdX5uJizCGa", "name": "Wilfred Fizzlepoof ", "type": "personal", "icon": null, "description": null, "creatorId": "47b2227f-2fc2-4a08-bd35-ea157b92df0d" } } ], "tags": [ { "updatedAt": "2026-05-06T22:39:33.284Z", "createdAt": "2026-05-06T22:39:33.284Z", "id": "7uuEyQrIlcuruZBk", "name": "rag" }, { "updatedAt": "2026-05-07T00:49:56.081Z", "createdAt": "2026-05-07T00:49:56.081Z", "id": "Q9lCYtCOuy9XmeyL", "name": "school" }, { "updatedAt": "2026-05-06T22:38:51.678Z", "createdAt": "2026-05-06T22:38:51.678Z", "id": "S9FxzVfHLsHmyzyt", "name": "ai" }, { "updatedAt": "2026-05-06T22:39:59.716Z", "createdAt": "2026-05-06T22:39:59.716Z", "id": "tuPxDoKFqpVrrQoX", "name": "whisper" } ], "activeVersion": { "updatedAt": "2026-05-22T21:55:33.273Z", "createdAt": "2026-05-22T21:55:33.273Z", "versionId": "987fe225-b99f-421a-a76e-b839a0a9bef5", "workflowId": "g9JRtBA5lR0OAwVo", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "class/upload", "responseMode": "lastNode", "responseData": "allEntries", "options": { "rawBody": true } }, "id": "cfc95f6c-cec1-4f2b-9746-761762e99afb", "name": "Class Upload Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 0, 0 ], "webhookId": "d0ee8226-db56-477e-8a3f-572a9129aea9" }, { "parameters": { "jsCode": "const data = $input.first().json;\nconst body = data.body || data;\nconst incomingBinary = $input.first().binary || {};\n\nconst className = body.class_name || data.headers?.['x-class-name'] || data.query?.class || 'unclassified';\nconst rawTitle = body.lecture_title || data.headers?.['x-lecture-title'] || data.query?.title || body.filename || 'Untitled Lecture';\nconst lectureTitle = rawTitle.replace(/\\.(wav|mp3|m4a|ogg)$/i, '').replace(/[-_]/g, ' ');\nconst classSlug = className.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n\nreturn [{\n json: {\n className,\n classSlug,\n lectureTitle,\n uploadedAt: new Date().toISOString()\n },\n binary: incomingBinary\n}];" }, "id": "2ed58ecd-a1cd-45e2-a80c-faf35da1a5b1", "name": "Extract Class Info", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 224, 0 ] }, { "parameters": { "method": "POST", "url": "http://10.5.30.7:8786/v1/audio/transcriptions", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Accept", "value": "application/json" } ] }, "sendBody": true, "contentType": "multipart-form-data", "bodyParameters": { "parameters": [ { "parameterType": "formBinaryData", "name": "file", "inputDataFieldName": "data" }, { "name": "model", "value": "Systran/faster-whisper-large-v3" }, { "name": "language", "value": "en" }, { "name": "response_format", "value": "verbose_json" } ] }, "options": { "timeout": 600000 } }, "id": "23663476-1dbd-45fa-b9df-e27a2f230dae", "name": "Whisper Transcribe", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 448, 0 ] }, { "parameters": { "jsCode": "const result = $input.first().json;\nconst classInfo = $('Extract Class Info').first().json;\n\nconst segments = result.segments || [];\nconst fullText = result.text || segments.map(s => s.text).join(' ');\nconst duration = result.duration || segments[segments.length - 1]?.end || 0;\n\nconst timestamped = segments.map(s => {\n const mins = Math.floor(s.start / 60);\n const secs = Math.floor(s.start % 60);\n return `[${mins}:${String(secs).padStart(2, '0')}] ${s.text.trim()}`;\n}).join('\\n');\n\nreturn [{\n json: {\n className: classInfo.className,\n classSlug: classInfo.classSlug,\n lectureTitle: classInfo.lectureTitle,\n fullText: fullText.trim(),\n timestampedText: timestamped,\n durationMinutes: Math.round(duration / 60),\n segmentCount: segments.length\n }\n}];" }, "id": "d61a4f61-4934-46de-a334-2493c0617b7e", "name": "Format Transcript", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 672, 0 ] }, { "parameters": { "method": "POST", "url": "http://10.5.30.6:4000/v1/chat/completions", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" }, { "name": "Authorization", "value": "={{ \"Bearer \" + $env.LITELLM_API_KEY }}" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"model\": \"medium\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an academic note-taking assistant. Given a class lecture transcription, provide:\\n1. A concise summary (3-5 sentences)\\n2. Key concepts covered (as a list)\\n3. Important definitions or formulas\\n4. Any assignments or deadlines mentioned\\n\\nRespond in JSON with keys: summary, key_concepts (array), definitions (array of {term, definition}), assignments (array)\"\n },\n {\n \"role\": \"user\",\n \"content\": \"Class: {{ $json.className }}\\nLecture: {{ $json.lectureTitle }}\\n\\nTranscription (first 3000 chars):\\n{{ $json.fullText.substring(0, 3000) }}\"\n }\n ],\n \"max_tokens\": 600,\n \"temperature\": 0.2,\n \"response_format\": { \"type\": \"json_object\" }\n}", "options": {} }, "id": "d61b60ea-3e3e-4776-a715-c042a0da574c", "name": "AI Extract Notes", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 880, 0 ] }, { "parameters": { "jsCode": "const llmResponse = $input.first().json;\nconst transcriptData = $('Format Transcript').first().json;\n\nlet notes;\ntry {\n notes = JSON.parse(llmResponse.choices?.[0]?.message?.content || '{}');\n} catch(e) {\n notes = { summary: 'Could not parse notes', key_concepts: [], definitions: [], assignments: [] };\n}\n\nconst ragText = [\n `Class: ${transcriptData.className}`,\n `Lecture: ${transcriptData.lectureTitle}`,\n `Duration: ${transcriptData.durationMinutes} minutes`,\n `Summary: ${notes.summary}`,\n `Key Concepts: ${(notes.key_concepts || []).join(', ')}`,\n '',\n 'Full Transcript:',\n transcriptData.fullText\n].join('\\n');\n\nreturn [{\n json: {\n className: transcriptData.className,\n classSlug: transcriptData.classSlug,\n lectureTitle: transcriptData.lectureTitle,\n durationMinutes: transcriptData.durationMinutes,\n notes,\n ragText,\n source: `class-${transcriptData.classSlug}-${Date.now()}`,\n metadata: {\n class_name: transcriptData.className,\n class_slug: transcriptData.classSlug,\n lecture_title: transcriptData.lectureTitle,\n duration_minutes: transcriptData.durationMinutes,\n type: 'class_recording',\n recorded_at: new Date().toISOString()\n }\n }\n}];" }, "id": "b89dc0d0-ae38-4056-b5d4-4ed1a01ca2d8", "name": "Prepare for RAG", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1104, 0 ] }, { "parameters": { "jsCode": "const input = $input.first().json;\nconst text = input.ragText || '';\nconst source = input.source;\nconst metadata = input.metadata;\n\nconst CHUNK_SIZE = 500;\nconst OVERLAP = 50;\n\nconst chunks = [];\nconst sentences = text.split(/(?<=[.!?])\\s+/);\nlet current = '';\n\nfor (const sentence of sentences) {\n if ((current + ' ' + sentence).length > CHUNK_SIZE && current.length > 0) {\n chunks.push(current.trim());\n const words = current.split(' ');\n current = words.slice(-OVERLAP).join(' ') + ' ' + sentence;\n } else {\n current = current ? current + ' ' + sentence : sentence;\n }\n}\nif (current.trim()) chunks.push(current.trim());\n\nreturn chunks.map((chunk, i) => ({\n json: {\n chunk,\n chunkIndex: i,\n totalChunks: chunks.length,\n source,\n metadata\n }\n}));" }, "id": "0e2248b6-30fa-4e5b-8b41-61fda6864c8a", "name": "Chunk Text", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1328, 0 ] }, { "parameters": { "method": "POST", "url": "http://10.5.30.7:11434/v1/embeddings", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={{ ({ model: 'nomic-embed-text:v1.5', input: $json.chunk }) }}", "options": { "batching": { "batch": { "batchSize": 5, "batchInterval": 500 } } } }, "id": "eda997ea-bd9a-4698-ba71-09aa73b6b0cb", "name": "Get Embedding", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1552, 0 ] }, { "parameters": { "jsCode": "const embeddingResponse = $input.first().json;\nconst chunkData = $('Chunk Text').item;\nconst embedding = embeddingResponse.data?.[0]?.embedding || [];\n\nconst pointId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0;\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n});\n\nreturn [{\n json: {\n id: pointId,\n vector: embedding,\n payload: {\n text: chunkData.json.chunk,\n source: chunkData.json.source,\n chunkIndex: chunkData.json.chunkIndex,\n totalChunks: chunkData.json.totalChunks,\n metadata: chunkData.json.metadata,\n ingested_at: new Date().toISOString()\n }\n }\n}];" }, "id": "fa0b1600-5e53-44cc-aea9-34bb30417a9d", "name": "Prepare Qdrant Point", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1760, 0 ] }, { "parameters": { "method": "PUT", "url": "http://10.5.30.6:6333/collections/knowledge_base/points", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"points\": [\n {\n \"id\": \"{{ $json.id }}\",\n \"vector\": {{ JSON.stringify($json.vector) }},\n \"payload\": {{ JSON.stringify($json.payload) }}\n }\n ]\n}", "options": {} }, "id": "df7ac34b-37a0-4492-8387-f30a43800ec7", "name": "Upsert to Qdrant", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1904, -208 ] }, { "parameters": { "jsCode": "const rag = $('Prepare for RAG').first().json;\nreturn [{\n json: {\n title: `🎓 ${rag.className} Lecture Processed`,\n message: `${rag.lectureTitle} (${rag.durationMinutes}min)\\nSummary: ${rag.notes.summary}\\nKey concepts: ${(rag.notes.key_concepts || []).slice(0, 5).join(', ')}`,\n priority: 5\n }\n}];" }, "id": "17d050cb-4c6f-488c-835c-f0b5cb43df0f", "name": "Format Gotify Message", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2208, 0 ] }, { "parameters": { "message": "={{ $json.message }}", "additionalFields": { "priority": "={{ $json.priority }}", "title": "={{ $json.title }}" }, "options": { "contentType": "text/plain" } }, "id": "dd07e577-2bed-4100-9b37-f79b8dd59db3", "name": "Notify via Gotify", "type": "n8n-nodes-base.gotify", "typeVersion": 1, "position": [ 2448, 0 ], "credentials": { "gotifyApi": { "id": "MzvuWWDoIzIBNW5k", "name": "Whisper" } } }, { "parameters": { "jsCode": "const rag = $('Prepare for RAG').first().json;\nconst notes = rag.notes || {};\nconst concepts = (notes.key_concepts || []).map((c,i) => `${i+1}. ${c}`).join('\\n');\nconst defs = Object.entries(notes.definitions || {}).map(([k,v]) => `${k}: ${v}`).join('\\n');\nconst assignments = (notes.assignments || []).map((a,i) => `${i+1}. ${a}`).join('\\n');\nconst content = [\n `Lecture Notes: ${rag.lectureTitle}`,\n `Class: ${rag.className}`,\n `Duration: ${rag.durationMinutes} minutes`,\n `Date: ${new Date().toISOString()}`, '',\n `Summary`, `=======`, notes.summary || '', '',\n `Key Concepts`, `=============`, concepts,\n ...(defs ? ['', `Definitions`, `===========`, defs] : []),\n ...(assignments ? ['', `Assignments`, `===========`, assignments] : []),\n].join('\\n');\nconst title = `${rag.className} — ${rag.lectureTitle}`;\nreturn [{ binary: { document: { data: Buffer.from(content,'utf-8').toString('base64'), mimeType:'text/plain', fileName:`${title}.txt` }}, json: { title, className: rag.className } }];\n" }, "id": "ed77ded0-36ae-469a-8144-904a7105adda", "name": "Prepare Notes Doc", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 2208, -208 ] }, { "parameters": { "method": "POST", "url": "https://paperless.paccoco.com/api/documents/post_document/", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Authorization", "value": "Bearer ${PAPERLESS_API_TOKEN}" } ] }, "sendBody": true, "contentType": "multipart-form-data", "bodyParameters": { "parameters": [ { "parameterType": "formBinaryData", "name": "document" }, { "name": "title", "value": "={{ $json.title }}" }, { "name": "tags[]", "value": "${PAPERLESS_TAG_LECTURE_NOTES}" } ] }, "options": {} }, "id": "df288dd8-584b-476d-bbe0-a4fb9f55904e", "name": "Save Notes to Paperless", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 2432, -208 ], "continueOnFail": true } ], "connections": { "Class Upload Webhook": { "main": [ [ { "node": "Extract Class Info", "type": "main", "index": 0 } ] ] }, "Extract Class Info": { "main": [ [ { "node": "Whisper Transcribe", "type": "main", "index": 0 } ] ] }, "Whisper Transcribe": { "main": [ [ { "node": "Format Transcript", "type": "main", "index": 0 } ] ] }, "Format Transcript": { "main": [ [ { "node": "AI Extract Notes", "type": "main", "index": 0 } ] ] }, "AI Extract Notes": { "main": [ [ { "node": "Prepare for RAG", "type": "main", "index": 0 } ] ] }, "Prepare for RAG": { "main": [ [ { "node": "Chunk Text", "type": "main", "index": 0 } ] ] }, "Chunk Text": { "main": [ [ { "node": "Get Embedding", "type": "main", "index": 0 } ] ] }, "Get Embedding": { "main": [ [ { "node": "Prepare Qdrant Point", "type": "main", "index": 0 } ] ] }, "Prepare Qdrant Point": { "main": [ [ { "node": "Upsert to Qdrant", "type": "main", "index": 0 } ] ] }, "Upsert to Qdrant": { "main": [ [ { "node": "Format Gotify Message", "type": "main", "index": 0 }, { "node": "Prepare Notes Doc", "type": "main", "index": 0 } ] ] }, "Format Gotify Message": { "main": [ [ { "node": "Notify via Gotify", "type": "main", "index": 0 } ] ] }, "Prepare Notes Doc": { "main": [ [ { "node": "Save Notes to Paperless", "type": "main", "index": 0 } ] ] } }, "authors": "Wilfred Fizzlepoof", "name": null, "description": null, "autosaved": false, "workflowPublishHistory": [ { "createdAt": "2026-05-22T21:55:33.319Z", "id": 333, "workflowId": "g9JRtBA5lR0OAwVo", "versionId": "987fe225-b99f-421a-a76e-b839a0a9bef5", "event": "deactivated", "userId": "47b2227f-2fc2-4a08-bd35-ea157b92df0d" }, { "createdAt": "2026-05-22T21:55:33.338Z", "id": 334, "workflowId": "g9JRtBA5lR0OAwVo", "versionId": "987fe225-b99f-421a-a76e-b839a0a9bef5", "event": "activated", "userId": "47b2227f-2fc2-4a08-bd35-ea157b92df0d" } ] } }