@razzium/piece-aimw-api 0.0.21 → 0.0.22
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/package.json +1 -1
- package/src/index.ts +21 -24
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
createCustomApiCallAction,
|
|
5
5
|
httpClient,
|
|
6
6
|
} from '@activepieces/pieces-common';
|
|
7
|
-
import { PieceAuth, createPiece } from '@activepieces/pieces-framework';
|
|
7
|
+
import { PieceAuth, createPiece, Property } from '@activepieces/pieces-framework';
|
|
8
8
|
import { PieceCategory } from '@activepieces/shared';
|
|
9
9
|
import { askAssistant } from './lib/actions/ask-assistant';
|
|
10
10
|
import { generateImage } from './lib/actions/generate-image';
|
|
@@ -43,31 +43,19 @@ It is strongly recommended that you add your credit card information to your Ope
|
|
|
43
43
|
`,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export const openaiAuth = PieceAuth.
|
|
46
|
+
export const openaiAuth = PieceAuth.CustomAuth({
|
|
47
47
|
description: AI_PROVIDERS_MAKRDOWN.aimw,
|
|
48
|
-
displayName: 'API Key',
|
|
49
48
|
required: true,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
return {
|
|
63
|
-
valid: true,
|
|
64
|
-
};
|
|
65
|
-
} catch (e) {
|
|
66
|
-
return {
|
|
67
|
-
valid: false,
|
|
68
|
-
error: 'Invalid API key',
|
|
69
|
-
};
|
|
70
|
-
}
|
|
49
|
+
props: {
|
|
50
|
+
baseApiUrl: Property.ShortText({
|
|
51
|
+
displayName: 'Base URL',
|
|
52
|
+
required: true,
|
|
53
|
+
defaultValue: 'https://cloud.activepieces.com/api/v1',
|
|
54
|
+
}),
|
|
55
|
+
apiKey: PieceAuth.SecretText({
|
|
56
|
+
displayName: 'API Key',
|
|
57
|
+
required: true,
|
|
58
|
+
}),
|
|
71
59
|
},
|
|
72
60
|
});
|
|
73
61
|
|
|
@@ -80,6 +68,15 @@ export const openai = createPiece({
|
|
|
80
68
|
auth: openaiAuth,
|
|
81
69
|
actions: [
|
|
82
70
|
askOpenAI,
|
|
71
|
+
createCustomApiCallAction({
|
|
72
|
+
baseUrl: (auth) => {
|
|
73
|
+
return `${(auth as { baseApiUrl: string }).baseApiUrl}`;
|
|
74
|
+
},
|
|
75
|
+
auth: openaiAuth,
|
|
76
|
+
authMapping: async (auth) => ({
|
|
77
|
+
Authorization: `Bearer ${(auth as { apiKey: string }).apiKey}`,
|
|
78
|
+
}),
|
|
79
|
+
}),
|
|
83
80
|
// askAssistant,
|
|
84
81
|
// generateImage,
|
|
85
82
|
// visionPrompt,
|