@catalogicus-international/n8n-nodes-light-rag 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +149 -0
- package/dist/credentials/LightRagApi.credentials.d.ts +10 -0
- package/dist/credentials/LightRagApi.credentials.js +79 -0
- package/dist/credentials/LightRagApi.credentials.js.map +1 -0
- package/dist/icons/lightrag.svg +13 -0
- package/dist/nodes/LightRag/LightRag.node.d.ts +5 -0
- package/dist/nodes/LightRag/LightRag.node.js +235 -0
- package/dist/nodes/LightRag/LightRag.node.js.map +1 -0
- package/dist/nodes/LightRag/LightRag.node.json +18 -0
- package/dist/nodes/LightRag/workflowRequest.d.ts +9 -0
- package/dist/nodes/LightRag/workflowRequest.js +26 -0
- package/dist/nodes/LightRag/workflowRequest.js.map +1 -0
- package/dist/nodes/LightRagTool/LightRagTool.node.d.ts +5 -0
- package/dist/nodes/LightRagTool/LightRagTool.node.js +65 -0
- package/dist/nodes/LightRagTool/LightRagTool.node.js.map +1 -0
- package/dist/nodes/LightRagTool/LightRagTool.node.json +18 -0
- package/dist/nodes/LightRagTool/request.d.ts +13 -0
- package/dist/nodes/LightRagTool/request.js +199 -0
- package/dist/nodes/LightRagTool/request.js.map +1 -0
- package/package.json +62 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Catalogicus International
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# @catalogicus-international/n8n-nodes-light-rag
|
|
2
|
+
|
|
3
|
+
An n8n community package that exposes a LightRAG API server to regular workflows and
|
|
4
|
+
AI Agents.
|
|
5
|
+
|
|
6
|
+
## Nodes
|
|
7
|
+
|
|
8
|
+
### LightRAG
|
|
9
|
+
|
|
10
|
+
Use `LightRAG` in a regular n8n workflow. It has standard Main input and output
|
|
11
|
+
connections and processes every incoming item.
|
|
12
|
+
|
|
13
|
+
Choose an operation in the node UI. Operations that send JSON use the complete current
|
|
14
|
+
input item (`{{$json}}`) as the request body by default. For example, an input item for
|
|
15
|
+
the `Query` operation can be:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"query": "What does the knowledge base say about LightRAG?",
|
|
20
|
+
"mode": "mix",
|
|
21
|
+
"include_references": true
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You can replace the Request Body expression with a manually configured object or map
|
|
26
|
+
individual fields from previous nodes. Responses are emitted through the normal Main
|
|
27
|
+
output and retain n8n item pairing.
|
|
28
|
+
|
|
29
|
+
### LightRAG Tool
|
|
30
|
+
|
|
31
|
+
Connect `LightRAG Tool` to the tool input of an n8n AI Agent. The agent supplies one
|
|
32
|
+
structured object through the `request` argument.
|
|
33
|
+
|
|
34
|
+
Query the knowledge base:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"operation": "query",
|
|
39
|
+
"body": {
|
|
40
|
+
"query": "What does the knowledge base say about LightRAG?",
|
|
41
|
+
"mode": "mix",
|
|
42
|
+
"include_references": true,
|
|
43
|
+
"include_chunk_content": false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Retrieve structured entities, relationships, chunks, and references without generating
|
|
49
|
+
a final answer:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"operation": "queryData",
|
|
54
|
+
"body": {
|
|
55
|
+
"query": "LightRAG architecture",
|
|
56
|
+
"mode": "hybrid"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Insert text asynchronously:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"operation": "insertText",
|
|
66
|
+
"body": {
|
|
67
|
+
"text": "Content to add to the knowledge base.",
|
|
68
|
+
"file_source": "agent-note.txt",
|
|
69
|
+
"chunking": {
|
|
70
|
+
"strategy": "fixed_token",
|
|
71
|
+
"params": {
|
|
72
|
+
"chunk_token_size": 1200,
|
|
73
|
+
"chunk_overlap_token_size": 100
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The response contains a `track_id`. Check processing progress with:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"operation": "trackStatus",
|
|
85
|
+
"trackId": "insert_..."
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Supported operations
|
|
90
|
+
|
|
91
|
+
- `query` — `POST /query`;
|
|
92
|
+
- `queryData` — `POST /query/data`;
|
|
93
|
+
- `insertText` — `POST /documents/text`;
|
|
94
|
+
- `insertTexts` — `POST /documents/texts`;
|
|
95
|
+
- `trackStatus` — `GET /documents/track_status/{track_id}`;
|
|
96
|
+
- `pipelineStatus` — `GET /documents/pipeline_status`;
|
|
97
|
+
- `listDocuments` — `POST /documents/paginated`;
|
|
98
|
+
- `scanDocuments` — `POST /documents/scan`;
|
|
99
|
+
- `deleteDocuments` — `DELETE /documents/delete_document`;
|
|
100
|
+
- `health` — `GET /health`;
|
|
101
|
+
- `customRequest` — a request to any relative LightRAG API path.
|
|
102
|
+
|
|
103
|
+
Example custom request:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"operation": "customRequest",
|
|
108
|
+
"method": "GET",
|
|
109
|
+
"path": "documents/status_counts",
|
|
110
|
+
"queryParameters": {}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Only relative paths are accepted, so credentials cannot be forwarded to another host.
|
|
115
|
+
|
|
116
|
+
## Query modes
|
|
117
|
+
|
|
118
|
+
The query operations support LightRAG modes `local`, `global`, `hybrid`, `naive`,
|
|
119
|
+
`mix`, and `bypass`. `mix` is the LightRAG-recommended general-purpose mode.
|
|
120
|
+
|
|
121
|
+
All request fields supported by the LightRAG API can be passed in `body`, including
|
|
122
|
+
`response_type`, `top_k`, `chunk_top_k`, token budgets, keyword lists,
|
|
123
|
+
`conversation_history`, `user_prompt`, reranking options, and reference options.
|
|
124
|
+
|
|
125
|
+
## Credentials
|
|
126
|
+
|
|
127
|
+
Create a `LightRAG API` credential:
|
|
128
|
+
|
|
129
|
+
- `Base URL`: normally `http://localhost:9621`;
|
|
130
|
+
- `Authentication`: `API Key`, `Bearer Token`, or `None`;
|
|
131
|
+
- API key authentication is sent using `X-API-Key`;
|
|
132
|
+
- include a configured reverse-proxy API prefix in the Base URL when applicable.
|
|
133
|
+
|
|
134
|
+
## Development
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pnpm install
|
|
138
|
+
pnpm run lint
|
|
139
|
+
pnpm test
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Resources
|
|
143
|
+
|
|
144
|
+
- [LightRAG API Server documentation](https://github.com/HKUDS/LightRAG/blob/main/docs/LightRAG-API-Server.md)
|
|
145
|
+
- [n8n node documentation](https://docs.n8n.io/integrations/creating-nodes/)
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class LightRagApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LightRagApi = void 0;
|
|
4
|
+
class LightRagApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'lightRagApi';
|
|
7
|
+
this.displayName = 'LightRAG API';
|
|
8
|
+
this.icon = 'file:../icons/lightrag.svg';
|
|
9
|
+
this.documentationUrl = 'https://github.com/HKUDS/LightRAG/blob/main/docs/LightRAG-API-Server.md';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Base URL',
|
|
13
|
+
name: 'baseUrl',
|
|
14
|
+
type: 'string',
|
|
15
|
+
default: 'http://localhost:9621',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'Root URL of the LightRAG API server, including an API prefix if configured',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Authentication',
|
|
21
|
+
name: 'authentication',
|
|
22
|
+
type: 'options',
|
|
23
|
+
options: [
|
|
24
|
+
{ name: 'API Key', value: 'apiKey' },
|
|
25
|
+
{ name: 'Bearer Token', value: 'bearerToken' },
|
|
26
|
+
{ name: 'None', value: 'none' },
|
|
27
|
+
],
|
|
28
|
+
default: 'apiKey',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'API Key',
|
|
32
|
+
name: 'apiKey',
|
|
33
|
+
type: 'string',
|
|
34
|
+
typeOptions: { password: true },
|
|
35
|
+
default: '',
|
|
36
|
+
required: true,
|
|
37
|
+
displayOptions: {
|
|
38
|
+
show: {
|
|
39
|
+
authentication: ['apiKey'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
description: 'Value sent in the X-API-Key header',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Bearer Token',
|
|
46
|
+
name: 'bearerToken',
|
|
47
|
+
type: 'string',
|
|
48
|
+
typeOptions: { password: true },
|
|
49
|
+
default: '',
|
|
50
|
+
required: true,
|
|
51
|
+
displayOptions: {
|
|
52
|
+
show: {
|
|
53
|
+
authentication: ['bearerToken'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
description: 'JWT access token obtained from the LightRAG login endpoint',
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
this.authenticate = {
|
|
60
|
+
type: 'generic',
|
|
61
|
+
properties: {
|
|
62
|
+
headers: {
|
|
63
|
+
'X-API-Key': '={{$credentials.authentication === "apiKey" ? $credentials.apiKey : undefined}}',
|
|
64
|
+
Authorization: '={{$credentials.authentication === "bearerToken" ? "Bearer " + $credentials.bearerToken : undefined}}',
|
|
65
|
+
Accept: 'application/json',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
this.test = {
|
|
70
|
+
request: {
|
|
71
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
72
|
+
url: '/health',
|
|
73
|
+
method: 'GET',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.LightRagApi = LightRagApi;
|
|
79
|
+
//# sourceMappingURL=LightRagApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightRagApi.credentials.js","sourceRoot":"","sources":["../../credentials/LightRagApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QAErB,gBAAW,GAAG,cAAc,CAAC;QAE7B,SAAI,GAAS,4BAA4B,CAAC;QAE1C,qBAAgB,GACf,yEAAyE,CAAC;QAE3E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,4EAA4E;aACzF;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE;oBAC9C,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBAC/B;gBACD,OAAO,EAAE,QAAQ;aACjB;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,cAAc,EAAE,CAAC,QAAQ,CAAC;qBAC1B;iBACD;gBACD,WAAW,EAAE,oCAAoC;aACjD;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,cAAc,EAAE,CAAC,aAAa,CAAC;qBAC/B;iBACD;gBACD,WAAW,EAAE,4DAA4D;aACzE;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,WAAW,EACV,iFAAiF;oBAClF,aAAa,EACZ,uGAAuG;oBACxG,MAAM,EAAE,kBAAkB;iBAC1B;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,SAAS;gBACd,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAhFD,kCAgFC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="g" x1="8" y1="8" x2="56" y2="56" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#ffd54a"/>
|
|
5
|
+
<stop offset="1" stop-color="#ff6b35"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="64" height="64" rx="14" fill="#14171f"/>
|
|
9
|
+
<path d="M35 5 14 36h15l-2 23 23-34H35z" fill="url(#g)"/>
|
|
10
|
+
<circle cx="15" cy="18" r="4" fill="#76e4f7"/>
|
|
11
|
+
<circle cx="50" cy="48" r="4" fill="#76e4f7"/>
|
|
12
|
+
<path d="M18 20 27 27M39 39l8 7" stroke="#76e4f7" stroke-width="3" stroke-linecap="round"/>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class LightRag implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LightRag = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const request_1 = require("../LightRagTool/request");
|
|
6
|
+
const workflowRequest_1 = require("./workflowRequest");
|
|
7
|
+
const bodyOperations = [
|
|
8
|
+
'query',
|
|
9
|
+
'queryData',
|
|
10
|
+
'insertText',
|
|
11
|
+
'insertTexts',
|
|
12
|
+
'listDocuments',
|
|
13
|
+
'deleteDocuments',
|
|
14
|
+
];
|
|
15
|
+
class LightRag {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.description = {
|
|
18
|
+
displayName: 'LightRAG',
|
|
19
|
+
name: 'lightRag',
|
|
20
|
+
icon: 'file:../../icons/lightrag.svg',
|
|
21
|
+
group: ['transform'],
|
|
22
|
+
version: 1,
|
|
23
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
24
|
+
description: 'Query and manage LightRAG in a regular n8n workflow',
|
|
25
|
+
defaults: {
|
|
26
|
+
name: 'LightRAG',
|
|
27
|
+
},
|
|
28
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
29
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
30
|
+
usableAsTool: true,
|
|
31
|
+
credentials: [
|
|
32
|
+
{
|
|
33
|
+
name: 'lightRagApi',
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
properties: [
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Operation',
|
|
40
|
+
name: 'operation',
|
|
41
|
+
type: 'options',
|
|
42
|
+
noDataExpression: true,
|
|
43
|
+
options: [
|
|
44
|
+
{
|
|
45
|
+
name: 'Custom Request',
|
|
46
|
+
value: 'customRequest',
|
|
47
|
+
description: 'Call another relative LightRAG API endpoint',
|
|
48
|
+
action: 'Make a custom API request',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Delete Documents',
|
|
52
|
+
value: 'deleteDocuments',
|
|
53
|
+
description: 'Delete documents and their associated data',
|
|
54
|
+
action: 'Delete documents',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Get Pipeline Status',
|
|
58
|
+
value: 'pipelineStatus',
|
|
59
|
+
description: 'Get the current indexing pipeline state',
|
|
60
|
+
action: 'Get pipeline status',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Get Track Status',
|
|
64
|
+
value: 'trackStatus',
|
|
65
|
+
description: 'Check document processing progress using a track ID',
|
|
66
|
+
action: 'Get document processing status',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Health',
|
|
70
|
+
value: 'health',
|
|
71
|
+
description: 'Check the LightRAG server health',
|
|
72
|
+
action: 'Check server health',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'Insert Text',
|
|
76
|
+
value: 'insertText',
|
|
77
|
+
description: 'Add one text document for asynchronous indexing',
|
|
78
|
+
action: 'Insert a text document',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Insert Texts',
|
|
82
|
+
value: 'insertTexts',
|
|
83
|
+
description: 'Add multiple text documents for asynchronous indexing',
|
|
84
|
+
action: 'Insert text documents',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'List Documents',
|
|
88
|
+
value: 'listDocuments',
|
|
89
|
+
description: 'Return a paginated document list',
|
|
90
|
+
action: 'List documents',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Query',
|
|
94
|
+
value: 'query',
|
|
95
|
+
description: 'Generate an answer from the knowledge base',
|
|
96
|
+
action: 'Query the knowledge base',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'Query Data',
|
|
100
|
+
value: 'queryData',
|
|
101
|
+
description: 'Return retrieved entities, relationships, chunks, and references',
|
|
102
|
+
action: 'Retrieve structured RAG data',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'Scan Documents',
|
|
106
|
+
value: 'scanDocuments',
|
|
107
|
+
description: 'Scan the configured input directory for new documents',
|
|
108
|
+
action: 'Scan documents',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
default: 'query',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
displayName: 'Request Body',
|
|
115
|
+
name: 'body',
|
|
116
|
+
type: 'json',
|
|
117
|
+
default: '={{ $json }}',
|
|
118
|
+
displayOptions: {
|
|
119
|
+
show: {
|
|
120
|
+
operation: bodyOperations,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
description: 'JSON body sent to LightRAG. By default, the complete current input item is used.',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
displayName: 'Track ID',
|
|
127
|
+
name: 'trackId',
|
|
128
|
+
type: 'string',
|
|
129
|
+
default: '={{ $json.track_id }}',
|
|
130
|
+
required: true,
|
|
131
|
+
displayOptions: {
|
|
132
|
+
show: {
|
|
133
|
+
operation: ['trackStatus'],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
description: 'Track ID returned by an insert, upload, or scan operation',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
displayName: 'Method',
|
|
140
|
+
name: 'method',
|
|
141
|
+
type: 'options',
|
|
142
|
+
options: [
|
|
143
|
+
{ name: 'DELETE', value: 'DELETE' },
|
|
144
|
+
{ name: 'GET', value: 'GET' },
|
|
145
|
+
{ name: 'HEAD', value: 'HEAD' },
|
|
146
|
+
{ name: 'PATCH', value: 'PATCH' },
|
|
147
|
+
{ name: 'POST', value: 'POST' },
|
|
148
|
+
{ name: 'PUT', value: 'PUT' },
|
|
149
|
+
],
|
|
150
|
+
default: 'GET',
|
|
151
|
+
displayOptions: {
|
|
152
|
+
show: {
|
|
153
|
+
operation: ['customRequest'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
displayName: 'Path',
|
|
159
|
+
name: 'path',
|
|
160
|
+
type: 'string',
|
|
161
|
+
default: '',
|
|
162
|
+
required: true,
|
|
163
|
+
placeholder: 'documents/status_counts',
|
|
164
|
+
displayOptions: {
|
|
165
|
+
show: {
|
|
166
|
+
operation: ['customRequest'],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
description: 'Relative API path. Absolute URLs are rejected to protect credentials.',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
displayName: 'Query Parameters',
|
|
173
|
+
name: 'queryParameters',
|
|
174
|
+
type: 'json',
|
|
175
|
+
default: '{}',
|
|
176
|
+
displayOptions: {
|
|
177
|
+
show: {
|
|
178
|
+
operation: ['customRequest'],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
description: 'Optional URL query parameters as a JSON object',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Request Body',
|
|
185
|
+
name: 'customBody',
|
|
186
|
+
type: 'json',
|
|
187
|
+
default: '{}',
|
|
188
|
+
displayOptions: {
|
|
189
|
+
show: {
|
|
190
|
+
operation: ['customRequest'],
|
|
191
|
+
method: ['DELETE', 'PATCH', 'POST', 'PUT'],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
description: 'Optional JSON request body',
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
async execute() {
|
|
200
|
+
const items = this.getInputData();
|
|
201
|
+
const returnData = [];
|
|
202
|
+
const credentials = await this.getCredentials('lightRagApi');
|
|
203
|
+
const baseUrl = (0, request_1.normalizeBaseUrl)(credentials.baseUrl);
|
|
204
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
205
|
+
try {
|
|
206
|
+
const operation = this.getNodeParameter('operation', itemIndex);
|
|
207
|
+
const parameters = {
|
|
208
|
+
body: operation === 'customRequest'
|
|
209
|
+
? this.getNodeParameter('customBody', itemIndex, undefined)
|
|
210
|
+
: this.getNodeParameter('body', itemIndex, undefined),
|
|
211
|
+
method: this.getNodeParameter('method', itemIndex, undefined),
|
|
212
|
+
path: this.getNodeParameter('path', itemIndex, undefined),
|
|
213
|
+
queryParameters: this.getNodeParameter('queryParameters', itemIndex, undefined),
|
|
214
|
+
trackId: this.getNodeParameter('trackId', itemIndex, undefined),
|
|
215
|
+
};
|
|
216
|
+
const request = (0, workflowRequest_1.normalizeWorkflowRequest)(operation, parameters);
|
|
217
|
+
const response = await (0, request_1.executeLightRagRequest)(this, baseUrl, request);
|
|
218
|
+
returnData.push(...(0, request_1.responseToExecutionData)(response, itemIndex));
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
if (this.continueOnFail()) {
|
|
222
|
+
returnData.push({
|
|
223
|
+
json: { error: error instanceof Error ? error.message : String(error) },
|
|
224
|
+
pairedItem: itemIndex,
|
|
225
|
+
});
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return [returnData];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
exports.LightRag = LightRag;
|
|
235
|
+
//# sourceMappingURL=LightRag.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightRag.node.js","sourceRoot":"","sources":["../../../nodes/LightRag/LightRag.node.ts"],"names":[],"mappings":";;;AAMA,+CAAuE;AACvE,qDAIiC;AACjC,u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ACrC,iBAAiB,EACjB,SAAS,EACT,SAAS,CACT;oBACD,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;iBAC/D,CAAC;gBACF,MAAM,OAAO,GAAG,IAAA,0CAAwB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;gBAChE,MAAM,QAAQ,GAAG,MAAM,IAAA,gCAAsB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBAEtE,UAAU,CAAC,IAAI,CAAC,GAAG,IAAA,iCAAuB,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;YAClE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;wBACvE,UAAU,EAAE,SAAS;qBACrB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACpE,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAlOD,4BAkOC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "@catalogicus-international/n8n-nodes-light-rag.lightRag",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["AI", "Data & Storage"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/HKUDS/LightRAG/blob/main/docs/LightRAG-API-Server.md"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/HKUDS/LightRAG/blob/main/docs/LightRAG-API-Server.md"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type LightRagRequestOptions } from '../LightRagTool/request';
|
|
2
|
+
export interface WorkflowRequestParameters {
|
|
3
|
+
body?: unknown;
|
|
4
|
+
method?: unknown;
|
|
5
|
+
path?: unknown;
|
|
6
|
+
queryParameters?: unknown;
|
|
7
|
+
trackId?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare function normalizeWorkflowRequest(operation: unknown, parameters: WorkflowRequestParameters): LightRagRequestOptions;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeWorkflowRequest = normalizeWorkflowRequest;
|
|
4
|
+
const request_1 = require("../LightRagTool/request");
|
|
5
|
+
function normalizeWorkflowRequest(operation, parameters) {
|
|
6
|
+
const request = {
|
|
7
|
+
operation: String(operation || ''),
|
|
8
|
+
};
|
|
9
|
+
if (parameters.body !== undefined) {
|
|
10
|
+
request.body = parameters.body;
|
|
11
|
+
}
|
|
12
|
+
if (parameters.trackId !== undefined) {
|
|
13
|
+
request.trackId = parameters.trackId;
|
|
14
|
+
}
|
|
15
|
+
if (parameters.method !== undefined) {
|
|
16
|
+
request.method = parameters.method;
|
|
17
|
+
}
|
|
18
|
+
if (parameters.path !== undefined) {
|
|
19
|
+
request.path = parameters.path;
|
|
20
|
+
}
|
|
21
|
+
if (parameters.queryParameters !== undefined) {
|
|
22
|
+
request.queryParameters = parameters.queryParameters;
|
|
23
|
+
}
|
|
24
|
+
return (0, request_1.normalizeToolRequest)(request);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=workflowRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowRequest.js","sourceRoot":"","sources":["../../../nodes/LightRag/workflowRequest.ts"],"names":[],"mappings":";;AAWA,4DAyBC;AAnCD,qDAA4F;AAU5F,SAAgB,wBAAwB,CACvC,SAAkB,EAClB,UAAqC;IAErC,MAAM,OAAO,GAAgB;QAC5B,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;KAClC,CAAC;IAEF,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAA2B,CAAC;IACvD,CAAC;IACD,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,CAAC,OAAO,GAAG,UAAU,CAAC,OAA8B,CAAC;IAC7D,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,MAA6B,CAAC;IAC3D,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAA2B,CAAC;IACvD,CAAC;IACD,IAAI,UAAU,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QAC9C,OAAO,CAAC,eAAe,GAAG,UAAU,CAAC,eAAsC,CAAC;IAC7E,CAAC;IAED,OAAO,IAAA,8BAAoB,EAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class LightRagTool implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LightRagTool = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const request_1 = require("./request");
|
|
6
|
+
class LightRagTool {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.description = {
|
|
9
|
+
displayName: 'LightRAG Tool',
|
|
10
|
+
name: 'lightRagTool',
|
|
11
|
+
icon: 'file:../../icons/lightrag.svg',
|
|
12
|
+
group: ['input'],
|
|
13
|
+
version: 1,
|
|
14
|
+
subtitle: 'Query and manage LightRAG from an AI Agent',
|
|
15
|
+
description: 'Let an AI Agent query and manage a LightRAG knowledge base',
|
|
16
|
+
defaults: {
|
|
17
|
+
name: 'LightRAG Tool',
|
|
18
|
+
},
|
|
19
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
20
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
21
|
+
usableAsTool: true,
|
|
22
|
+
credentials: [
|
|
23
|
+
{
|
|
24
|
+
name: 'lightRagApi',
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
properties: [
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Request',
|
|
31
|
+
name: 'request',
|
|
32
|
+
type: 'json',
|
|
33
|
+
default: '={{ $fromAI("request", "A LightRAG request object. Use operation query, queryData, insertText, insertTexts, trackStatus, pipelineStatus, listDocuments, scanDocuments, deleteDocuments, health, or customRequest. Put endpoint payload fields inside body.", "json") }}',
|
|
34
|
+
description: 'Structured LightRAG request supplied by the AI Agent. For example: {"operation":"query","body":{"query":"What is LightRAG?","mode":"mix","include_references":true}}.',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async execute() {
|
|
40
|
+
const items = this.getInputData();
|
|
41
|
+
const returnData = [];
|
|
42
|
+
const credentials = await this.getCredentials('lightRagApi');
|
|
43
|
+
const baseUrl = (0, request_1.normalizeBaseUrl)(credentials.baseUrl);
|
|
44
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
45
|
+
try {
|
|
46
|
+
const request = (0, request_1.normalizeToolRequest)(this.getNodeParameter('request', itemIndex));
|
|
47
|
+
const response = await (0, request_1.executeLightRagRequest)(this, baseUrl, request);
|
|
48
|
+
returnData.push(...(0, request_1.responseToExecutionData)(response, itemIndex));
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (this.continueOnFail()) {
|
|
52
|
+
returnData.push({
|
|
53
|
+
json: { error: error instanceof Error ? error.message : String(error) },
|
|
54
|
+
pairedItem: itemIndex,
|
|
55
|
+
});
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return [returnData];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.LightRagTool = LightRagTool;
|
|
65
|
+
//# sourceMappingURL=LightRagTool.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightRagTool.node.js","sourceRoot":"","sources":["../../../nodes/LightRagTool/LightRagTool.node.ts"],"names":[],"mappings":";;;AAMA,+CAAuE;AACvE,uCAKmB;AAEnB,MAAa,YAAY;IAAzB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,+BAA+B;YACrC,KAAK,EAAE,CAAC,OAAO,CAAC;YAChB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,4CAA4C;YACtD,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE;gBACT,IAAI,EAAE,eAAe;aACrB;YACD,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,YAAY,EAAE,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BACvE,UAAU,EAAE,SAAS;qBACrB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YACpE,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA5DD,oCA4DC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "@catalogicus-international/n8n-nodes-light-rag.lightRagTool",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["AI", "Data & Storage"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/HKUDS/LightRAG/blob/main/docs/LightRAG-API-Server.md"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/HKUDS/LightRAG/blob/main/docs/LightRAG-API-Server.md"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export type LightRagHttpMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
|
|
3
|
+
export interface LightRagRequestOptions {
|
|
4
|
+
method: LightRagHttpMethod;
|
|
5
|
+
path: string;
|
|
6
|
+
query?: IDataObject;
|
|
7
|
+
body?: IDataObject;
|
|
8
|
+
}
|
|
9
|
+
export declare function normalizeBaseUrl(value: unknown): string;
|
|
10
|
+
export declare function parseRequestObject(value: unknown, fieldName?: string): IDataObject;
|
|
11
|
+
export declare function normalizeToolRequest(value: unknown): LightRagRequestOptions;
|
|
12
|
+
export declare function executeLightRagRequest(executeFunctions: IExecuteFunctions, baseUrl: string, request: LightRagRequestOptions): Promise<unknown>;
|
|
13
|
+
export declare function responseToExecutionData(response: unknown, itemIndex: number): INodeExecutionData[];
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeBaseUrl = normalizeBaseUrl;
|
|
4
|
+
exports.parseRequestObject = parseRequestObject;
|
|
5
|
+
exports.normalizeToolRequest = normalizeToolRequest;
|
|
6
|
+
exports.executeLightRagRequest = executeLightRagRequest;
|
|
7
|
+
exports.responseToExecutionData = responseToExecutionData;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
const QUERY_MODES = ['local', 'global', 'hybrid', 'naive', 'mix', 'bypass'];
|
|
10
|
+
const HTTP_METHODS = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
|
|
11
|
+
function isObject(value) {
|
|
12
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
function normalizeBaseUrl(value) {
|
|
15
|
+
const baseUrl = String(value || 'http://localhost:9621').trim().replace(/\/+$/, '');
|
|
16
|
+
if (!/^https?:\/\//i.test(baseUrl)) {
|
|
17
|
+
throw new n8n_workflow_1.ApplicationError('Base URL must start with http:// or https://');
|
|
18
|
+
}
|
|
19
|
+
return baseUrl;
|
|
20
|
+
}
|
|
21
|
+
function parseRequestObject(value, fieldName = 'Request') {
|
|
22
|
+
let parsed = value;
|
|
23
|
+
for (let attempt = 0; attempt < 20 && typeof parsed === 'string'; attempt++) {
|
|
24
|
+
if (!parsed.trim()) {
|
|
25
|
+
throw new n8n_workflow_1.ApplicationError(`${fieldName} must be a non-empty object`);
|
|
26
|
+
}
|
|
27
|
+
let parseErrorMessage = '';
|
|
28
|
+
try {
|
|
29
|
+
parsed = JSON.parse(parsed);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
parseErrorMessage = error instanceof Error ? error.message : String(error);
|
|
33
|
+
}
|
|
34
|
+
if (parseErrorMessage) {
|
|
35
|
+
throw new n8n_workflow_1.ApplicationError(`${fieldName} contains invalid JSON: ${parseErrorMessage}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!isObject(parsed)) {
|
|
39
|
+
throw new n8n_workflow_1.ApplicationError(`${fieldName} must resolve to an object, not an array or primitive`);
|
|
40
|
+
}
|
|
41
|
+
return parsed;
|
|
42
|
+
}
|
|
43
|
+
function parseOptionalObject(value, fieldName) {
|
|
44
|
+
if (value === undefined || value === null || value === '')
|
|
45
|
+
return undefined;
|
|
46
|
+
return parseRequestObject(value, fieldName);
|
|
47
|
+
}
|
|
48
|
+
function requireString(value, fieldName, minimumLength = 1) {
|
|
49
|
+
if (typeof value !== 'string' || value.trim().length < minimumLength) {
|
|
50
|
+
throw new n8n_workflow_1.ApplicationError(`${fieldName} must be a string containing at least ${minimumLength} character${minimumLength === 1 ? '' : 's'}`);
|
|
51
|
+
}
|
|
52
|
+
return value.trim();
|
|
53
|
+
}
|
|
54
|
+
function normalizePath(value) {
|
|
55
|
+
const path = requireString(value, 'Path').replace(/^\/+|\/+$/g, '');
|
|
56
|
+
if (/^(?:https?:)?\/\//i.test(path)) {
|
|
57
|
+
throw new n8n_workflow_1.ApplicationError('Path must be relative to the configured LightRAG Base URL');
|
|
58
|
+
}
|
|
59
|
+
return path;
|
|
60
|
+
}
|
|
61
|
+
function normalizeMethod(value) {
|
|
62
|
+
const method = String(value || 'GET').trim().toUpperCase();
|
|
63
|
+
if (!HTTP_METHODS.includes(method)) {
|
|
64
|
+
throw new n8n_workflow_1.ApplicationError(`Method must be one of: ${HTTP_METHODS.join(', ')}`);
|
|
65
|
+
}
|
|
66
|
+
return method;
|
|
67
|
+
}
|
|
68
|
+
function normalizeQueryBody(value) {
|
|
69
|
+
const body = parseRequestObject(value, 'Query body');
|
|
70
|
+
body.query = requireString(body.query, 'Query', 3);
|
|
71
|
+
if (body.mode !== undefined && !QUERY_MODES.includes(String(body.mode))) {
|
|
72
|
+
throw new n8n_workflow_1.ApplicationError(`Query mode must be one of: ${QUERY_MODES.join(', ')}`);
|
|
73
|
+
}
|
|
74
|
+
return body;
|
|
75
|
+
}
|
|
76
|
+
function normalizeInsertTextBody(value) {
|
|
77
|
+
const body = parseRequestObject(value, 'Insert text body');
|
|
78
|
+
body.text = requireString(body.text, 'Text');
|
|
79
|
+
return body;
|
|
80
|
+
}
|
|
81
|
+
function normalizeInsertTextsBody(value) {
|
|
82
|
+
const body = parseRequestObject(value, 'Insert texts body');
|
|
83
|
+
if (!Array.isArray(body.texts) ||
|
|
84
|
+
body.texts.length === 0 ||
|
|
85
|
+
!body.texts.every((text) => typeof text === 'string' && text.trim())) {
|
|
86
|
+
throw new n8n_workflow_1.ApplicationError('Texts must be a non-empty array of non-empty strings');
|
|
87
|
+
}
|
|
88
|
+
body.texts = body.texts.map((text) => String(text).trim());
|
|
89
|
+
return body;
|
|
90
|
+
}
|
|
91
|
+
function normalizeDeleteDocumentsBody(value) {
|
|
92
|
+
const body = parseRequestObject(value, 'Delete documents body');
|
|
93
|
+
if (!Array.isArray(body.doc_ids) ||
|
|
94
|
+
body.doc_ids.length === 0 ||
|
|
95
|
+
!body.doc_ids.every((id) => typeof id === 'string' && id.trim())) {
|
|
96
|
+
throw new n8n_workflow_1.ApplicationError('doc_ids must be a non-empty array of document ID strings');
|
|
97
|
+
}
|
|
98
|
+
body.doc_ids = body.doc_ids.map((id) => String(id).trim());
|
|
99
|
+
return body;
|
|
100
|
+
}
|
|
101
|
+
function operationName(value) {
|
|
102
|
+
return String(value || '')
|
|
103
|
+
.trim()
|
|
104
|
+
.replace(/[\s_-]+/g, '')
|
|
105
|
+
.toLowerCase();
|
|
106
|
+
}
|
|
107
|
+
function normalizeToolRequest(value) {
|
|
108
|
+
var _a, _b, _c, _d, _e, _f;
|
|
109
|
+
const request = parseRequestObject(value);
|
|
110
|
+
const operation = operationName((_a = request.operation) !== null && _a !== void 0 ? _a : request.action);
|
|
111
|
+
const body = (_b = request.body) !== null && _b !== void 0 ? _b : request.parameters;
|
|
112
|
+
switch (operation) {
|
|
113
|
+
case 'query':
|
|
114
|
+
return { method: 'POST', path: 'query', body: normalizeQueryBody(body) };
|
|
115
|
+
case 'querydata':
|
|
116
|
+
case 'retrievedata':
|
|
117
|
+
return { method: 'POST', path: 'query/data', body: normalizeQueryBody(body) };
|
|
118
|
+
case 'inserttext':
|
|
119
|
+
case 'addtext':
|
|
120
|
+
return {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
path: 'documents/text',
|
|
123
|
+
body: normalizeInsertTextBody(body),
|
|
124
|
+
};
|
|
125
|
+
case 'inserttexts':
|
|
126
|
+
case 'addtexts':
|
|
127
|
+
return {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
path: 'documents/texts',
|
|
130
|
+
body: normalizeInsertTextsBody(body),
|
|
131
|
+
};
|
|
132
|
+
case 'trackstatus': {
|
|
133
|
+
const trackId = requireString((_c = request.trackId) !== null && _c !== void 0 ? _c : request.track_id, 'Track ID');
|
|
134
|
+
return {
|
|
135
|
+
method: 'GET',
|
|
136
|
+
path: `documents/track_status/${encodeURIComponent(trackId)}`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
case 'pipelinestatus':
|
|
140
|
+
return { method: 'GET', path: 'documents/pipeline_status' };
|
|
141
|
+
case 'listdocuments':
|
|
142
|
+
return {
|
|
143
|
+
method: 'POST',
|
|
144
|
+
path: 'documents/paginated',
|
|
145
|
+
body: (_d = parseOptionalObject(body, 'List documents body')) !== null && _d !== void 0 ? _d : {},
|
|
146
|
+
};
|
|
147
|
+
case 'scandocuments':
|
|
148
|
+
case 'scan':
|
|
149
|
+
return { method: 'POST', path: 'documents/scan', body: {} };
|
|
150
|
+
case 'deletedocuments':
|
|
151
|
+
return {
|
|
152
|
+
method: 'DELETE',
|
|
153
|
+
path: 'documents/delete_document',
|
|
154
|
+
body: normalizeDeleteDocumentsBody(body),
|
|
155
|
+
};
|
|
156
|
+
case 'health':
|
|
157
|
+
return { method: 'GET', path: 'health' };
|
|
158
|
+
case 'customrequest':
|
|
159
|
+
case 'custom':
|
|
160
|
+
return {
|
|
161
|
+
method: normalizeMethod(request.method),
|
|
162
|
+
path: normalizePath((_e = request.path) !== null && _e !== void 0 ? _e : request.resource),
|
|
163
|
+
query: parseOptionalObject((_f = request.queryParameters) !== null && _f !== void 0 ? _f : request.query, 'Query parameters'),
|
|
164
|
+
body: parseOptionalObject(body, 'Request body'),
|
|
165
|
+
};
|
|
166
|
+
default:
|
|
167
|
+
throw new n8n_workflow_1.ApplicationError('Operation must be one of: query, queryData, insertText, insertTexts, trackStatus, pipelineStatus, listDocuments, scanDocuments, deleteDocuments, health, customRequest');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function executeLightRagRequest(executeFunctions, baseUrl, request) {
|
|
171
|
+
const options = {
|
|
172
|
+
method: request.method,
|
|
173
|
+
url: `${baseUrl}/${request.path}`,
|
|
174
|
+
json: true,
|
|
175
|
+
};
|
|
176
|
+
if (request.query !== undefined)
|
|
177
|
+
options.qs = request.query;
|
|
178
|
+
if (request.body !== undefined &&
|
|
179
|
+
request.method !== 'GET' &&
|
|
180
|
+
request.method !== 'HEAD') {
|
|
181
|
+
options.body = request.body;
|
|
182
|
+
}
|
|
183
|
+
return await executeFunctions.helpers.httpRequestWithAuthentication.call(executeFunctions, 'lightRagApi', options);
|
|
184
|
+
}
|
|
185
|
+
function responseToExecutionData(response, itemIndex) {
|
|
186
|
+
if (Array.isArray(response)) {
|
|
187
|
+
return response.map((item) => ({
|
|
188
|
+
json: isObject(item) ? item : { value: item },
|
|
189
|
+
pairedItem: itemIndex,
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
return [
|
|
193
|
+
{
|
|
194
|
+
json: isObject(response) ? response : { value: response },
|
|
195
|
+
pairedItem: itemIndex,
|
|
196
|
+
},
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AQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAA+B,EAAE;YAChF,UAAU,EAAE,SAAS;SACrB;KACD,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@catalogicus-international/n8n-nodes-light-rag",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n workflow and AI Agent tool nodes for the LightRAG API server",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"packageManager": "pnpm@9.15.0",
|
|
7
|
+
"homepage": "https://github.com/catalogicus-international/n8n-nodes-light-rag#readme",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"lightrag",
|
|
10
|
+
"rag",
|
|
11
|
+
"ai-agent",
|
|
12
|
+
"n8n-community-node-package"
|
|
13
|
+
],
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Catalogicus International",
|
|
16
|
+
"email": "noreply@catalogicus-international.invalid"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/catalogicus-international/n8n-nodes-light-rag.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "n8n-node build",
|
|
24
|
+
"build:watch": "tsc --watch",
|
|
25
|
+
"dev": "n8n-node dev",
|
|
26
|
+
"lint": "n8n-node lint",
|
|
27
|
+
"lint:fix": "n8n-node lint --fix",
|
|
28
|
+
"test": "pnpm run build && node --test test/**/*.test.js",
|
|
29
|
+
"release": "n8n-node release",
|
|
30
|
+
"prepublishOnly": "pnpm run lint && pnpm run build"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist/credentials",
|
|
37
|
+
"dist/icons/lightrag.svg",
|
|
38
|
+
"dist/nodes/LightRag",
|
|
39
|
+
"dist/nodes/LightRagTool"
|
|
40
|
+
],
|
|
41
|
+
"n8n": {
|
|
42
|
+
"n8nNodesApiVersion": 1,
|
|
43
|
+
"strict": true,
|
|
44
|
+
"credentials": [
|
|
45
|
+
"dist/credentials/LightRagApi.credentials.js"
|
|
46
|
+
],
|
|
47
|
+
"nodes": [
|
|
48
|
+
"dist/nodes/LightRag/LightRag.node.js",
|
|
49
|
+
"dist/nodes/LightRagTool/LightRagTool.node.js"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@n8n/node-cli": "*",
|
|
54
|
+
"eslint": "9.29.0",
|
|
55
|
+
"prettier": "3.8.3",
|
|
56
|
+
"release-it": "20.2.0",
|
|
57
|
+
"typescript": "5.9.3"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"n8n-workflow": "*"
|
|
61
|
+
}
|
|
62
|
+
}
|