@venturialstd/workflow 0.1.162 → 0.1.163
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 +238 -238
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/chatbot/actions/ask-question.action.d.ts +3 -0
- package/dist/modules/chatbot/actions/ask-question.action.d.ts.map +1 -0
- package/dist/modules/chatbot/actions/ask-question.action.js +42 -0
- package/dist/modules/chatbot/actions/ask-question.action.js.map +1 -0
- package/dist/modules/chatbot/actions/index.d.ts +4 -0
- package/dist/modules/chatbot/actions/index.d.ts.map +1 -0
- package/dist/modules/chatbot/actions/index.js +20 -0
- package/dist/modules/chatbot/actions/index.js.map +1 -0
- package/dist/modules/chatbot/actions/send-buttons.action.d.ts +3 -0
- package/dist/modules/chatbot/actions/send-buttons.action.d.ts.map +1 -0
- package/dist/modules/chatbot/actions/send-buttons.action.js +67 -0
- package/dist/modules/chatbot/actions/send-buttons.action.js.map +1 -0
- package/dist/modules/chatbot/actions/send-message.action.d.ts +3 -0
- package/dist/modules/chatbot/actions/send-message.action.d.ts.map +1 -0
- package/dist/modules/chatbot/actions/send-message.action.js +52 -0
- package/dist/modules/chatbot/actions/send-message.action.js.map +1 -0
- package/dist/modules/chatbot/chatbot-nest.module.d.ts +3 -0
- package/dist/modules/chatbot/chatbot-nest.module.d.ts.map +1 -0
- package/dist/modules/chatbot/chatbot-nest.module.js +21 -0
- package/dist/modules/chatbot/chatbot-nest.module.js.map +1 -0
- package/dist/modules/chatbot/chatbot.module.d.ts +3 -0
- package/dist/modules/chatbot/chatbot.module.d.ts.map +1 -0
- package/dist/modules/chatbot/chatbot.module.js +17 -0
- package/dist/modules/chatbot/chatbot.module.js.map +1 -0
- package/dist/modules/chatbot/credentials.d.ts +3 -0
- package/dist/modules/chatbot/credentials.d.ts.map +1 -0
- package/dist/modules/chatbot/credentials.js +5 -0
- package/dist/modules/chatbot/credentials.js.map +1 -0
- package/dist/modules/chatbot/services/ask-question.service.d.ts +5 -0
- package/dist/modules/chatbot/services/ask-question.service.d.ts.map +1 -0
- package/dist/modules/chatbot/services/ask-question.service.js +25 -0
- package/dist/modules/chatbot/services/ask-question.service.js.map +1 -0
- package/dist/modules/chatbot/services/index.d.ts +5 -0
- package/dist/modules/chatbot/services/index.d.ts.map +1 -0
- package/dist/modules/chatbot/services/index.js +21 -0
- package/dist/modules/chatbot/services/index.js.map +1 -0
- package/dist/modules/chatbot/services/send-buttons.service.d.ts +5 -0
- package/dist/modules/chatbot/services/send-buttons.service.d.ts.map +1 -0
- package/dist/modules/chatbot/services/send-buttons.service.js +25 -0
- package/dist/modules/chatbot/services/send-buttons.service.js.map +1 -0
- package/dist/modules/chatbot/services/send-message.service.d.ts +5 -0
- package/dist/modules/chatbot/services/send-message.service.d.ts.map +1 -0
- package/dist/modules/chatbot/services/send-message.service.js +27 -0
- package/dist/modules/chatbot/services/send-message.service.js.map +1 -0
- package/dist/modules/chatbot/services/user-responded.service.d.ts +5 -0
- package/dist/modules/chatbot/services/user-responded.service.d.ts.map +1 -0
- package/dist/modules/chatbot/services/user-responded.service.js +25 -0
- package/dist/modules/chatbot/services/user-responded.service.js.map +1 -0
- package/dist/modules/chatbot/triggers/index.d.ts +2 -0
- package/dist/modules/chatbot/triggers/index.d.ts.map +1 -0
- package/dist/modules/chatbot/triggers/index.js +18 -0
- package/dist/modules/chatbot/triggers/index.js.map +1 -0
- package/dist/modules/chatbot/triggers/user-responded.trigger.d.ts +3 -0
- package/dist/modules/chatbot/triggers/user-responded.trigger.d.ts.map +1 -0
- package/dist/modules/chatbot/triggers/user-responded.trigger.js +45 -0
- package/dist/modules/chatbot/triggers/user-responded.trigger.js.map +1 -0
- package/dist/modules/chatgpt/actions/chat-completion.action.d.ts.map +1 -1
- package/dist/modules/chatgpt/actions/chat-completion.action.js +27 -109
- package/dist/modules/chatgpt/actions/chat-completion.action.js.map +1 -1
- package/dist/modules/chatgpt/actions/chat-purpose.action.d.ts +3 -0
- package/dist/modules/chatgpt/actions/chat-purpose.action.d.ts.map +1 -0
- package/dist/modules/chatgpt/actions/chat-purpose.action.js +229 -0
- package/dist/modules/chatgpt/actions/chat-purpose.action.js.map +1 -0
- package/dist/modules/chatgpt/actions/create-embedding.action.d.ts.map +1 -1
- package/dist/modules/chatgpt/actions/create-embedding.action.js +10 -16
- package/dist/modules/chatgpt/actions/create-embedding.action.js.map +1 -1
- package/dist/modules/chatgpt/actions/generate-image.action.d.ts.map +1 -1
- package/dist/modules/chatgpt/actions/generate-image.action.js +19 -35
- package/dist/modules/chatgpt/actions/generate-image.action.js.map +1 -1
- package/dist/modules/chatgpt/actions/index.d.ts +1 -0
- package/dist/modules/chatgpt/actions/index.d.ts.map +1 -1
- package/dist/modules/chatgpt/actions/index.js +1 -0
- package/dist/modules/chatgpt/actions/index.js.map +1 -1
- package/dist/modules/chatgpt/actions/speech-to-text.action.d.ts.map +1 -1
- package/dist/modules/chatgpt/actions/speech-to-text.action.js +18 -31
- package/dist/modules/chatgpt/actions/speech-to-text.action.js.map +1 -1
- package/dist/modules/chatgpt/actions/text-to-speech.action.d.ts.map +1 -1
- package/dist/modules/chatgpt/actions/text-to-speech.action.js +15 -32
- package/dist/modules/chatgpt/actions/text-to-speech.action.js.map +1 -1
- package/dist/modules/chatgpt/auth/chatgpt-auth.service.d.ts +3 -0
- package/dist/modules/chatgpt/auth/chatgpt-auth.service.d.ts.map +1 -1
- package/dist/modules/chatgpt/auth/chatgpt-auth.service.js +33 -36
- package/dist/modules/chatgpt/auth/chatgpt-auth.service.js.map +1 -1
- package/dist/modules/chatgpt/auth/index.d.ts +2 -0
- package/dist/modules/chatgpt/auth/index.d.ts.map +1 -0
- package/dist/modules/chatgpt/auth/index.js +6 -0
- package/dist/modules/chatgpt/auth/index.js.map +1 -0
- package/dist/modules/chatgpt/chatgpt-nest.module.d.ts.map +1 -1
- package/dist/modules/chatgpt/chatgpt-nest.module.js +9 -6
- package/dist/modules/chatgpt/chatgpt-nest.module.js.map +1 -1
- package/dist/modules/chatgpt/chatgpt.module.d.ts.map +1 -1
- package/dist/modules/chatgpt/chatgpt.module.js +3 -2
- package/dist/modules/chatgpt/chatgpt.module.js.map +1 -1
- package/dist/modules/chatgpt/services/chat-completion.service.d.ts +2 -4
- package/dist/modules/chatgpt/services/chat-completion.service.d.ts.map +1 -1
- package/dist/modules/chatgpt/services/chat-completion.service.js +21 -100
- package/dist/modules/chatgpt/services/chat-completion.service.js.map +1 -1
- package/dist/modules/chatgpt/services/chat-purpose.service.d.ts +24 -0
- package/dist/modules/chatgpt/services/chat-purpose.service.d.ts.map +1 -0
- package/dist/modules/chatgpt/services/chat-purpose.service.js +396 -0
- package/dist/modules/chatgpt/services/chat-purpose.service.js.map +1 -0
- package/dist/modules/chatgpt/services/index.d.ts +1 -0
- package/dist/modules/chatgpt/services/index.d.ts.map +1 -1
- package/dist/modules/chatgpt/services/index.js +1 -0
- package/dist/modules/chatgpt/services/index.js.map +1 -1
- package/dist/modules/chatgpt/types/purpose-memory.types.d.ts +38 -0
- package/dist/modules/chatgpt/types/purpose-memory.types.d.ts.map +1 -0
- package/dist/modules/chatgpt/types/purpose-memory.types.js +28 -0
- package/dist/modules/chatgpt/types/purpose-memory.types.js.map +1 -0
- package/dist/modules/chatgpt/utils/purpose-cache-key.util.d.ts +5 -0
- package/dist/modules/chatgpt/utils/purpose-cache-key.util.d.ts.map +1 -0
- package/dist/modules/chatgpt/utils/purpose-cache-key.util.js +15 -0
- package/dist/modules/chatgpt/utils/purpose-cache-key.util.js.map +1 -0
- package/dist/modules/chatgpt/utils/purpose-schema.validator.d.ts +2 -0
- package/dist/modules/chatgpt/utils/purpose-schema.validator.d.ts.map +1 -0
- package/dist/modules/chatgpt/utils/purpose-schema.validator.js +34 -0
- package/dist/modules/chatgpt/utils/purpose-schema.validator.js.map +1 -0
- package/dist/modules/chatgpt/utils/token-estimate.util.d.ts +7 -0
- package/dist/modules/chatgpt/utils/token-estimate.util.d.ts.map +1 -0
- package/dist/modules/chatgpt/utils/token-estimate.util.js +20 -0
- package/dist/modules/chatgpt/utils/token-estimate.util.js.map +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +5 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/workflow.module.d.ts.map +1 -1
- package/dist/workflow.module.js +3 -0
- package/dist/workflow.module.js.map +1 -1
- package/package.json +119 -118
- package/dist/modules/chatgpt/constants/chatgpt-completion.constants.d.ts +0 -4
- package/dist/modules/chatgpt/constants/chatgpt-completion.constants.d.ts.map +0 -1
- package/dist/modules/chatgpt/constants/chatgpt-completion.constants.js +0 -32
- package/dist/modules/chatgpt/constants/chatgpt-completion.constants.js.map +0 -1
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./chat-completion.action"), exports);
|
|
18
|
+
__exportStar(require("./chat-purpose.action"), exports);
|
|
18
19
|
__exportStar(require("./create-embedding.action"), exports);
|
|
19
20
|
__exportStar(require("./generate-image.action"), exports);
|
|
20
21
|
__exportStar(require("./speech-to-text.action"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,4DAA0C;AAC1C,0DAAwC;AACxC,0DAAwC;AACxC,0DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,wDAAsC;AACtC,4DAA0C;AAC1C,0DAAwC;AACxC,0DAAwC;AACxC,0DAAwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-to-text.action.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/speech-to-text.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"speech-to-text.action.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/speech-to-text.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,kBAAkB,EAAE,qBA+DhC,CAAC"}
|
|
@@ -14,61 +14,48 @@ exports.speechToTextAction = {
|
|
|
14
14
|
{
|
|
15
15
|
id: 'audioBase64',
|
|
16
16
|
name: 'Audio (Base64)',
|
|
17
|
-
description: '
|
|
17
|
+
description: 'Audio file content encoded in Base64 (e.g. from a previous step or file upload)',
|
|
18
18
|
type: types_1.FIELD_TYPE.STRING,
|
|
19
|
-
validation: {
|
|
20
|
-
|
|
21
|
-
minLength: 1,
|
|
22
|
-
},
|
|
23
|
-
placeholder: 'Base64 encoded audio data',
|
|
19
|
+
validation: { required: true, minLength: 1 },
|
|
20
|
+
placeholder: 'Paste Base64 string or use {{previousStep.audioBase64}}',
|
|
24
21
|
},
|
|
25
22
|
{
|
|
26
23
|
id: 'language',
|
|
27
24
|
name: 'Language',
|
|
28
|
-
description: 'Language
|
|
25
|
+
description: 'Optional. Language of the speech (e.g. en, es, fr). Leave empty to auto-detect.',
|
|
29
26
|
type: types_1.FIELD_TYPE.STRING,
|
|
30
|
-
validation: {
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
placeholder: 'en, es, fr, etc.',
|
|
27
|
+
validation: { required: false },
|
|
28
|
+
placeholder: 'e.g. en, es, fr',
|
|
34
29
|
},
|
|
35
30
|
{
|
|
36
31
|
id: 'prompt',
|
|
37
|
-
name: '
|
|
38
|
-
description: 'Optional text to
|
|
32
|
+
name: 'Context / hint',
|
|
33
|
+
description: 'Optional. Short text to help with spelling or context (e.g. product names).',
|
|
39
34
|
type: types_1.FIELD_TYPE.STRING,
|
|
40
|
-
validation: {
|
|
41
|
-
|
|
42
|
-
},
|
|
35
|
+
validation: { required: false },
|
|
36
|
+
placeholder: 'e.g. Technical terms or names to recognize',
|
|
43
37
|
},
|
|
44
38
|
{
|
|
45
39
|
id: 'responseFormat',
|
|
46
|
-
name: '
|
|
47
|
-
description: '
|
|
40
|
+
name: 'Output format',
|
|
41
|
+
description: 'How you want the transcription returned',
|
|
48
42
|
type: types_1.FIELD_TYPE.STRING,
|
|
49
|
-
validation: {
|
|
50
|
-
required: false,
|
|
51
|
-
enum: ['json', 'text', 'srt', 'verbose_json', 'vtt'],
|
|
52
|
-
},
|
|
43
|
+
validation: { required: false, enum: ['json', 'text', 'srt', 'verbose_json', 'vtt'] },
|
|
53
44
|
defaultValue: 'json',
|
|
54
45
|
options: [
|
|
55
46
|
{ label: 'JSON', value: 'json' },
|
|
56
|
-
{ label: '
|
|
57
|
-
{ label: 'SRT', value: 'srt' },
|
|
47
|
+
{ label: 'Plain text', value: 'text' },
|
|
48
|
+
{ label: 'SRT (subtitles)', value: 'srt' },
|
|
58
49
|
{ label: 'Verbose JSON', value: 'verbose_json' },
|
|
59
|
-
{ label: 'VTT', value: 'vtt' },
|
|
50
|
+
{ label: 'VTT (subtitles)', value: 'vtt' },
|
|
60
51
|
],
|
|
61
52
|
},
|
|
62
53
|
{
|
|
63
54
|
id: 'temperature',
|
|
64
55
|
name: 'Temperature',
|
|
65
|
-
description: '
|
|
56
|
+
description: 'Randomness of the transcription (0 = deterministic, 1 = more varied)',
|
|
66
57
|
type: types_1.FIELD_TYPE.NUMBER,
|
|
67
|
-
validation: {
|
|
68
|
-
required: false,
|
|
69
|
-
min: 0,
|
|
70
|
-
max: 1,
|
|
71
|
-
},
|
|
58
|
+
validation: { required: false, min: 0, max: 1 },
|
|
72
59
|
},
|
|
73
60
|
],
|
|
74
61
|
outputs: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-to-text.action.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/speech-to-text.action.ts"],"names":[],"mappings":";;;AAAA,uCAKqB;AACrB,+EAAyE;AAE5D,QAAA,kBAAkB,GAA0B;IACvD,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,wCAAwC;IACrD,QAAQ,EAAE,qBAAa,CAAC,MAAM;IAC9B,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,4CAAyE;IACvF,MAAM,EAAE;QACN;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"speech-to-text.action.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/speech-to-text.action.ts"],"names":[],"mappings":";;;AAAA,uCAKqB;AACrB,+EAAyE;AAE5D,QAAA,kBAAkB,GAA0B;IACvD,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,wCAAwC;IACrD,QAAQ,EAAE,qBAAa,CAAC,MAAM;IAC9B,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,4CAAyE;IACvF,MAAM,EAAE;QACN;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,kBAAU,CAAC,MAAM;YACvB,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE;YAC5C,WAAW,EAAE,yDAAyD;SACvE;QACD;YACE,EAAE,EAAE,UAAU;YACd,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,kBAAU,CAAC,MAAM;YACvB,UAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;YAC/B,WAAW,EAAE,iB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@
|
|
|
1
|
-
{"version":3,"file":"text-to-speech.action.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/text-to-speech.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"text-to-speech.action.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/text-to-speech.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,kBAAkB,EAAE,qBAuFhC,CAAC"}
|
|
@@ -13,40 +13,30 @@ exports.textToSpeechAction = {
|
|
|
13
13
|
inputs: [
|
|
14
14
|
{
|
|
15
15
|
id: 'text',
|
|
16
|
-
name: 'Text',
|
|
17
|
-
description: 'The text
|
|
16
|
+
name: 'Text to speak',
|
|
17
|
+
description: 'The text that will be converted to speech (max 4096 characters)',
|
|
18
18
|
type: types_1.FIELD_TYPE.STRING,
|
|
19
|
-
validation: {
|
|
20
|
-
|
|
21
|
-
minLength: 1,
|
|
22
|
-
maxLength: 4096,
|
|
23
|
-
},
|
|
24
|
-
placeholder: 'Hello, this is a test message',
|
|
19
|
+
validation: { required: true, minLength: 1, maxLength: 4096 },
|
|
20
|
+
placeholder: 'e.g. Hello! Your order has been confirmed.',
|
|
25
21
|
},
|
|
26
22
|
{
|
|
27
23
|
id: 'model',
|
|
28
24
|
name: 'Model',
|
|
29
|
-
description: 'TTS
|
|
25
|
+
description: 'TTS engine (HD has higher quality, slower)',
|
|
30
26
|
type: types_1.FIELD_TYPE.STRING,
|
|
31
|
-
validation: {
|
|
32
|
-
required: false,
|
|
33
|
-
enum: ['tts-1', 'tts-1-hd'],
|
|
34
|
-
},
|
|
27
|
+
validation: { required: false, enum: ['tts-1', 'tts-1-hd'] },
|
|
35
28
|
defaultValue: 'tts-1',
|
|
36
29
|
options: [
|
|
37
|
-
{ label: 'TTS-1', value: 'tts-1' },
|
|
38
|
-
{ label: 'TTS-1 HD', value: 'tts-1-hd' },
|
|
30
|
+
{ label: 'TTS-1 (faster)', value: 'tts-1' },
|
|
31
|
+
{ label: 'TTS-1 HD (higher quality)', value: 'tts-1-hd' },
|
|
39
32
|
],
|
|
40
33
|
},
|
|
41
34
|
{
|
|
42
35
|
id: 'voice',
|
|
43
36
|
name: 'Voice',
|
|
44
|
-
description: 'Voice
|
|
37
|
+
description: 'Voice style for the speech',
|
|
45
38
|
type: types_1.FIELD_TYPE.STRING,
|
|
46
|
-
validation: {
|
|
47
|
-
required: false,
|
|
48
|
-
enum: ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'],
|
|
49
|
-
},
|
|
39
|
+
validation: { required: false, enum: ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'] },
|
|
50
40
|
defaultValue: 'alloy',
|
|
51
41
|
options: [
|
|
52
42
|
{ label: 'Alloy', value: 'alloy' },
|
|
@@ -60,24 +50,17 @@ exports.textToSpeechAction = {
|
|
|
60
50
|
{
|
|
61
51
|
id: 'speed',
|
|
62
52
|
name: 'Speed',
|
|
63
|
-
description: '
|
|
53
|
+
description: 'Playback speed (1 = normal; 0.25–4.0)',
|
|
64
54
|
type: types_1.FIELD_TYPE.NUMBER,
|
|
65
|
-
validation: {
|
|
66
|
-
required: false,
|
|
67
|
-
min: 0.25,
|
|
68
|
-
max: 4.0,
|
|
69
|
-
},
|
|
55
|
+
validation: { required: false, min: 0.25, max: 4.0 },
|
|
70
56
|
defaultValue: 1.0,
|
|
71
57
|
},
|
|
72
58
|
{
|
|
73
59
|
id: 'responseFormat',
|
|
74
|
-
name: '
|
|
75
|
-
description: '
|
|
60
|
+
name: 'Audio format',
|
|
61
|
+
description: 'Output file format',
|
|
76
62
|
type: types_1.FIELD_TYPE.STRING,
|
|
77
|
-
validation: {
|
|
78
|
-
required: false,
|
|
79
|
-
enum: ['mp3', 'opus', 'aac', 'flac'],
|
|
80
|
-
},
|
|
63
|
+
validation: { required: false, enum: ['mp3', 'opus', 'aac', 'flac'] },
|
|
81
64
|
defaultValue: 'mp3',
|
|
82
65
|
options: [
|
|
83
66
|
{ label: 'MP3', value: 'mp3' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-to-speech.action.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/text-to-speech.action.ts"],"names":[],"mappings":";;;AAAA,uCAKqB;AACrB,+EAAyE;AAE5D,QAAA,kBAAkB,GAA0B;IACvD,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE,qBAAa,CAAC,MAAM;IAC9B,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,4CAAyE;IACvF,MAAM,EAAE;QACN;YACE,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"text-to-speech.action.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/actions/text-to-speech.action.ts"],"names":[],"mappings":";;;AAAA,uCAKqB;AACrB,+EAAyE;AAE5D,QAAA,kBAAkB,GAA0B;IACvD,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE,qBAAa,CAAC,MAAM;IAC9B,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,4CAAyE;IACvF,MAAM,EAAE;QACN;YACE,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,iEAAiE;YAC9E,IAAI,EAAE,kBAAU,CAAC,MAAM;YACvB,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE;YAC7D,WAAW,EAAE,4CAA4C;SAC1D;QACD;YACE,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4CAA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AG;SAClB;QACD;YACE,EAAE,EAAE,gBAAgB;YACpB,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,kBAAU,CAAC,MAAM;YACvB,UAAU,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE;YACrE,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;gBAChC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;aACjC;SACF;KACF;IACD,OAAO,EAAE;QACP;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,2BAA2B;YACxC,IAAI,EAAE,kBAAU,CAAC,MAAM;SACxB;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,mBAAmB;YAChC,IAAI,EAAE,kBAAU,CAAC,MAAM;SACxB;QACD;YACE,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,kBAAU,CAAC,MAAM;SACxB;KACF;CACF,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ChatGptClient } from '@venturialstd/chatgpt';
|
|
1
2
|
import { CredentialAuthResult, IWorkflowCredentialAuthService } from '../../types';
|
|
2
3
|
export declare class ChatGptAuthService implements IWorkflowCredentialAuthService {
|
|
4
|
+
private readonly chatGptClient;
|
|
5
|
+
constructor(chatGptClient: ChatGptClient);
|
|
3
6
|
authenticate(credentials: Record<string, unknown>): Promise<CredentialAuthResult>;
|
|
4
7
|
}
|
|
5
8
|
//# sourceMappingURL=chatgpt-auth.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt-auth.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/auth/chatgpt-auth.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatgpt-auth.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/auth/chatgpt-auth.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAEnF,qBACa,kBAAmB,YAAW,8BAA8B;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAEnD,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;CA6CxF"}
|
|
@@ -5,54 +5,50 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
var
|
|
9
|
-
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ChatGptAuthService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const
|
|
14
|
+
const chatgpt_1 = require("@venturialstd/chatgpt");
|
|
15
15
|
let ChatGptAuthService = class ChatGptAuthService {
|
|
16
|
+
chatGptClient;
|
|
17
|
+
constructor(chatGptClient) {
|
|
18
|
+
this.chatGptClient = chatGptClient;
|
|
19
|
+
}
|
|
16
20
|
async authenticate(credentials) {
|
|
21
|
+
const apiKey = credentials.apiKey;
|
|
22
|
+
const baseUrl = credentials.baseUrl || 'https://api.openai.com/v1';
|
|
23
|
+
if (!apiKey || apiKey.trim().length === 0) {
|
|
24
|
+
return {
|
|
25
|
+
success: false,
|
|
26
|
+
message: 'OpenAI API key is required',
|
|
27
|
+
error: 'MISSING_API_KEY',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
17
30
|
try {
|
|
18
|
-
const
|
|
19
|
-
const baseUrl = credentials.baseUrl || 'https://api.openai.com/v1';
|
|
20
|
-
if (!apiKey || apiKey.trim().length === 0) {
|
|
21
|
-
return {
|
|
22
|
-
success: false,
|
|
23
|
-
message: 'API Key is required',
|
|
24
|
-
error: 'MISSING_API_KEY',
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const client = new openai_1.default({
|
|
31
|
+
const { client } = await this.chatGptClient.getClient({
|
|
28
32
|
apiKey,
|
|
29
|
-
|
|
33
|
+
baseUrl,
|
|
30
34
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
success: false,
|
|
44
|
-
message: 'Invalid API Key',
|
|
45
|
-
error: 'INVALID_API_KEY',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
35
|
+
await client.models.list();
|
|
36
|
+
return {
|
|
37
|
+
success: true,
|
|
38
|
+
message: 'OpenAI credentials validated successfully',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error &&
|
|
43
|
+
typeof error === 'object' &&
|
|
44
|
+
'status' in error &&
|
|
45
|
+
(error.status === 401 || error.status === 403)) {
|
|
48
46
|
return {
|
|
49
47
|
success: false,
|
|
50
|
-
message:
|
|
51
|
-
error: '
|
|
48
|
+
message: 'Invalid API key',
|
|
49
|
+
error: 'AUTH_FAILED',
|
|
52
50
|
};
|
|
53
51
|
}
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
52
|
return {
|
|
57
53
|
success: false,
|
|
58
54
|
message: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
@@ -63,6 +59,7 @@ let ChatGptAuthService = class ChatGptAuthService {
|
|
|
63
59
|
};
|
|
64
60
|
exports.ChatGptAuthService = ChatGptAuthService;
|
|
65
61
|
exports.ChatGptAuthService = ChatGptAuthService = __decorate([
|
|
66
|
-
(0, common_1.Injectable)()
|
|
62
|
+
(0, common_1.Injectable)(),
|
|
63
|
+
__metadata("design:paramtypes", [chatgpt_1.ChatGptClient])
|
|
67
64
|
], ChatGptAuthService);
|
|
68
65
|
//# sourceMappingURL=chatgpt-auth.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt-auth.service.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/auth/chatgpt-auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"chatgpt-auth.service.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/auth/chatgpt-auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,mDAAsD;AAK/C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACA;IAA7B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAE7D,KAAK,CAAC,YAAY,CAAC,WAAoC;QACrD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAgB,CAAC;QAC5C,MAAM,OAAO,GAAI,WAAW,CAAC,OAAkB,IAAI,2BAA2B,CAAC;QAE/E,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,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
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatGptAuthService = void 0;
|
|
4
|
+
var chatgpt_auth_service_1 = require("./chatgpt-auth.service");
|
|
5
|
+
Object.defineProperty(exports, "ChatGptAuthService", { enumerable: true, get: function () { return chatgpt_auth_service_1.ChatGptAuthService; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/chatgpt/auth/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt-nest.module.d.ts","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt-nest.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatgpt-nest.module.d.ts","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt-nest.module.ts"],"names":[],"mappings":"AAaA,qBAqBa,iBAAiB;CAAG"}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.ChatGptNestModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const chatgpt_1 = require("@venturialstd/chatgpt");
|
|
12
|
-
const
|
|
12
|
+
const auth_1 = require("./auth");
|
|
13
13
|
const services_1 = require("./services");
|
|
14
14
|
let ChatGptNestModule = class ChatGptNestModule {
|
|
15
15
|
};
|
|
@@ -18,19 +18,22 @@ exports.ChatGptNestModule = ChatGptNestModule = __decorate([
|
|
|
18
18
|
(0, common_1.Module)({
|
|
19
19
|
imports: [chatgpt_1.ChatGptModule],
|
|
20
20
|
providers: [
|
|
21
|
+
auth_1.ChatGptAuthService,
|
|
21
22
|
services_1.ChatCompletionService,
|
|
23
|
+
services_1.ChatGptPurposeService,
|
|
24
|
+
services_1.CreateEmbeddingService,
|
|
22
25
|
services_1.GenerateImageService,
|
|
23
|
-
services_1.TextToSpeechService,
|
|
24
26
|
services_1.SpeechToTextService,
|
|
25
|
-
services_1.
|
|
26
|
-
chatgpt_auth_service_1.ChatGptAuthService,
|
|
27
|
+
services_1.TextToSpeechService,
|
|
27
28
|
],
|
|
28
29
|
exports: [
|
|
30
|
+
auth_1.ChatGptAuthService,
|
|
29
31
|
services_1.ChatCompletionService,
|
|
32
|
+
services_1.ChatGptPurposeService,
|
|
33
|
+
services_1.CreateEmbeddingService,
|
|
30
34
|
services_1.GenerateImageService,
|
|
31
|
-
services_1.TextToSpeechService,
|
|
32
35
|
services_1.SpeechToTextService,
|
|
33
|
-
services_1.
|
|
36
|
+
services_1.TextToSpeechService,
|
|
34
37
|
],
|
|
35
38
|
})
|
|
36
39
|
], ChatGptNestModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt-nest.module.js","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt-nest.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAAsD;
|
|
1
|
+
{"version":3,"file":"chatgpt-nest.module.js","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt-nest.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAAsD;AAEtD,iCAA4C;AAC5C,yCAOoB;AAuBb,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IArB7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC;QACxB,SAAS,EAAE;YACT,yBAAkB;YAClB,gCAAqB;YACrB,gCAAqB;YACrB,iCAAsB;YACtB,+BAAoB;YACpB,8BAAmB;YACnB,8BAAmB;SACpB;QACD,OAAO,EAAE;YACP,yBAAkB;YAClB,gCAAqB;YACrB,gCAAqB;YACrB,iCAAsB;YACtB,+BAAoB;YACpB,8BAAmB;YACnB,8BAAmB;SACpB;KACF,CAAC;GACW,iBAAiB,CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt.module.d.ts","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,wBAAwB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"chatgpt.module.d.ts","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAYpF,eAAO,MAAM,aAAa,EAAE,wBAmB3B,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.chatgptModule = void 0;
|
|
4
4
|
const actions_1 = require("./actions");
|
|
5
|
-
const
|
|
5
|
+
const auth_1 = require("./auth");
|
|
6
6
|
const credentials_1 = require("./credentials");
|
|
7
7
|
exports.chatgptModule = {
|
|
8
8
|
key: 'chatgpt',
|
|
@@ -10,10 +10,11 @@ exports.chatgptModule = {
|
|
|
10
10
|
description: 'Interact with OpenAI ChatGPT, DALL-E, Whisper, and Embeddings',
|
|
11
11
|
icon: '🤖',
|
|
12
12
|
version: '1.0.0',
|
|
13
|
-
authServiceClass: chatgpt_auth_service_1.ChatGptAuthService,
|
|
14
13
|
credentialFields: credentials_1.chatgptCredentials,
|
|
14
|
+
authServiceClass: auth_1.ChatGptAuthService,
|
|
15
15
|
actions: [
|
|
16
16
|
actions_1.chatCompletionAction,
|
|
17
|
+
actions_1.chatPurposeAction,
|
|
17
18
|
actions_1.generateImageAction,
|
|
18
19
|
actions_1.textToSpeechAction,
|
|
19
20
|
actions_1.speechToTextAction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatgpt.module.js","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt.module.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"chatgpt.module.js","sourceRoot":"","sources":["../../../src/modules/chatgpt/chatgpt.module.ts"],"names":[],"mappings":";;;AACA,uCAOmB;AACnB,iCAA4C;AAC5C,+CAAmD;AAEtC,QAAA,aAAa,GAA6B;IACrD,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,+DAA+D;IAC5E,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,gBAAgB,EAAE,gCAAkB;IACpC,gBAAgB,EAAE,yBAEiB;IACnC,OAAO,EAAE;QACP,8BAAoB;QACpB,2BAAiB;QACjB,6BAAmB;QACnB,4BAAkB;QAClB,4BAAkB;QAClB,+BAAqB;KACtB;IACD,QAAQ,EAAE,EAAE;CACb,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ChatGptChatService } from '@venturialstd/chatgpt';
|
|
2
|
-
import { CacheService } from '@venturialstd/core';
|
|
3
2
|
import { IWorkflowActionService, WorkflowActionContext } from '../../types';
|
|
4
3
|
export declare class ChatCompletionService implements IWorkflowActionService {
|
|
5
4
|
private readonly chatGptChatService;
|
|
6
|
-
|
|
7
|
-
constructor(chatGptChatService: ChatGptChatService, cacheService: CacheService);
|
|
5
|
+
constructor(chatGptChatService: ChatGptChatService);
|
|
8
6
|
perform(inputs: Record<string, unknown>, context: WorkflowActionContext): Promise<Record<string, unknown>>;
|
|
9
|
-
private
|
|
7
|
+
private buildMessages;
|
|
10
8
|
private calculateCost;
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=chat-completion.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-completion.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/services/chat-completion.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-completion.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/chatgpt/services/chat-completion.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBACa,qBAAsB,YAAW,sBAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,kBAAkB;IAE7D,OAAO,CACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA4CnC,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,aAAa;CAWtB"}
|
|
@@ -12,13 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ChatCompletionService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const chatgpt_1 = require("@venturialstd/chatgpt");
|
|
15
|
-
const core_1 = require("@venturialstd/core");
|
|
16
15
|
let ChatCompletionService = class ChatCompletionService {
|
|
17
16
|
chatGptChatService;
|
|
18
|
-
|
|
19
|
-
constructor(chatGptChatService, cacheService) {
|
|
17
|
+
constructor(chatGptChatService) {
|
|
20
18
|
this.chatGptChatService = chatGptChatService;
|
|
21
|
-
this.cacheService = cacheService;
|
|
22
19
|
}
|
|
23
20
|
async perform(inputs, context) {
|
|
24
21
|
const apiKey = context.credentials?.apiKey;
|
|
@@ -26,113 +23,38 @@ let ChatCompletionService = class ChatCompletionService {
|
|
|
26
23
|
if (!apiKey) {
|
|
27
24
|
throw new Error('OpenAI API key is required in credentials');
|
|
28
25
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const enableMemoryPersistence = inputs.enableMemoryPersistence === true;
|
|
33
|
-
const memoryKey = inputs.memoryKey;
|
|
34
|
-
const phone = inputs.phone;
|
|
35
|
-
const memoryTimePersistence = inputs.memoryTimePersistence || 60;
|
|
36
|
-
const stopExecutionUntilPurposeFinish = inputs.stopExecutionUntilPurposeFinish === true;
|
|
37
|
-
const systemInstructions = inputs.systemInstructions;
|
|
38
|
-
let previousMemory = null;
|
|
39
|
-
let cacheKey = null;
|
|
40
|
-
let newMessagesInRedisFormat = [];
|
|
41
|
-
let messages = [];
|
|
42
|
-
if (enableMemoryPersistence && memoryKey) {
|
|
43
|
-
cacheKey = `workflow:${context.workflowId}:${phone || ''}:${memoryKey}`;
|
|
44
|
-
previousMemory = await this.cacheService.get(cacheKey);
|
|
45
|
-
if (previousMemory && previousMemory.length > 0) {
|
|
46
|
-
messages = previousMemory.map((resp) => ({
|
|
47
|
-
role: resp.role === 'system' ? 'system' : resp.role === 'user' ? 'user' : 'assistant',
|
|
48
|
-
content: resp.message,
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (inputs.messages) {
|
|
53
|
-
let currentMessages = [];
|
|
54
|
-
if (typeof inputs.messages === 'string') {
|
|
55
|
-
try {
|
|
56
|
-
const parsed = JSON.parse(inputs.messages);
|
|
57
|
-
currentMessages = parsed;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
throw new Error(`Invalid JSON format for messages: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else if (Array.isArray(inputs.messages)) {
|
|
64
|
-
currentMessages = inputs.messages;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
throw new Error('Messages must be a JSON array or JSON string');
|
|
68
|
-
}
|
|
69
|
-
messages = [...messages, ...currentMessages];
|
|
70
|
-
newMessagesInRedisFormat = currentMessages.map((msg) => ({
|
|
71
|
-
role: (msg.role === 'system' ? 'system' : msg.role === 'user' ? 'user' : 'admin'),
|
|
72
|
-
message: msg.content,
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
if (systemInstructions && systemInstructions.trim()) {
|
|
76
|
-
const hasSystemMessage = messages.some((msg) => msg.role === 'system');
|
|
77
|
-
if (hasSystemMessage) {
|
|
78
|
-
const firstSystemIndex = messages.findIndex((msg) => msg.role === 'system');
|
|
79
|
-
messages[firstSystemIndex] = {
|
|
80
|
-
role: 'system',
|
|
81
|
-
content: systemInstructions,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
messages = [
|
|
86
|
-
{ role: 'system', content: systemInstructions },
|
|
87
|
-
...messages,
|
|
88
|
-
];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (messages.length === 0) {
|
|
92
|
-
throw new Error('Messages are required. Provide messages in input or enable memory persistence with existing memory.');
|
|
26
|
+
const message = String(inputs.message ?? '').trim();
|
|
27
|
+
if (!message) {
|
|
28
|
+
throw new Error('Message is required');
|
|
93
29
|
}
|
|
30
|
+
const messages = this.buildMessages(message, inputs.systemInstructions ?? undefined);
|
|
31
|
+
const model = inputs.model || 'gpt-4o';
|
|
32
|
+
const temperature = inputs.temperature ?? 0.7;
|
|
33
|
+
const maxTokens = inputs.maxTokens ?? 2000;
|
|
94
34
|
const completion = await this.chatGptChatService.createChatCompletion({
|
|
95
35
|
model,
|
|
96
36
|
temperature,
|
|
97
37
|
maxTokens,
|
|
98
|
-
store:
|
|
38
|
+
store: true,
|
|
99
39
|
apiKey,
|
|
100
40
|
baseUrl,
|
|
101
41
|
}, messages);
|
|
102
42
|
const assistantMessage = completion.choices[0]?.message;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const updatedMemory = [
|
|
109
|
-
...(previousMemory || []),
|
|
110
|
-
...newMessagesInRedisFormat,
|
|
111
|
-
assistantResponse,
|
|
112
|
-
];
|
|
113
|
-
const ttlInSeconds = memoryTimePersistence * 60;
|
|
114
|
-
await this.cacheService.set(cacheKey, updatedMemory, undefined, ttlInSeconds);
|
|
115
|
-
}
|
|
116
|
-
const result = {
|
|
117
|
-
content: assistantMessage?.content || '',
|
|
118
|
-
role: assistantMessage?.role || 'assistant',
|
|
119
|
-
model: completion.model,
|
|
120
|
-
tokensUsed: completion.usage?.total_tokens || 0,
|
|
121
|
-
cost: this.calculateCost(completion.model, completion.usage?.total_tokens || 0),
|
|
122
|
-
messageId: completion.id,
|
|
43
|
+
const totalTokens = completion.usage?.total_tokens ?? 0;
|
|
44
|
+
return {
|
|
45
|
+
content: assistantMessage?.content ?? '',
|
|
46
|
+
tokensUsed: totalTokens,
|
|
47
|
+
cost: this.calculateCost(completion.model, totalTokens),
|
|
123
48
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
49
|
+
}
|
|
50
|
+
buildMessages(message, systemInstructions) {
|
|
51
|
+
const result = [];
|
|
52
|
+
if (systemInstructions?.trim()) {
|
|
53
|
+
result.push({ role: 'system', content: systemInstructions.trim() });
|
|
128
54
|
}
|
|
55
|
+
result.push({ role: 'user', content: message });
|
|
129
56
|
return result;
|
|
130
57
|
}
|
|
131
|
-
checkPurposeFinished(content) {
|
|
132
|
-
const completionIndicators = ['END', 'COMPLETE', 'FINISHED', 'DONE'];
|
|
133
|
-
const upperContent = content.toUpperCase();
|
|
134
|
-
return completionIndicators.some((indicator) => upperContent.includes(indicator));
|
|
135
|
-
}
|
|
136
58
|
calculateCost(model, tokens) {
|
|
137
59
|
const modelPricing = chatgpt_1.CHATGPT_MODEL_PRICING[model] || chatgpt_1.CHATGPT_MODEL_PRICING[chatgpt_1.CHATGPT_DEFAULT_MODELS.GPT_4O];
|
|
138
60
|
const estimatedInputTokens = tokens * 0.7;
|
|
@@ -145,7 +67,6 @@ let ChatCompletionService = class ChatCompletionService {
|
|
|
145
67
|
exports.ChatCompletionService = ChatCompletionService;
|
|
146
68
|
exports.ChatCompletionService = ChatCompletionService = __decorate([
|
|
147
69
|
(0, common_1.Injectable)(),
|
|
148
|
-
__metadata("design:paramtypes", [chatgpt_1.ChatGptChatService
|
|
149
|
-
core_1.CacheService])
|
|
70
|
+
__metadata("design:paramtypes", [chatgpt_1.ChatGptChatService])
|
|
150
71
|
], ChatCompletionService);
|
|
151
72
|
//# sourceMappingURL=chat-completion.service.js.map
|