Save all currently accumulated repository changes as a backup snapshot for Gitea so no local work is lost.
113 lines
3.6 KiB
JSON
113 lines
3.6 KiB
JSON
{
|
||
"nodes": [
|
||
{
|
||
"parameters": {
|
||
"mode": "load",
|
||
"tableName": "=document_clime_emb",
|
||
"prompt": "={{ $json.chatInput }}",
|
||
"topK": 1,
|
||
"options": {
|
||
"metadata": {
|
||
"metadataValues": [
|
||
{
|
||
"name": "problem",
|
||
"value": "={{ $('классификатор').item.json.output.problem }}"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
|
||
"typeVersion": 1.3,
|
||
"name": "Postgres PGVector Store"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "check_if_empty",
|
||
"leftValue": "={{ $json.length }}",
|
||
"rightValue": 0,
|
||
"operator": {
|
||
"type": "number",
|
||
"operation": "equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.if",
|
||
"name": "Check if empty result",
|
||
"notes": "Проверяет, есть ли результаты векторного поиска"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"jsCode": "// Обработка случая, когда векторный поиск не нашел результатов\nconst inputData = $input.all();\n\n// Если массив пустой или все элементы пустые\nif (inputData.length === 0 || inputData.every(item => !item.json || Object.keys(item.json).length === 0)) {\n return [{\n json: {\n error: 'no_results_found',\n message: 'Векторный поиск не нашел похожих документов',\n // Возвращаем исходные данные для продолжения workflow\n originalData: $('Postgres PGVector Store').item?.json || {},\n chatInput: $('классификатор').item?.json?.chatInput || '',\n problem: $('классификатор').item?.json?.output?.problem || '',\n // Можно установить флаг для другой логики\n useFallback: true\n }\n }];\n}\n\n// Если есть результаты - возвращаем как есть\nreturn inputData;"
|
||
},
|
||
"type": "n8n-nodes-base.code",
|
||
"name": "Handle empty result",
|
||
"notes": "Обрабатывает пустой результат векторного поиска"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"mode": "combine",
|
||
"combinationMode": "multiplex",
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.merge",
|
||
"name": "Merge branches",
|
||
"notes": "Объединяет ветки с результатами и без"
|
||
}
|
||
],
|
||
"connections": {
|
||
"Postgres PGVector Store": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Check if empty result",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Check if empty result": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Handle empty result",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Merge branches",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Handle empty result": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Merge branches",
|
||
"type": "main",
|
||
"index": 1
|
||
}
|
||
]
|
||
]
|
||
}
|
||
}
|
||
}
|