@tiger16601/n8n-nodes-fastgpt 1.1.12 → 1.1.14
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.
|
@@ -32,17 +32,58 @@ exports.chatOperations = [
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
|
-
// NEW:
|
|
35
|
+
// NEW: 纯文本对话 - 纯文本消息
|
|
36
36
|
{
|
|
37
|
-
name: "
|
|
38
|
-
value: "
|
|
39
|
-
action: "
|
|
37
|
+
name: "纯文本对话",
|
|
38
|
+
value: "纯文本对话",
|
|
39
|
+
action: "纯文本对话",
|
|
40
|
+
description: "请求对话Agent进行纯文本对话,使用固定消息格式。",
|
|
41
|
+
routing: {
|
|
42
|
+
request: {
|
|
43
|
+
method: "POST",
|
|
44
|
+
// NEW: 纯文本对话端点
|
|
45
|
+
url: "/v1/chat/completions",
|
|
46
|
+
body: {
|
|
47
|
+
stream: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
output: {
|
|
51
|
+
postReceive: [GenericFunctions_1.sendErrorPostReceive],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
// NEW: 多模态对话 - 支持图片/文件
|
|
56
|
+
{
|
|
57
|
+
name: "多模态对话",
|
|
58
|
+
value: "多模态对话",
|
|
59
|
+
action: "多模态对话",
|
|
60
|
+
description:
|
|
61
|
+
"请求对话Agent进行多模态对话,支持上传图片(image_url)和文件(file_url)。",
|
|
62
|
+
routing: {
|
|
63
|
+
request: {
|
|
64
|
+
method: "POST",
|
|
65
|
+
// NEW: 多模态对话端点
|
|
66
|
+
url: "/v1/chat/completions",
|
|
67
|
+
body: {
|
|
68
|
+
stream: false,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
output: {
|
|
72
|
+
postReceive: [GenericFunctions_1.sendErrorPostReceive],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
// NEW: 请求插件,通过variables传递输入参数,获取pluginData输出
|
|
77
|
+
{
|
|
78
|
+
name: "请求插件",
|
|
79
|
+
value: "请求插件",
|
|
80
|
+
action: "请求插件",
|
|
40
81
|
description:
|
|
41
|
-
"
|
|
82
|
+
"调用插件类型的应用。无需chatId和messages,通过variables传入插件参数,通过pluginData获取输出。",
|
|
42
83
|
routing: {
|
|
43
84
|
request: {
|
|
44
85
|
method: "POST",
|
|
45
|
-
// NEW: Agent
|
|
86
|
+
// NEW: 请求插件端点(与Agent共用端点)
|
|
46
87
|
url: "/v1/chat/completions",
|
|
47
88
|
body: {
|
|
48
89
|
stream: false,
|
|
@@ -85,7 +126,7 @@ exports.chatOperations = [
|
|
|
85
126
|
request: {
|
|
86
127
|
method: "POST",
|
|
87
128
|
// NEW: 获取历史记录列表端点
|
|
88
|
-
url: "/
|
|
129
|
+
url: "/core/chat/history/getHistories",
|
|
89
130
|
},
|
|
90
131
|
output: {
|
|
91
132
|
postReceive: [GenericFunctions_1.sendErrorPostReceive],
|
|
@@ -298,7 +339,13 @@ const completeOperations = [
|
|
|
298
339
|
required: true,
|
|
299
340
|
displayOptions: {
|
|
300
341
|
show: {
|
|
301
|
-
operation: [
|
|
342
|
+
operation: [
|
|
343
|
+
"客服对话",
|
|
344
|
+
"纯文本对话",
|
|
345
|
+
"多模态对话",
|
|
346
|
+
"交互节点继续运行",
|
|
347
|
+
"请求插件",
|
|
348
|
+
],
|
|
302
349
|
resource: ["chat"],
|
|
303
350
|
},
|
|
304
351
|
},
|
|
@@ -320,7 +367,7 @@ const completeOperations = [
|
|
|
320
367
|
displayOptions: {
|
|
321
368
|
show: {
|
|
322
369
|
resource: ["chat"],
|
|
323
|
-
operation: ["客服对话", "交互节点继续运行"],
|
|
370
|
+
operation: ["客服对话", "纯文本对话", "交互节点继续运行"],
|
|
324
371
|
},
|
|
325
372
|
},
|
|
326
373
|
required: true,
|
|
@@ -352,10 +399,34 @@ const completeOperations = [
|
|
|
352
399
|
default: "user",
|
|
353
400
|
},
|
|
354
401
|
{
|
|
355
|
-
displayName: "
|
|
402
|
+
displayName: "文本内容",
|
|
356
403
|
name: "content",
|
|
357
404
|
type: "string",
|
|
358
405
|
default: "",
|
|
406
|
+
description: "纯文本消息内容",
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
displayName: "图片链接(可选)",
|
|
410
|
+
name: "imageUrl",
|
|
411
|
+
type: "string",
|
|
412
|
+
default: "",
|
|
413
|
+
description: "填写图片URL,会自动以image_url格式拼接",
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
displayName: "文档链接(可选)",
|
|
417
|
+
name: "fileUrl",
|
|
418
|
+
type: "string",
|
|
419
|
+
default: "",
|
|
420
|
+
description:
|
|
421
|
+
"填写文档URL(支持txt/md/html/word/pdf/ppt/csv/excel)",
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
displayName: "文档名称",
|
|
425
|
+
name: "fileName",
|
|
426
|
+
type: "string",
|
|
427
|
+
default: "",
|
|
428
|
+
description:
|
|
429
|
+
"当填写文档链接时,需要填写文档名称(带后缀)",
|
|
359
430
|
},
|
|
360
431
|
],
|
|
361
432
|
},
|
|
@@ -364,7 +435,63 @@ const completeOperations = [
|
|
|
364
435
|
send: {
|
|
365
436
|
type: "body",
|
|
366
437
|
property: "messages",
|
|
367
|
-
|
|
438
|
+
// NEW: 自动处理纯文本与多模态格式
|
|
439
|
+
preSend: [
|
|
440
|
+
async function (requestOptions) {
|
|
441
|
+
const messages = this.getNodeParameter("prompt");
|
|
442
|
+
if (messages && messages.messages) {
|
|
443
|
+
requestOptions.body.messages =
|
|
444
|
+
messages.messages.map(function (msg) {
|
|
445
|
+
const hasImage =
|
|
446
|
+
msg.imageUrl &&
|
|
447
|
+
String(msg.imageUrl).trim();
|
|
448
|
+
const hasFile =
|
|
449
|
+
msg.fileUrl &&
|
|
450
|
+
String(msg.fileUrl).trim();
|
|
451
|
+
if (hasImage || hasFile) {
|
|
452
|
+
const contentArr = [];
|
|
453
|
+
if (
|
|
454
|
+
msg.content &&
|
|
455
|
+
String(msg.content).trim()
|
|
456
|
+
) {
|
|
457
|
+
contentArr.push({
|
|
458
|
+
type: "text",
|
|
459
|
+
text: String(
|
|
460
|
+
msg.content,
|
|
461
|
+
).trim(),
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
if (hasImage) {
|
|
465
|
+
contentArr.push({
|
|
466
|
+
type: "image_url",
|
|
467
|
+
image_url: {
|
|
468
|
+
url: String(
|
|
469
|
+
msg.imageUrl,
|
|
470
|
+
).trim(),
|
|
471
|
+
},
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
if (hasFile) {
|
|
475
|
+
contentArr.push({
|
|
476
|
+
type: "file_url",
|
|
477
|
+
name: msg.fileName || "",
|
|
478
|
+
url: String(msg.fileUrl).trim(),
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
role: msg.role,
|
|
483
|
+
content: contentArr,
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
role: msg.role,
|
|
488
|
+
content: msg.content || "",
|
|
489
|
+
};
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
return requestOptions;
|
|
493
|
+
},
|
|
494
|
+
],
|
|
368
495
|
},
|
|
369
496
|
},
|
|
370
497
|
},
|
|
@@ -379,7 +506,7 @@ const completeOperations = [
|
|
|
379
506
|
displayOptions: {
|
|
380
507
|
show: {
|
|
381
508
|
resource: ["chat"],
|
|
382
|
-
operation: ["客服对话", "
|
|
509
|
+
operation: ["客服对话", "纯文本对话", "多模态对话", "请求插件"],
|
|
383
510
|
},
|
|
384
511
|
},
|
|
385
512
|
placeholder: "添加变量",
|
|
@@ -419,7 +546,12 @@ const completeOperations = [
|
|
|
419
546
|
default: false,
|
|
420
547
|
displayOptions: {
|
|
421
548
|
show: {
|
|
422
|
-
operation: [
|
|
549
|
+
operation: [
|
|
550
|
+
"客服对话",
|
|
551
|
+
"纯文本对话",
|
|
552
|
+
"多模态对话",
|
|
553
|
+
"交互节点继续运行",
|
|
554
|
+
],
|
|
423
555
|
resource: ["chat"],
|
|
424
556
|
},
|
|
425
557
|
},
|
|
@@ -430,7 +562,7 @@ const completeOperations = [
|
|
|
430
562
|
},
|
|
431
563
|
},
|
|
432
564
|
},
|
|
433
|
-
// NEW: 响应对话项ID -
|
|
565
|
+
// NEW: 响应对话项ID - 用于Agent对话
|
|
434
566
|
{
|
|
435
567
|
displayName: "响应对话项ID",
|
|
436
568
|
name: "responseChatItemId",
|
|
@@ -439,7 +571,7 @@ const completeOperations = [
|
|
|
439
571
|
description: "指定响应对话项的ID,用于跟踪对话项(选填)",
|
|
440
572
|
displayOptions: {
|
|
441
573
|
show: {
|
|
442
|
-
operation: ["
|
|
574
|
+
operation: ["纯文本对话", "多模态对话"],
|
|
443
575
|
resource: ["chat"],
|
|
444
576
|
},
|
|
445
577
|
},
|
|
@@ -450,7 +582,7 @@ const completeOperations = [
|
|
|
450
582
|
},
|
|
451
583
|
},
|
|
452
584
|
},
|
|
453
|
-
// NEW:
|
|
585
|
+
// NEW: 多模态对话消息 - 支持文本/图片/文件
|
|
454
586
|
{
|
|
455
587
|
displayName: "Agent对话消息",
|
|
456
588
|
name: "agentMessages",
|
|
@@ -461,7 +593,7 @@ const completeOperations = [
|
|
|
461
593
|
'消息列表,JSON格式。content支持字符串或数组(可包含text/image_url/file_url类型)。示例:[{"role":"user","content":[{"type":"text","text":"导演是谁"},{"type":"image_url","image_url":{"url":"图片链接"}}]}]',
|
|
462
594
|
displayOptions: {
|
|
463
595
|
show: {
|
|
464
|
-
operation: ["
|
|
596
|
+
operation: ["多模态对话"],
|
|
465
597
|
resource: ["chat"],
|
|
466
598
|
},
|
|
467
599
|
},
|
|
@@ -497,7 +629,12 @@ const completeOperations = [
|
|
|
497
629
|
default: true,
|
|
498
630
|
displayOptions: {
|
|
499
631
|
show: {
|
|
500
|
-
operation: [
|
|
632
|
+
operation: [
|
|
633
|
+
"客服对话",
|
|
634
|
+
"纯文本对话",
|
|
635
|
+
"多模态对话",
|
|
636
|
+
"交互节点继续运行",
|
|
637
|
+
],
|
|
501
638
|
resource: ["chat"],
|
|
502
639
|
},
|
|
503
640
|
},
|