Skip to content

Commit 30f9392

Browse files
committed
[Components] stealthgpt
1 parent c934e9f commit 30f9392

File tree

5 files changed

+185
-8
lines changed

5 files changed

+185
-8
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import app from "../../stealthgpt.app.mjs";
2+
3+
export default {
4+
key: "stealthgpt-generate-content",
5+
name: "Generate or Rephrase Content",
6+
description: "Generates or rephrases content based on the provided prompt. [See the documentation](https://docs.stealthgpt.ai/api-requests-and-parameters)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
prompt: {
12+
propDefinition: [
13+
app,
14+
"prompt",
15+
],
16+
},
17+
rephrase: {
18+
type: "boolean",
19+
label: "Rephrase",
20+
description: "A boolean value (`true` or `false`) that indicates whether the API should rephrase the content or generate new content based on the prompt. Set to `true` for rephrasing and `false` for content generation.",
21+
},
22+
tone: {
23+
type: "string",
24+
label: "Tone",
25+
description: "Specifies the desired tone for the response. For example, `Casual`, `Academic`, etc.",
26+
optional: true,
27+
},
28+
mode: {
29+
type: "string",
30+
label: "Mode",
31+
description: "Indicates the detail level of the response: `High`, `Medium`, or `Low`.",
32+
optional: true,
33+
options: [
34+
"High",
35+
"Medium",
36+
"Low",
37+
],
38+
},
39+
business: {
40+
type: "boolean",
41+
label: "Business",
42+
description: "A boolean flag to indicate if the request is related to a business context. Setting this to `true` uses a model 10x more powerful than the standard StealthGPT engine, making the content far more undetectable and coherent but also consuming more tokens.",
43+
optional: true,
44+
},
45+
},
46+
methods: {
47+
generateContent(args = {}) {
48+
return this.app.post({
49+
path: "/stealthify",
50+
...args,
51+
});
52+
},
53+
},
54+
async run({ $ }) {
55+
const {
56+
generateContent,
57+
prompt,
58+
rephrase,
59+
tone,
60+
mode,
61+
business,
62+
} = this;
63+
64+
const response = await generateContent({
65+
$,
66+
data: {
67+
prompt,
68+
rephrase,
69+
tone,
70+
mode,
71+
business,
72+
},
73+
});
74+
75+
$.export("$summary", "Successfully generated content.");
76+
return response;
77+
},
78+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import app from "../../stealthgpt.app.mjs";
2+
3+
export default {
4+
key: "stealthgpt-generate-undetectable-content",
5+
name: "Generate Undetectable Content",
6+
description: "Generates full, undetectable blog articles with relevant images in markdown.",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
prompt: {
12+
description: "The input text or question for which you want the StealthGPT to generate content.",
13+
propDefinition: [
14+
app,
15+
"prompt",
16+
],
17+
},
18+
withImages: {
19+
type: "boolean",
20+
label: "With Images",
21+
description: "A boolean value indicating whether to include images in the generated content. Default is `true`.",
22+
optional: true,
23+
},
24+
size: {
25+
type: "string",
26+
label: "Size",
27+
description: "The desired length of the generated article. Can be `small`, `medium`, or `long`. Default is `small`.",
28+
optional: true,
29+
options: [
30+
"small",
31+
"medium",
32+
"long",
33+
],
34+
},
35+
},
36+
methods: {
37+
generateUndetectableContent(args = {}) {
38+
return this.app.post({
39+
path: "/stealthify/articles",
40+
...args,
41+
});
42+
},
43+
},
44+
async run({ $ }) {
45+
const {
46+
generateUndetectableContent,
47+
prompt,
48+
size,
49+
withImages,
50+
} = this;
51+
52+
const response = await generateUndetectableContent({
53+
$,
54+
data: {
55+
prompt,
56+
size,
57+
withImages,
58+
},
59+
});
60+
61+
$.export("$summary", "Successfully generated undetectable content.");
62+
return response;
63+
},
64+
};

components/stealthgpt/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/stealthgpt",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream StealthGPT Components",
55
"main": "stealthgpt.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "3.0.3"
1417
}
15-
}
18+
}
Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "stealthgpt",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
prompt: {
8+
type: "string",
9+
label: "Prompt",
10+
description: "The prompt to be used as the basis for content generation, or the content to be rephrased.",
11+
},
12+
},
513
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
14+
getUrl(path) {
15+
return `https://stealthgpt.ai/api${path}`;
16+
},
17+
getHeaders(headers) {
18+
return {
19+
...headers,
20+
"Content-Type": "application/json",
21+
"api-token": this.$auth.api_key,
22+
};
23+
},
24+
_makeRequest({
25+
$ = this, path, headers, ...args
26+
} = {}) {
27+
return axios($, {
28+
...args,
29+
url: this.getUrl(path),
30+
headers: this.getHeaders(headers),
31+
});
32+
},
33+
post(args = {}) {
34+
return this._makeRequest({
35+
method: "POST",
36+
...args,
37+
});
938
},
1039
},
11-
};
40+
};

pnpm-lock.yaml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)