@tiger16601/n8n-nodes-fastgpt 1.1.13 → 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.
|
@@ -87,7 +87,6 @@ exports.chatOperations = [
|
|
|
87
87
|
url: "/v1/chat/completions",
|
|
88
88
|
body: {
|
|
89
89
|
stream: false,
|
|
90
|
-
detail: true,
|
|
91
90
|
},
|
|
92
91
|
},
|
|
93
92
|
output: {
|
|
@@ -400,10 +399,34 @@ const completeOperations = [
|
|
|
400
399
|
default: "user",
|
|
401
400
|
},
|
|
402
401
|
{
|
|
403
|
-
displayName: "
|
|
402
|
+
displayName: "文本内容",
|
|
404
403
|
name: "content",
|
|
405
404
|
type: "string",
|
|
406
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
|
+
"当填写文档链接时,需要填写文档名称(带后缀)",
|
|
407
430
|
},
|
|
408
431
|
],
|
|
409
432
|
},
|
|
@@ -412,7 +435,63 @@ const completeOperations = [
|
|
|
412
435
|
send: {
|
|
413
436
|
type: "body",
|
|
414
437
|
property: "messages",
|
|
415
|
-
|
|
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
|
+
],
|
|
416
495
|
},
|
|
417
496
|
},
|
|
418
497
|
},
|