@tiger16601/n8n-nodes-fastgpt 1.1.4

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 ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2022 n8n
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # n8n-nodes-fastgpt
2
+
3
+ 这是fastgpt智能客服平台的n8n组件,能够实现在n8n中调用fastgpt服务,实现对话、知识库管理等功能
@@ -0,0 +1,13 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class FastGPTApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ icon: {
7
+ readonly light: "file:../nodes/FastGPT/FastGPT.svg";
8
+ readonly dark: "file:../nodes/FastGPT/FastGPT.svg";
9
+ };
10
+ properties: INodeProperties[];
11
+ authenticate: IAuthenticateGeneric;
12
+ test: ICredentialTestRequest;
13
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FastGPTApi = void 0;
4
+ class FastGPTApi {
5
+ constructor() {
6
+ this.name = 'fastGPTApi';
7
+ this.displayName = 'FastGPT API';
8
+ this.documentationUrl = 'https://github.com/labring/FastGPT';
9
+ this.icon = { light: 'file:../nodes/FastGPT/FastGPT.svg', dark: 'file:../nodes/FastGPT/FastGPT.svg' };
10
+ this.properties = [
11
+ {
12
+ displayName: 'Api Key',
13
+ name: 'apiKey',
14
+ type: 'string',
15
+ typeOptions: { password: true },
16
+ required: true,
17
+ default: '',
18
+ },
19
+ {
20
+ displayName: 'API根地址',
21
+ required: true,
22
+ name: 'baseUrl',
23
+ type: 'string',
24
+ default: '',
25
+ hint: '必须以http://或https://开头,通常以/api结尾',
26
+ },
27
+ ];
28
+ this.authenticate = {
29
+ type: 'generic',
30
+ properties: {
31
+ headers: {
32
+ Authorization: '=Bearer {{$credentials.apiKey}}'
33
+ },
34
+ },
35
+ };
36
+ this.test = {
37
+ request: {
38
+ baseURL: '={{$credentials.baseUrl}}',
39
+ url: '/v1/chat/completions',
40
+ headers: {
41
+ Authorization: '=Bearer {{$credentials.apiKey}}',
42
+ 'Content-Type': 'application/json',
43
+ },
44
+ method: 'POST',
45
+ body: {
46
+ "chatId": "n8n-fastgpt-chat-test",
47
+ "stream": false,
48
+ "detail": false,
49
+ "variables": {
50
+ "uid": "n8n-fastgpt-chat-test-uid"
51
+ },
52
+ "messages": [
53
+ {
54
+ "role": "user",
55
+ "content": "hi"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ };
61
+ }
62
+ }
63
+ exports.FastGPTApi = FastGPTApi;
64
+ //# sourceMappingURL=FastGPTApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FastGPTApi.credentials.js","sourceRoot":"","sources":["../../credentials/Fast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DC"}
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const chatOperations: INodeProperties[];
3
+ export declare const chatFields: INodeProperties[];
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.chatFields = exports.chatOperations = void 0;
4
+ const GenericFunctions_1 = require("./GenericFunctions");
5
+ exports.chatOperations = [
6
+ {
7
+ displayName: 'Operation',
8
+ name: 'operation',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ displayOptions: {
12
+ show: {
13
+ resource: ['chat'],
14
+ },
15
+ },
16
+ options: [
17
+ {
18
+ name: '客服对话',
19
+ value: '客服对话',
20
+ action: '客服对话',
21
+ description: 'Create one or more completions for a given text',
22
+ routing: {
23
+ request: {
24
+ method: 'POST',
25
+ url: '/v1/chat/completions',
26
+ body: {
27
+ stream: false,
28
+ }
29
+ },
30
+ output: { postReceive: [GenericFunctions_1.sendErrorPostReceive] },
31
+ },
32
+ },
33
+ ],
34
+ default: '客服对话',
35
+ },
36
+ ];
37
+ const completeOperations = [
38
+ {
39
+ displayName: '会话ID',
40
+ name: 'chatId',
41
+ type: 'string',
42
+ default: 'n8n-chat-id',
43
+ required: true,
44
+ displayOptions: {
45
+ show: {
46
+ operation: ['客服对话'],
47
+ resource: ['chat'],
48
+ },
49
+ },
50
+ routing: {
51
+ send: {
52
+ type: 'body',
53
+ property: 'chatId',
54
+ },
55
+ }
56
+ },
57
+ {
58
+ displayName: '对话消息',
59
+ name: 'prompt',
60
+ type: 'fixedCollection',
61
+ typeOptions: {
62
+ sortable: true,
63
+ multipleValues: true,
64
+ },
65
+ displayOptions: {
66
+ show: {
67
+ resource: ['chat'],
68
+ operation: ['客服对话'],
69
+ },
70
+ },
71
+ required: true,
72
+ placeholder: '添加消息',
73
+ default: {},
74
+ options: [
75
+ {
76
+ displayName: '消息列表',
77
+ name: 'messages',
78
+ values: [
79
+ {
80
+ displayName: 'Role',
81
+ name: 'role',
82
+ type: 'options',
83
+ options: [
84
+ {
85
+ name: 'Assistant',
86
+ value: 'assistant',
87
+ },
88
+ {
89
+ name: 'System',
90
+ value: 'system',
91
+ },
92
+ {
93
+ name: 'User',
94
+ value: 'user',
95
+ },
96
+ ],
97
+ default: 'user',
98
+ },
99
+ {
100
+ displayName: 'Content',
101
+ name: 'content',
102
+ type: 'string',
103
+ default: '',
104
+ },
105
+ ],
106
+ },
107
+ ],
108
+ routing: {
109
+ send: {
110
+ type: 'body',
111
+ property: 'messages',
112
+ value: '={{ $value.messages }}',
113
+ },
114
+ },
115
+ },
116
+ {
117
+ displayName: '模块变量',
118
+ name: 'variables',
119
+ type: 'fixedCollection',
120
+ typeOptions: {
121
+ sortable: true,
122
+ multipleValues: true,
123
+ },
124
+ displayOptions: {
125
+ show: {
126
+ resource: ['chat'],
127
+ operation: ['客服对话'],
128
+ },
129
+ },
130
+ placeholder: '添加变量',
131
+ default: {},
132
+ options: [
133
+ {
134
+ displayName: '变量列表',
135
+ name: 'variables',
136
+ values: [
137
+ {
138
+ displayName: 'Key',
139
+ name: 'key',
140
+ type: 'string',
141
+ default: '',
142
+ },
143
+ {
144
+ displayName: 'Value',
145
+ name: 'value',
146
+ type: 'string',
147
+ default: '',
148
+ },
149
+ ],
150
+ },
151
+ ],
152
+ routing: {
153
+ send: {
154
+ type: 'body',
155
+ property: 'variables',
156
+ value: '={{ Object.fromEntries($value.variables.map(item => [item.key, item.value])) }}',
157
+ },
158
+ },
159
+ },
160
+ {
161
+ displayName: '响应对话详情',
162
+ name: 'detail',
163
+ type: 'boolean',
164
+ default: false,
165
+ displayOptions: {
166
+ show: {
167
+ operation: ['客服对话'],
168
+ resource: ['chat'],
169
+ },
170
+ },
171
+ routing: {
172
+ send: {
173
+ type: 'body',
174
+ property: 'detail',
175
+ },
176
+ }
177
+ },
178
+ {
179
+ displayName: '简化输出结果',
180
+ name: 'simplifyOutput',
181
+ type: 'boolean',
182
+ default: true,
183
+ displayOptions: {
184
+ show: {
185
+ operation: ['客服对话'],
186
+ resource: ['chat'],
187
+ },
188
+ },
189
+ routing: {
190
+ output: {
191
+ postReceive: [
192
+ {
193
+ type: 'set',
194
+ enabled: '={{$value}}',
195
+ properties: {
196
+ value: '={{ { "data": $response.body.choices } }}',
197
+ },
198
+ },
199
+ {
200
+ type: 'rootProperty',
201
+ enabled: '={{$value}}',
202
+ properties: {
203
+ property: 'data',
204
+ },
205
+ },
206
+ async function (items) {
207
+ if (this.getNode().parameters.simplifyOutput === false) {
208
+ return items;
209
+ }
210
+ return items.map((item) => {
211
+ return {
212
+ json: {
213
+ ...item.json,
214
+ message: item.json.message,
215
+ },
216
+ };
217
+ });
218
+ },
219
+ ],
220
+ },
221
+ }
222
+ },
223
+ ];
224
+ const sharedOperations = [];
225
+ exports.chatFields = [
226
+ ...completeOperations,
227
+ ...sharedOperations,
228
+ ];
229
+ //# sourceMappingURL=ChatDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatDescription.js","sourceRoot":"","sources":["../../../nodes/FastGPT/ChatDescription.ts"],"names":[],"mappings":";;;AACA,yDAA0D;AAE7C,QAAA,cAAc,GAAsB;IAChD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,MAAM,CAAC;aAClB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,iDAAiD;gBAC9D,OAAO,EAAE;oBACR,OAAO,EAAE;wBACR,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,sBAAsB;wBAC3B,IAAI,EAAE;4BACL,MAAM,EAAE,KAAK;yBACb;qBACD;oBACD,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,uCAAoB,CAAC,EAAE;iBA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,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE,QAAQ;aAClB;SACD;KACD;IACD;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,IAAI;QACb,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,QAAQ,EAAE,CAAC,MAAM,CAAC;aAClB;SACD;QACD,OAAO,EAAE;YACR,MAAM,EAAE;gBACP,WAAW,EAAE;oBACZ;wBACC,IAAI,EAAE,KAAK;wBACX,OAAO,EAAE,aAAa;wBACtB,UAAU,EAAE;4BACX,KAAK,EAAE,2CAA2C;yBAClD;qBACD;oBACD;wBACC,IAAI,EAAE,cAAc;wBACpB,OAAO,EAAE,aAAa;wBACtB,UAAU,EAAE;4BACX,QAAQ,EAAE,MAAM;yBAChB;qBACD;oBACD,KAAK,WAAW,KAA2B;wBAC1C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,cAAc,KAAK,KAAK,EAAE;4BACvD,OAAO,KAAK,CAAC;yBACb;wBACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;4BACzB,OAAO;gCACN,IAAI,EAAE;oCACL,GAAG,IAAI,CAAC,IAAI;oCACZ,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO;iCAC1B;6BACD,CAAC;wBACH,CAAC,CAAC,CAAC;oBACJ,CAAC;iBACD;aACD;SACD;KACD;CACD,CAAC;AAEF,MAAM,gBAAgB,GAAsB,EAAE,CAAC;AAElC,QAAA,UAAU,GAAsB;IAI5C,GAAG,kBAAkB;IAKrB,GAAG,gBAAgB;CACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type INodeProperties } from 'n8n-workflow';
2
+ export declare const datasetOperations: INodeProperties[];
3
+ export declare const datasetFields: INodeProperties[];