-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
94 lines (91 loc) · 3.11 KB
/
Copy pathindex.js
File metadata and controls
94 lines (91 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const Workflow = require("@saltcorn/data/models/workflow");
const Form = require("@saltcorn/data/models/form");
const Trigger = require("@saltcorn/data/models/trigger");
const { features } = require("@saltcorn/data/db/state");
const db = require("@saltcorn/data/db");
const Plugin = require("@saltcorn/data/models/plugin");
const { viewname } = require("./app-constructor/common.js");
const configuration_workflow = (cfg) =>
new Workflow({
steps: [
{
name: "Configuration",
form: async () => {
const triggers = await Trigger.find({ action: "Agent" });
const webSearchTriggers = triggers.filter((t) =>
(t.configuration?.skills || []).some(
(s) =>
s.skill_type === "Web search" &&
["Tavily", "Firecrawl"].includes(s.search_provider)
)
);
return new Form({
fields: [
{
input_type: "section_header",
label: "App Constructor",
},
{
name: "web_search_trigger",
label: "Web search trigger",
sublabel:
"Agent trigger with a Tavily or Firecrawl web search skill. " +
"Used during the Research step to gather domain-specific facts before generating questions.",
type: "String",
attributes: {
options: ["", ...webSearchTriggers.map((t) => t.name)],
},
},
],
});
},
},
],
});
const headers = [
{
script: `/static_assets/${db.connectObj.version_tag}/mermaid.min.js`,
onlyViews: [viewname],
},
];
module.exports = {
sc_plugin_api_version: 1,
configuration_workflow,
headers: () => headers,
dependencies: ["@saltcorn/large-language-model", "@saltcorn/agents"],
viewtemplates: () =>
features.workflows
? [
require("./user-copilot"),
require("./copilot-as-agent"),
require("./app-constructor/view.js"),
]
: [require("./action-builder"), require("./database-designer")],
functions: () =>
features.workflows
? {
copilot_standard_prompt: require("./standard-prompt.js"),
copilot_generate_layout: require("./builder-gen.js"),
copilot_generate_workflow: require("./workflow-gen"),
copilot_generate_javascript: require("./js-code-gen.js"),
}
: {},
actions: () => ({
copilot_generate_page: require("./page-gen-action"),
app_constructor_feedback: require("./app-constructor/feedback-action.js"),
}),
exchange: () => ({
agent_skills: [
require("./agent-skills/pagegen.js"),
require("./agent-skills/database-design.js"),
require("./agent-skills/workflow.js"),
require("./agent-skills/viewgen.js"),
require("./agent-skills/registry-editor.js"),
require("./agent-skills/js-action.js"),
require("./agent-skills/triggergen.js"),
...(typeof Plugin.loadAndSaveNewPlugin === "function"
? [require("./agent-skills/install-plugin.js")]
: []),
],
}),
};