我正在建立一個工作流程,使用 ‘PDF Generator API’ 節點將 AI 代理生成的資料轉換為 PDF 檔案。
我在之前的兩個工作流程中,在節點的 ‘data’ 欄位中使用了完全相同的指令,效果很好:
{{ JSON.stringify({ post_event_report: $json.output }) }}
但在這裡,它產生了空白的 PDF。我已經像在之前的工作流程中一樣,在 PDF Generator 範本中包含了變數,所以我不知道為什麼它突然產生空白 PDF。
有任何想法嗎?
{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“id”: “27e200f4-843d-4d50-b42c-0b8a26f7291b”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “1DSaJKyI1eCp6WZJ8X1aAa6jg7fvOOS5vJFKUmar7quA”,
“mode”: “list”,
“cachedResultName”: “Post Event Reporting”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1DSaJKyI1eCp6WZJ8X1aAa6jg7fvOOS5vJFKUmar7quA/edit?usp=drivesdk”
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Sheet1”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1DSaJKyI1eCp6WZJ8X1aAa6jg7fvOOS5vJFKUmar7quA/edit#gid=0”
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.7,
“position”: [
224,
0
],
“id”: “3b86eb78-0869-40c3-9bcf-1ad77f80cf74”,
“name”: “Get row(s) in sheet”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “wV1Zw6McyxYXrk8t”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“promptType”: “define”,
“text”: “= Get {{ $json.Feedback }} for {{ $json[“Event Name”] }} {{ $json.Date }} {{ $json.Location }} {{ $json[‘No. of Guests’] }}”,
“options”: {
“systemMessage”: "=You are a Post Event Reporting specialist working with a Small Catering Business with over 30 years of experience in the industry. Your role is to analyze the spreadsheet and generate areas of improvement based on the {{ $json.Feedback }} given. Compile all of the data into a comprehensive post-event report "
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 3.1,
“position”: [
448,
0
],
“id”: “1cebd084-c6fa-4477-b507-96bffc2a3733”,
“name”: “AI Agent”
},
{
“parameters”: {
“templateId”: {
“__rl”: true,
“value”: “1655316”,
“mode”: “list”,
“cachedResultName”: “Post-Event Report (ID: 1655316)”
},
“data”: “={{ JSON.stringify({ post_event_report: $json.output }) }}”,
“documentOutput”: “viewer”,
“additionalFields”: {
“outputName”: “=Post event report for {{ $(‘Get row(s) in sheet’).item.json[“Event Name”] }} on {{ $(‘Get row(s) in sheet’).item.json.Date }}”,
“testing”: false
}
},
“type”: “@pdfgeneratorapi/n8n-nodes-pdf-generator-api.pdfGeneratorApi”,
“typeVersion”: 1,
“position”: [
800,
0
],
“id”: “4304c3b8-5210-4b2d-8d6d-49eac03b03a6”,
“name”: “Generate a PDF document”,
“alwaysOutputData”: true,
“credentials”: {
“pdfGeneratorApi”: {
“id”: “XUfVEGWx0Q45fr5L”,
“name”: “PDF Generator account”
}
}
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“typeVersion”: 1.1,
“position”: [
320,
208
],
“id”: “630d55ef-1a19-4f5a-bad5-a14c85c8fb4d”,
“name”: “Google Gemini Chat Model”,
“credentials”: {
“googlePalmApi”: {
“id”: “r5K1AFY1c2dmiqsE”,
“name”: “Google Gemini(PaLM) Api account”
}
}
}
],
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
[
{
“node”: “Get row(s) in sheet”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get row(s) in sheet”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Generate a PDF document”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Gemini Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “845031bfdb8f607d8c7ae907fb5de28c6fb4d0a8d0cd06c1a605d7c42f4018a9”
}
}