@taskmagic/apps-textcortex-ai 0.0.1
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/README.md +7 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +47 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-code.d.ts +8 -0
- package/src/lib/actions/create-code.js +120 -0
- package/src/lib/actions/create-code.js.map +1 -0
- package/src/lib/actions/create-email.d.ts +17 -0
- package/src/lib/actions/create-email.js +233 -0
- package/src/lib/actions/create-email.js.map +1 -0
- package/src/lib/actions/create-paraphrase.d.ts +12 -0
- package/src/lib/actions/create-paraphrase.js +191 -0
- package/src/lib/actions/create-paraphrase.js.map +1 -0
- package/src/lib/actions/create-product-description.d.ts +14 -0
- package/src/lib/actions/create-product-description.js +198 -0
- package/src/lib/actions/create-product-description.js.map +1 -0
- package/src/lib/actions/create-social-caption.d.ts +12 -0
- package/src/lib/actions/create-social-caption.js +184 -0
- package/src/lib/actions/create-social-caption.js.map +1 -0
- package/src/lib/actions/create-summary.d.ts +12 -0
- package/src/lib/actions/create-summary.js +191 -0
- package/src/lib/actions/create-summary.js.map +1 -0
- package/src/lib/actions/create-translation.d.ts +6 -0
- package/src/lib/actions/create-translation.js +113 -0
- package/src/lib/actions/create-translation.js.map +1 -0
- package/src/lib/actions/send-prompt.d.ts +10 -0
- package/src/lib/actions/send-prompt.js +162 -0
- package/src/lib/actions/send-prompt.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +66 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +12 -0
- package/src/lib/common/client.js +26 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/common.d.ts +58 -0
- package/src/lib/common/common.js +231 -0
- package/src/lib/common/common.js.map +1 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createParaphrase = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const common_1 = require("../common/common");
|
|
10
|
+
exports.createParaphrase = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.textcortexAuth,
|
|
12
|
+
name: 'create_paraphrase',
|
|
13
|
+
displayName: 'Create Paraphrase',
|
|
14
|
+
description: 'Rewrite text while preserving its meaning.',
|
|
15
|
+
props: {
|
|
16
|
+
text: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Text to Paraphrase',
|
|
18
|
+
description: 'The text to paraphrase',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
21
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'File ID',
|
|
23
|
+
description: 'ID of the file to paraphrase',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
mode: pieces_framework_1.Property.StaticDropdown({
|
|
27
|
+
displayName: 'Mode',
|
|
28
|
+
description: 'Paraphrase mode',
|
|
29
|
+
required: false,
|
|
30
|
+
defaultValue: 'default',
|
|
31
|
+
options: {
|
|
32
|
+
options: [
|
|
33
|
+
{ label: 'Default', value: 'default' },
|
|
34
|
+
{ label: 'Embeddings', value: 'embeddings' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
39
|
+
displayName: 'Model',
|
|
40
|
+
description: 'The language model to use',
|
|
41
|
+
required: false,
|
|
42
|
+
defaultValue: 'gemini-2-0-flash',
|
|
43
|
+
options: {
|
|
44
|
+
options: common_1.AI_MODELS,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
formality: pieces_framework_1.Property.StaticDropdown({
|
|
48
|
+
displayName: 'Formality',
|
|
49
|
+
description: 'The formality of the generated text',
|
|
50
|
+
required: false,
|
|
51
|
+
defaultValue: 'default',
|
|
52
|
+
options: {
|
|
53
|
+
options: common_1.FORMALITY_LEVELS,
|
|
54
|
+
},
|
|
55
|
+
}),
|
|
56
|
+
source_lang: pieces_framework_1.Property.StaticDropdown({
|
|
57
|
+
displayName: 'Source Language',
|
|
58
|
+
description: 'The language of the source text',
|
|
59
|
+
required: false,
|
|
60
|
+
defaultValue: 'en',
|
|
61
|
+
options: {
|
|
62
|
+
options: [
|
|
63
|
+
{ label: 'English (Default)', value: 'en' },
|
|
64
|
+
{ label: 'Auto-detect', value: 'auto' },
|
|
65
|
+
...common_1.LANGUAGES.filter(lang => lang.value !== 'en'),
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
target_lang: pieces_framework_1.Property.StaticDropdown({
|
|
70
|
+
displayName: 'Target Language',
|
|
71
|
+
description: 'The language for the paraphrased text',
|
|
72
|
+
required: false,
|
|
73
|
+
defaultValue: 'en',
|
|
74
|
+
options: {
|
|
75
|
+
options: [
|
|
76
|
+
{ label: 'English (American)', value: 'en' },
|
|
77
|
+
{ label: 'English (British)', value: 'en-gb' },
|
|
78
|
+
{ label: 'Spanish', value: 'es' },
|
|
79
|
+
{ label: 'French', value: 'fr' },
|
|
80
|
+
{ label: 'German', value: 'de' },
|
|
81
|
+
{ label: 'Portuguese (Brazilian)', value: 'pt-br' },
|
|
82
|
+
{ label: 'Portuguese', value: 'pt' },
|
|
83
|
+
...common_1.LANGUAGES.filter(lang => !['en', 'pt', 'es', 'fr', 'de'].includes(lang.value)),
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
max_tokens: pieces_framework_1.Property.Number({
|
|
88
|
+
displayName: 'Max Tokens',
|
|
89
|
+
description: 'Maximum length of paraphrased text (1-4096 tokens)',
|
|
90
|
+
required: false,
|
|
91
|
+
defaultValue: 2048,
|
|
92
|
+
}),
|
|
93
|
+
temperature: pieces_framework_1.Property.Number({
|
|
94
|
+
displayName: 'Temperature',
|
|
95
|
+
description: 'Controls creativity (0.0-2.0). Higher values = more creative, lower = more focused.',
|
|
96
|
+
required: false,
|
|
97
|
+
}),
|
|
98
|
+
n: pieces_framework_1.Property.Number({
|
|
99
|
+
displayName: 'Number of Outputs',
|
|
100
|
+
description: 'How many paraphrases to generate (1-5)',
|
|
101
|
+
required: false,
|
|
102
|
+
defaultValue: 1,
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
run(context) {
|
|
106
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
|
+
try {
|
|
109
|
+
if (!context.propsValue.text && !context.propsValue.file_id) {
|
|
110
|
+
throw new Error('Please provide either "Text to Paraphrase" or "File ID" to paraphrase.');
|
|
111
|
+
}
|
|
112
|
+
const requestBody = {};
|
|
113
|
+
if (context.propsValue.text) {
|
|
114
|
+
requestBody.text = context.propsValue.text;
|
|
115
|
+
}
|
|
116
|
+
if (context.propsValue.file_id) {
|
|
117
|
+
requestBody.file_id = context.propsValue.file_id;
|
|
118
|
+
}
|
|
119
|
+
if (context.propsValue.mode && context.propsValue.mode !== 'default') {
|
|
120
|
+
requestBody.mode = context.propsValue.mode;
|
|
121
|
+
}
|
|
122
|
+
if (context.propsValue.model && context.propsValue.model !== 'gemini-2-0-flash') {
|
|
123
|
+
requestBody.model = context.propsValue.model;
|
|
124
|
+
}
|
|
125
|
+
if (context.propsValue.formality && context.propsValue.formality !== 'default') {
|
|
126
|
+
requestBody.formality = context.propsValue.formality;
|
|
127
|
+
}
|
|
128
|
+
if (context.propsValue.source_lang && context.propsValue.source_lang !== 'en') {
|
|
129
|
+
requestBody.source_lang = context.propsValue.source_lang;
|
|
130
|
+
}
|
|
131
|
+
if (context.propsValue.target_lang && context.propsValue.target_lang !== 'en') {
|
|
132
|
+
requestBody.target_lang = context.propsValue.target_lang;
|
|
133
|
+
}
|
|
134
|
+
if (context.propsValue.max_tokens && context.propsValue.max_tokens !== 2048) {
|
|
135
|
+
requestBody.max_tokens = context.propsValue.max_tokens;
|
|
136
|
+
}
|
|
137
|
+
if (context.propsValue.temperature !== undefined) {
|
|
138
|
+
requestBody.temperature = context.propsValue.temperature;
|
|
139
|
+
}
|
|
140
|
+
if (context.propsValue.n && context.propsValue.n !== 1) {
|
|
141
|
+
requestBody.n = context.propsValue.n;
|
|
142
|
+
}
|
|
143
|
+
const response = yield client_1.textcortexCommon.apiCall({
|
|
144
|
+
auth: context.auth,
|
|
145
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
146
|
+
resourceUri: common_1.API_ENDPOINTS.PARAPHRASES,
|
|
147
|
+
body: requestBody,
|
|
148
|
+
});
|
|
149
|
+
const outputs = ((_a = response.body.data) === null || _a === void 0 ? void 0 : _a.outputs) || [];
|
|
150
|
+
const paraphrasedText = outputs.length > 0 ? outputs[0].text : response.body.text || response.body;
|
|
151
|
+
return {
|
|
152
|
+
success: true,
|
|
153
|
+
original_text: context.propsValue.text,
|
|
154
|
+
paraphrased_text: paraphrasedText,
|
|
155
|
+
outputs: outputs,
|
|
156
|
+
remaining_credits: (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.remaining_credits,
|
|
157
|
+
metadata: {
|
|
158
|
+
mode: context.propsValue.mode || 'default',
|
|
159
|
+
model: context.propsValue.model || 'gemini-2-0-flash',
|
|
160
|
+
formality: context.propsValue.formality || 'default',
|
|
161
|
+
file_id: context.propsValue.file_id,
|
|
162
|
+
parameters: {
|
|
163
|
+
max_tokens: context.propsValue.max_tokens || 2048,
|
|
164
|
+
temperature: context.propsValue.temperature,
|
|
165
|
+
n: context.propsValue.n || 1,
|
|
166
|
+
source_lang: context.propsValue.source_lang || 'en',
|
|
167
|
+
target_lang: context.propsValue.target_lang || 'en',
|
|
168
|
+
},
|
|
169
|
+
timestamp: new Date().toISOString(),
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
175
|
+
throw new Error('Invalid API key. Please check your TextCortex API key.');
|
|
176
|
+
}
|
|
177
|
+
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
|
|
178
|
+
throw new Error('Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.');
|
|
179
|
+
}
|
|
180
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
|
|
181
|
+
throw new Error('Invalid request. Please check your input parameters.');
|
|
182
|
+
}
|
|
183
|
+
if (((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('network')) || ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('timeout'))) {
|
|
184
|
+
throw new Error('Network error. Please check your connection and try again.');
|
|
185
|
+
}
|
|
186
|
+
throw new Error(`Paraphrase failed: ${error.message || 'Unknown error'}`);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=create-paraphrase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-paraphrase.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/actions/create-paraphrase.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,yCAAgD;AAChD,6CAAoD;AACpD,6CAAyF;AAE5E,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,4CAA4C;IACzD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,wBAAwB;YACrC,QAAQ,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CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACnC,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;gBACrG,CAAC;gBACD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;oBACnC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;gBAC1E,CAAC;gBACD,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,QAAQ,CAAC,SAAS,CAAC,MAAI,MAAA,KAAK,CAAC,OAAO,0CAAE,QAAQ,CAAC,SAAS,CAAC,CAAA,EAAE,CAAC;oBAC7E,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;gBAChF,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const createProductDescription: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
name: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
description: import("@taskmagic/pieces-framework").LongTextProperty<false>;
|
|
4
|
+
brand: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
category: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
keywords: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
model: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
8
|
+
formality: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
source_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
10
|
+
target_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
11
|
+
max_tokens: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
12
|
+
temperature: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
13
|
+
n: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProductDescription = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const common_1 = require("../common/common");
|
|
10
|
+
exports.createProductDescription = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.textcortexAuth,
|
|
12
|
+
name: 'create_product_description',
|
|
13
|
+
displayName: 'Create Product Description',
|
|
14
|
+
description: 'Create a product description using details like name, brand, category, features, keywords.',
|
|
15
|
+
props: {
|
|
16
|
+
name: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Product Name',
|
|
18
|
+
description: 'Name of the product',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
21
|
+
description: pieces_framework_1.Property.LongText({
|
|
22
|
+
displayName: 'Product Features',
|
|
23
|
+
description: 'Features of the product',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
brand: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Brand',
|
|
28
|
+
description: 'Brand of the product',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
category: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Category',
|
|
33
|
+
description: 'Category of the product',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
keywords: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Keywords',
|
|
38
|
+
description: 'Keywords to include in the product description (comma-separated)',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
42
|
+
displayName: 'Model',
|
|
43
|
+
description: 'The language model to use',
|
|
44
|
+
required: false,
|
|
45
|
+
defaultValue: 'gemini-2-0-flash',
|
|
46
|
+
options: {
|
|
47
|
+
options: common_1.AI_MODELS,
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
formality: pieces_framework_1.Property.StaticDropdown({
|
|
51
|
+
displayName: 'Formality',
|
|
52
|
+
description: 'The formality of the generated text',
|
|
53
|
+
required: false,
|
|
54
|
+
defaultValue: 'default',
|
|
55
|
+
options: {
|
|
56
|
+
options: common_1.FORMALITY_LEVELS,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
source_lang: pieces_framework_1.Property.StaticDropdown({
|
|
60
|
+
displayName: 'Source Language',
|
|
61
|
+
description: 'The language of the source text',
|
|
62
|
+
required: false,
|
|
63
|
+
defaultValue: 'en',
|
|
64
|
+
options: {
|
|
65
|
+
options: [
|
|
66
|
+
{ label: 'English (Default)', value: 'en' },
|
|
67
|
+
{ label: 'Auto-detect', value: 'auto' },
|
|
68
|
+
...common_1.LANGUAGES.filter(lang => lang.value !== 'en'),
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
target_lang: pieces_framework_1.Property.StaticDropdown({
|
|
73
|
+
displayName: 'Target Language',
|
|
74
|
+
description: 'The language for the product description',
|
|
75
|
+
required: false,
|
|
76
|
+
defaultValue: 'en',
|
|
77
|
+
options: {
|
|
78
|
+
options: [
|
|
79
|
+
{ label: 'English (American)', value: 'en' },
|
|
80
|
+
{ label: 'English (British)', value: 'en-gb' },
|
|
81
|
+
{ label: 'Spanish', value: 'es' },
|
|
82
|
+
{ label: 'French', value: 'fr' },
|
|
83
|
+
{ label: 'German', value: 'de' },
|
|
84
|
+
{ label: 'Portuguese (Brazilian)', value: 'pt-br' },
|
|
85
|
+
{ label: 'Portuguese', value: 'pt' },
|
|
86
|
+
...common_1.LANGUAGES.filter(lang => !['en', 'pt', 'es', 'fr', 'de'].includes(lang.value)),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
}),
|
|
90
|
+
max_tokens: pieces_framework_1.Property.Number({
|
|
91
|
+
displayName: 'Max Tokens',
|
|
92
|
+
description: 'Maximum length of product description (1-4096 tokens)',
|
|
93
|
+
required: false,
|
|
94
|
+
defaultValue: 2048,
|
|
95
|
+
}),
|
|
96
|
+
temperature: pieces_framework_1.Property.Number({
|
|
97
|
+
displayName: 'Temperature',
|
|
98
|
+
description: 'Controls creativity (0.0-2.0). Higher values = more creative, lower = more focused.',
|
|
99
|
+
required: false,
|
|
100
|
+
}),
|
|
101
|
+
n: pieces_framework_1.Property.Number({
|
|
102
|
+
displayName: 'Number of Outputs',
|
|
103
|
+
description: 'How many descriptions to generate (1-5)',
|
|
104
|
+
required: false,
|
|
105
|
+
defaultValue: 1,
|
|
106
|
+
}),
|
|
107
|
+
},
|
|
108
|
+
run(context) {
|
|
109
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
111
|
+
try {
|
|
112
|
+
const requestBody = {};
|
|
113
|
+
if (context.propsValue.name) {
|
|
114
|
+
requestBody.name = context.propsValue.name;
|
|
115
|
+
}
|
|
116
|
+
if (context.propsValue.description) {
|
|
117
|
+
requestBody.description = context.propsValue.description;
|
|
118
|
+
}
|
|
119
|
+
if (context.propsValue.brand) {
|
|
120
|
+
requestBody.brand = context.propsValue.brand;
|
|
121
|
+
}
|
|
122
|
+
if (context.propsValue.category) {
|
|
123
|
+
requestBody.category = context.propsValue.category;
|
|
124
|
+
}
|
|
125
|
+
if (context.propsValue.keywords) {
|
|
126
|
+
requestBody.keywords = context.propsValue.keywords.split(',').map(k => k.trim());
|
|
127
|
+
}
|
|
128
|
+
if (context.propsValue.model && context.propsValue.model !== 'gemini-2-0-flash') {
|
|
129
|
+
requestBody.model = context.propsValue.model;
|
|
130
|
+
}
|
|
131
|
+
if (context.propsValue.formality && context.propsValue.formality !== 'default') {
|
|
132
|
+
requestBody.formality = context.propsValue.formality;
|
|
133
|
+
}
|
|
134
|
+
if (context.propsValue.source_lang && context.propsValue.source_lang !== 'en') {
|
|
135
|
+
requestBody.source_lang = context.propsValue.source_lang;
|
|
136
|
+
}
|
|
137
|
+
if (context.propsValue.target_lang && context.propsValue.target_lang !== 'en') {
|
|
138
|
+
requestBody.target_lang = context.propsValue.target_lang;
|
|
139
|
+
}
|
|
140
|
+
if (context.propsValue.max_tokens && context.propsValue.max_tokens !== 2048) {
|
|
141
|
+
requestBody.max_tokens = context.propsValue.max_tokens;
|
|
142
|
+
}
|
|
143
|
+
if (context.propsValue.temperature !== undefined) {
|
|
144
|
+
requestBody.temperature = context.propsValue.temperature;
|
|
145
|
+
}
|
|
146
|
+
if (context.propsValue.n && context.propsValue.n !== 1) {
|
|
147
|
+
requestBody.n = context.propsValue.n;
|
|
148
|
+
}
|
|
149
|
+
const response = yield client_1.textcortexCommon.apiCall({
|
|
150
|
+
auth: context.auth,
|
|
151
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
152
|
+
resourceUri: common_1.API_ENDPOINTS.PRODUCT_DESCRIPTIONS,
|
|
153
|
+
body: requestBody,
|
|
154
|
+
});
|
|
155
|
+
const outputs = ((_a = response.body.data) === null || _a === void 0 ? void 0 : _a.outputs) || [];
|
|
156
|
+
const generatedDescription = outputs.length > 0 ? outputs[0].text : response.body.text || response.body;
|
|
157
|
+
return {
|
|
158
|
+
success: true,
|
|
159
|
+
product_description: generatedDescription,
|
|
160
|
+
outputs: outputs,
|
|
161
|
+
remaining_credits: (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.remaining_credits,
|
|
162
|
+
metadata: {
|
|
163
|
+
product_name: context.propsValue.name,
|
|
164
|
+
brand: context.propsValue.brand,
|
|
165
|
+
category: context.propsValue.category,
|
|
166
|
+
keywords: context.propsValue.keywords,
|
|
167
|
+
model: context.propsValue.model || 'gemini-2-0-flash',
|
|
168
|
+
formality: context.propsValue.formality || 'default',
|
|
169
|
+
parameters: {
|
|
170
|
+
max_tokens: context.propsValue.max_tokens || 2048,
|
|
171
|
+
temperature: context.propsValue.temperature,
|
|
172
|
+
n: context.propsValue.n || 1,
|
|
173
|
+
source_lang: context.propsValue.source_lang || 'en',
|
|
174
|
+
target_lang: context.propsValue.target_lang || 'en',
|
|
175
|
+
},
|
|
176
|
+
timestamp: new Date().toISOString(),
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
182
|
+
throw new Error('Invalid API key. Please check your TextCortex API key.');
|
|
183
|
+
}
|
|
184
|
+
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
|
|
185
|
+
throw new Error('Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.');
|
|
186
|
+
}
|
|
187
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
|
|
188
|
+
throw new Error('Invalid request. Please check your input parameters.');
|
|
189
|
+
}
|
|
190
|
+
if (((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('network')) || ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('timeout'))) {
|
|
191
|
+
throw new Error('Network error. Please check your connection and try again.');
|
|
192
|
+
}
|
|
193
|
+
throw new Error(`Product description generation failed: ${error.message || 'Unknown error'}`);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
//# sourceMappingURL=create-product-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-product-description.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/actions/create-product-description.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const createSocialMediaCaption: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
context: import("@taskmagic/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
mode: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
keywords: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
model: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
formality: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
source_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
8
|
+
target_lang: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
max_tokens: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
10
|
+
temperature: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
11
|
+
n: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSocialMediaCaption = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const common_1 = require("../common/common");
|
|
10
|
+
exports.createSocialMediaCaption = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.textcortexAuth,
|
|
12
|
+
name: 'create_social_media_caption',
|
|
13
|
+
displayName: 'Create Social Media Caption',
|
|
14
|
+
description: 'Generate a caption tailored for a specific social media channel (requires channel and keywords).',
|
|
15
|
+
props: {
|
|
16
|
+
context: pieces_framework_1.Property.LongText({
|
|
17
|
+
displayName: 'Post Context',
|
|
18
|
+
description: 'Describe what you want to post about (e.g., "Announcing our new product launch with 50% discount")',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
mode: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Platform',
|
|
23
|
+
description: 'The platform to generate a post for',
|
|
24
|
+
required: true,
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'Twitter', value: 'twitter' },
|
|
28
|
+
{ label: 'LinkedIn', value: 'linkedin' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
keywords: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Keywords',
|
|
34
|
+
description: 'Keywords to be included in the post (comma-separated)',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
model: pieces_framework_1.Property.StaticDropdown({
|
|
38
|
+
displayName: 'Model',
|
|
39
|
+
description: 'The language model to use',
|
|
40
|
+
required: false,
|
|
41
|
+
defaultValue: 'gemini-2-0-flash',
|
|
42
|
+
options: {
|
|
43
|
+
options: common_1.AI_MODELS,
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
formality: pieces_framework_1.Property.StaticDropdown({
|
|
47
|
+
displayName: 'Formality',
|
|
48
|
+
description: 'The formality of the generated text',
|
|
49
|
+
required: false,
|
|
50
|
+
defaultValue: 'default',
|
|
51
|
+
options: {
|
|
52
|
+
options: common_1.FORMALITY_LEVELS,
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
source_lang: pieces_framework_1.Property.StaticDropdown({
|
|
56
|
+
displayName: 'Source Language',
|
|
57
|
+
description: 'The language of the source text',
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 'en',
|
|
60
|
+
options: {
|
|
61
|
+
options: [
|
|
62
|
+
{ label: 'English (Default)', value: 'en' },
|
|
63
|
+
{ label: 'Auto-detect', value: 'auto' },
|
|
64
|
+
...common_1.LANGUAGES.filter(lang => lang.value !== 'en'),
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
target_lang: pieces_framework_1.Property.StaticDropdown({
|
|
69
|
+
displayName: 'Target Language',
|
|
70
|
+
description: 'The language for the caption',
|
|
71
|
+
required: false,
|
|
72
|
+
defaultValue: 'en',
|
|
73
|
+
options: {
|
|
74
|
+
options: [
|
|
75
|
+
{ label: 'English (American)', value: 'en' },
|
|
76
|
+
{ label: 'English (British)', value: 'en-gb' },
|
|
77
|
+
{ label: 'Spanish', value: 'es' },
|
|
78
|
+
{ label: 'French', value: 'fr' },
|
|
79
|
+
{ label: 'German', value: 'de' },
|
|
80
|
+
{ label: 'Portuguese (Brazilian)', value: 'pt-br' },
|
|
81
|
+
{ label: 'Portuguese', value: 'pt' },
|
|
82
|
+
...common_1.LANGUAGES.filter(lang => !['en', 'pt', 'es', 'fr', 'de'].includes(lang.value)),
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
max_tokens: pieces_framework_1.Property.Number({
|
|
87
|
+
displayName: 'Max Tokens',
|
|
88
|
+
description: 'Maximum length of caption (1-4096 tokens)',
|
|
89
|
+
required: false,
|
|
90
|
+
defaultValue: 2048,
|
|
91
|
+
}),
|
|
92
|
+
temperature: pieces_framework_1.Property.Number({
|
|
93
|
+
displayName: 'Temperature',
|
|
94
|
+
description: 'Controls creativity (0.0-2.0). Higher values = more creative, lower = more focused.',
|
|
95
|
+
required: false,
|
|
96
|
+
}),
|
|
97
|
+
n: pieces_framework_1.Property.Number({
|
|
98
|
+
displayName: 'Number of Outputs',
|
|
99
|
+
description: 'How many captions to generate (1-5)',
|
|
100
|
+
required: false,
|
|
101
|
+
defaultValue: 1,
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
run(context) {
|
|
105
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
107
|
+
try {
|
|
108
|
+
const requestBody = {
|
|
109
|
+
context: context.propsValue.context,
|
|
110
|
+
mode: context.propsValue.mode,
|
|
111
|
+
};
|
|
112
|
+
if (context.propsValue.keywords) {
|
|
113
|
+
requestBody.keywords = context.propsValue.keywords.split(',').map(k => k.trim());
|
|
114
|
+
}
|
|
115
|
+
if (context.propsValue.model && context.propsValue.model !== 'gemini-2-0-flash') {
|
|
116
|
+
requestBody.model = context.propsValue.model;
|
|
117
|
+
}
|
|
118
|
+
if (context.propsValue.formality && context.propsValue.formality !== 'default') {
|
|
119
|
+
requestBody.formality = context.propsValue.formality;
|
|
120
|
+
}
|
|
121
|
+
if (context.propsValue.source_lang && context.propsValue.source_lang !== 'en') {
|
|
122
|
+
requestBody.source_lang = context.propsValue.source_lang;
|
|
123
|
+
}
|
|
124
|
+
if (context.propsValue.target_lang && context.propsValue.target_lang !== 'en') {
|
|
125
|
+
requestBody.target_lang = context.propsValue.target_lang;
|
|
126
|
+
}
|
|
127
|
+
if (context.propsValue.max_tokens && context.propsValue.max_tokens !== 2048) {
|
|
128
|
+
requestBody.max_tokens = context.propsValue.max_tokens;
|
|
129
|
+
}
|
|
130
|
+
if (context.propsValue.temperature !== undefined) {
|
|
131
|
+
requestBody.temperature = context.propsValue.temperature;
|
|
132
|
+
}
|
|
133
|
+
if (context.propsValue.n && context.propsValue.n !== 1) {
|
|
134
|
+
requestBody.n = context.propsValue.n;
|
|
135
|
+
}
|
|
136
|
+
const response = yield client_1.textcortexCommon.apiCall({
|
|
137
|
+
auth: context.auth,
|
|
138
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
139
|
+
resourceUri: common_1.API_ENDPOINTS.SOCIAL_MEDIA_POSTS,
|
|
140
|
+
body: requestBody,
|
|
141
|
+
});
|
|
142
|
+
const outputs = ((_a = response.body.data) === null || _a === void 0 ? void 0 : _a.outputs) || [];
|
|
143
|
+
const generatedCaption = outputs.length > 0 ? outputs[0].text : response.body.text || response.body;
|
|
144
|
+
return {
|
|
145
|
+
success: true,
|
|
146
|
+
caption: generatedCaption,
|
|
147
|
+
outputs: outputs,
|
|
148
|
+
remaining_credits: (_b = response.body.data) === null || _b === void 0 ? void 0 : _b.remaining_credits,
|
|
149
|
+
metadata: {
|
|
150
|
+
context: context.propsValue.context,
|
|
151
|
+
platform: context.propsValue.mode,
|
|
152
|
+
keywords: context.propsValue.keywords,
|
|
153
|
+
model: context.propsValue.model || 'gemini-2-0-flash',
|
|
154
|
+
formality: context.propsValue.formality || 'default',
|
|
155
|
+
parameters: {
|
|
156
|
+
max_tokens: context.propsValue.max_tokens || 2048,
|
|
157
|
+
temperature: context.propsValue.temperature,
|
|
158
|
+
n: context.propsValue.n || 1,
|
|
159
|
+
source_lang: context.propsValue.source_lang || 'en',
|
|
160
|
+
target_lang: context.propsValue.target_lang || 'en',
|
|
161
|
+
},
|
|
162
|
+
timestamp: new Date().toISOString(),
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
168
|
+
throw new Error('Invalid API key. Please check your TextCortex API key.');
|
|
169
|
+
}
|
|
170
|
+
if (((_d = error.response) === null || _d === void 0 ? void 0 : _d.status) === 429) {
|
|
171
|
+
throw new Error('Rate limit exceeded. Please wait and try again or upgrade your TextCortex plan.');
|
|
172
|
+
}
|
|
173
|
+
if (((_e = error.response) === null || _e === void 0 ? void 0 : _e.status) === 400) {
|
|
174
|
+
throw new Error('Invalid request. Please check your input parameters.');
|
|
175
|
+
}
|
|
176
|
+
if (((_f = error.message) === null || _f === void 0 ? void 0 : _f.includes('network')) || ((_g = error.message) === null || _g === void 0 ? void 0 : _g.includes('timeout'))) {
|
|
177
|
+
throw new Error('Network error. Please check your connection and try again.');
|
|
178
|
+
}
|
|
179
|
+
throw new Error(`Caption generation failed: ${error.message || 'Unknown error'}`);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
//# sourceMappingURL=create-social-caption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-social-caption.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/textcortex-ai/src/lib/actions/create-social-caption.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,yCAAgD;AAChD,6CAAoD;AACpD,6CAAyF;AAE5E,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,kGAAkG;IAC/G,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,oGAAoG;YACjH,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC5B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACtC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;iBACzC;aACF;SACF,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC7B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,kBAAkB;YAChC,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAS;aACnB;SACF,CAAC;QACF,SAAS,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