-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (42 loc) · 1.02 KB
/
index.js
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
const Workflow = require("@saltcorn/data/models/workflow");
const Form = require("@saltcorn/data/models/form");
const { generateAsync } = require("stability-client");
const configuration_workflow = () =>
new Workflow({
steps: [
{
name: "API key",
form: async (context) => {
return new Form({
fields: [
{
name: "api_key",
label: "API key",
sublabel: "From Dreamstudio account settings",
type: "String",
},
],
});
},
},
],
});
const functions = ({ api_key }) => ({
stability_generate: {
run: async (prompt) => {
const { res, images } = await generateAsync({
prompt,
apiKey: api_key,
});
return images;
},
isAsync: true,
description: "Generate an image",
arguments: [{ name: "prompt", type: "String" }],
},
});
module.exports = {
sc_plugin_api_version: 1,
configuration_workflow,
functions,
};