@saltcorn/large-language-model 0.8.6 → 0.8.7
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/index.js +13 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -601,6 +601,13 @@ module.exports = {
|
|
|
601
601
|
label: r.role,
|
|
602
602
|
}));
|
|
603
603
|
const commonFields = [
|
|
604
|
+
{
|
|
605
|
+
name: "filename",
|
|
606
|
+
label: "File name",
|
|
607
|
+
type: "String",
|
|
608
|
+
sublabel:
|
|
609
|
+
"Name of the generated file. Interpolations <code>{{ }}</code> available",
|
|
610
|
+
},
|
|
604
611
|
{
|
|
605
612
|
label: "Minimum role to access",
|
|
606
613
|
name: "min_role",
|
|
@@ -683,6 +690,7 @@ module.exports = {
|
|
|
683
690
|
answer_field,
|
|
684
691
|
min_role,
|
|
685
692
|
model,
|
|
693
|
+
filename,
|
|
686
694
|
},
|
|
687
695
|
}) => {
|
|
688
696
|
let prompt;
|
|
@@ -696,6 +704,10 @@ module.exports = {
|
|
|
696
704
|
"llm_generate prompt formula"
|
|
697
705
|
);
|
|
698
706
|
else prompt = row[prompt_field];
|
|
707
|
+
|
|
708
|
+
const use_filename = filename
|
|
709
|
+
? interpolate(filename, row, user, "llm_generate_image file name")
|
|
710
|
+
: "generated.png";
|
|
699
711
|
const opts = { debugResult: true }; // response_format: "b64_json" };
|
|
700
712
|
|
|
701
713
|
if (model) opts.model = model;
|
|
@@ -712,7 +724,7 @@ module.exports = {
|
|
|
712
724
|
} else if (ans.b64_json) {
|
|
713
725
|
const imgContents = Buffer.from(ans.b64_json, "base64");
|
|
714
726
|
const file = await File.from_contents(
|
|
715
|
-
|
|
727
|
+
use_filename,
|
|
716
728
|
"image/png",
|
|
717
729
|
imgContents,
|
|
718
730
|
user?.id,
|