fix: correct Code node parameters for typeVersion 1
- Change typeVersion from 2 to 1 for Code nodes - Rename 'jsCode' parameter to 'functionCode' for compatibility - Both Extract and Parse nodes use proper format now
This commit is contained in:
@@ -33,11 +33,10 @@
|
||||
"id": "uuid-extract-data",
|
||||
"name": "Extract Conversation Data",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"typeVersion": 1,
|
||||
"position": [650, 200],
|
||||
"parameters": {
|
||||
"language": "javascript",
|
||||
"jsCode": "const data = $input.all()[0].json.data;\nreturn data.map(item => ({\njson: {\nticket_id: item.id,\nticket_number: item.number,\nsubject: item.subject,\nproblem_text: (item.threads_text || 'No description provided').substring(0, 2000),\ncustomer_email: item.customer_email\n}\n}));"
|
||||
"functionCode": "const data = $input.all()[0].json.data;\nreturn data.map(item => ({\njson: {\nticket_id: item.id,\nticket_number: item.number,\nsubject: item.subject,\nproblem_text: (item.threads_text || 'No description provided').substring(0, 2000),\ncustomer_email: item.customer_email\n}\n}));"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -61,11 +60,10 @@
|
||||
"id": "uuid-parse-response",
|
||||
"name": "Parse AI Response",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"typeVersion": 1,
|
||||
"position": [1050, 200],
|
||||
"parameters": {
|
||||
"language": "javascript",
|
||||
"jsCode": "const content = $json.choices?.[0]?.message?.content || '{}';\nlet aiResponse = {};\ntry {\naiResponse = JSON.parse(content);\n} catch(e) {\naiResponse = {kategorie: 'unknown', lösung_typ: 'ESKALATION', vertrauen: 0.3, antwort_text: 'Fehler bei der Analyse'};\n}\nreturn {json: {...$json, response_text: content, ai_response: aiResponse, vertrauen: aiResponse.vertrauen || 0.3}};"
|
||||
"functionCode": "const content = $json.choices?.[0]?.message?.content || '{}';\nlet aiResponse = {};\ntry {\naiResponse = JSON.parse(content);\n} catch(e) {\naiResponse = {kategorie: 'unknown', lösung_typ: 'ESKALATION', vertrauen: 0.3, antwort_text: 'Fehler bei der Analyse'};\n}\nreturn {json: {...$json, response_text: content, ai_response: aiResponse, vertrauen: aiResponse.vertrauen || 0.3}};"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user