diff --git a/components/stealthgpt/actions/generate-content/generate-content.mjs b/components/stealthgpt/actions/generate-content/generate-content.mjs new file mode 100644 index 0000000000000..cd4bbc3139700 --- /dev/null +++ b/components/stealthgpt/actions/generate-content/generate-content.mjs @@ -0,0 +1,78 @@ +import app from "../../stealthgpt.app.mjs"; + +export default { + key: "stealthgpt-generate-content", + name: "Generate or Rephrase Content", + description: "Generates or rephrases content based on the provided prompt. [See the documentation](https://docs.stealthgpt.ai/api-requests-and-parameters)", + version: "0.0.1", + type: "action", + props: { + app, + prompt: { + propDefinition: [ + app, + "prompt", + ], + }, + rephrase: { + type: "boolean", + label: "Rephrase", + 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.", + }, + tone: { + type: "string", + label: "Tone", + description: "Specifies the desired tone for the response. For example, `Casual`, `Academic`, etc.", + optional: true, + }, + mode: { + type: "string", + label: "Mode", + description: "Indicates the detail level of the response: `High`, `Medium`, or `Low`.", + optional: true, + options: [ + "High", + "Medium", + "Low", + ], + }, + business: { + type: "boolean", + label: "Business", + 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.", + optional: true, + }, + }, + methods: { + generateContent(args = {}) { + return this.app.post({ + path: "/stealthify", + ...args, + }); + }, + }, + async run({ $ }) { + const { + generateContent, + prompt, + rephrase, + tone, + mode, + business, + } = this; + + const response = await generateContent({ + $, + data: { + prompt, + rephrase, + tone, + mode, + business, + }, + }); + + $.export("$summary", "Successfully generated content."); + return response; + }, +}; diff --git a/components/stealthgpt/actions/generate-undetectable-content/generate-undetectable-content.mjs b/components/stealthgpt/actions/generate-undetectable-content/generate-undetectable-content.mjs new file mode 100644 index 0000000000000..b0297cab133e9 --- /dev/null +++ b/components/stealthgpt/actions/generate-undetectable-content/generate-undetectable-content.mjs @@ -0,0 +1,64 @@ +import app from "../../stealthgpt.app.mjs"; + +export default { + key: "stealthgpt-generate-undetectable-content", + name: "Generate Undetectable Content", + description: "Generates full, undetectable blog articles with relevant images in markdown.", + version: "0.0.1", + type: "action", + props: { + app, + prompt: { + description: "The input text or question for which you want the StealthGPT to generate content.", + propDefinition: [ + app, + "prompt", + ], + }, + withImages: { + type: "boolean", + label: "With Images", + description: "A boolean value indicating whether to include images in the generated content. Default is `true`.", + optional: true, + }, + size: { + type: "string", + label: "Size", + description: "The desired length of the generated article. Can be `small`, `medium`, or `long`. Default is `small`.", + optional: true, + options: [ + "small", + "medium", + "long", + ], + }, + }, + methods: { + generateUndetectableContent(args = {}) { + return this.app.post({ + path: "/stealthify/articles", + ...args, + }); + }, + }, + async run({ $ }) { + const { + generateUndetectableContent, + prompt, + size, + withImages, + } = this; + + const response = await generateUndetectableContent({ + $, + data: { + prompt, + size, + withImages, + }, + }); + + $.export("$summary", "Successfully generated undetectable content."); + return response; + }, +}; diff --git a/components/stealthgpt/package.json b/components/stealthgpt/package.json index 7fcf31e06c418..67a3c4a61b3c6 100644 --- a/components/stealthgpt/package.json +++ b/components/stealthgpt/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/stealthgpt", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream StealthGPT Components", "main": "stealthgpt.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "3.0.3" } -} \ No newline at end of file +} diff --git a/components/stealthgpt/stealthgpt.app.mjs b/components/stealthgpt/stealthgpt.app.mjs index f3a0c1bdbb9d4..a6ff1dd12d2ab 100644 --- a/components/stealthgpt/stealthgpt.app.mjs +++ b/components/stealthgpt/stealthgpt.app.mjs @@ -1,11 +1,40 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "stealthgpt", - propDefinitions: {}, + propDefinitions: { + prompt: { + type: "string", + label: "Prompt", + description: "The prompt to be used as the basis for content generation, or the content to be rephrased.", + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + getUrl(path) { + return `https://stealthgpt.ai/api${path}`; + }, + getHeaders(headers) { + return { + ...headers, + "Content-Type": "application/json", + "api-token": this.$auth.api_key, + }; + }, + _makeRequest({ + $ = this, path, headers, ...args + } = {}) { + return axios($, { + ...args, + url: this.getUrl(path), + headers: this.getHeaders(headers), + }); + }, + post(args = {}) { + return this._makeRequest({ + method: "POST", + ...args, + }); }, }, -}; \ No newline at end of file +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f44eec1f3d5f..f31e131adb642 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9499,7 +9499,10 @@ importers: '@pipedream/platform': 1.5.1 components/stealthgpt: - specifiers: {} + specifiers: + '@pipedream/platform': 3.0.3 + dependencies: + '@pipedream/platform': 3.0.3 components/stealthseminar: specifiers: {}