mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(OpenAI Node): Add a node to work with OpenAI (#4932)
* feat(OpenAI Node): Add a node to work with OpenAI * Added codex file for OpenAi node * Minor tweaks to Operation Image. * Minor tweaks to Resource Text. * Minor copy modification to Image:Create. * Removed "a Text" in Text operations names. * ⚡ Connect Response Format parameter and other improvements * ✨ Add "filter" postReceiveAction * ⚡ Rename operations and add spelling mistake again to example * ⚡ Rename another operation Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com> Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
@@ -1296,6 +1296,7 @@ export type PostReceiveAction =
|
||||
response: IN8nHttpFullResponse,
|
||||
) => Promise<INodeExecutionData[]>)
|
||||
| IPostReceiveBinaryData
|
||||
| IPostReceiveFilter
|
||||
| IPostReceiveLimit
|
||||
| IPostReceiveRootProperty
|
||||
| IPostReceiveSet
|
||||
@@ -1325,7 +1326,7 @@ export interface IPostReceiveBase {
|
||||
type: string;
|
||||
enabled?: boolean | string;
|
||||
properties: {
|
||||
[key: string]: string | number | IDataObject;
|
||||
[key: string]: string | number | boolean | IDataObject;
|
||||
};
|
||||
errorMessage?: string;
|
||||
}
|
||||
@@ -1337,6 +1338,13 @@ export interface IPostReceiveBinaryData extends IPostReceiveBase {
|
||||
};
|
||||
}
|
||||
|
||||
export interface IPostReceiveFilter extends IPostReceiveBase {
|
||||
type: 'filter';
|
||||
properties: {
|
||||
pass: boolean | string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IPostReceiveLimit extends IPostReceiveBase {
|
||||
type: 'limit';
|
||||
properties: {
|
||||
|
||||
@@ -265,7 +265,6 @@ export class RoutingNode {
|
||||
if (action.type === 'rootProperty') {
|
||||
try {
|
||||
return inputData.flatMap((item) => {
|
||||
// let itemContent = item.json[action.properties.property];
|
||||
let itemContent = get(item.json, action.properties.property);
|
||||
|
||||
if (!Array.isArray(itemContent)) {
|
||||
@@ -285,6 +284,28 @@ export class RoutingNode {
|
||||
});
|
||||
}
|
||||
}
|
||||
if (action.type === 'filter') {
|
||||
const passValue = action.properties.pass;
|
||||
|
||||
inputData = inputData.filter((item) => {
|
||||
// If the value is an expression resolve it
|
||||
return this.getParameterValue(
|
||||
passValue,
|
||||
itemIndex,
|
||||
runIndex,
|
||||
executeSingleFunctions.getExecuteData(),
|
||||
{
|
||||
$response: responseData,
|
||||
$responseItem: item.json,
|
||||
$value: parameterValue,
|
||||
$version: this.node.typeVersion,
|
||||
},
|
||||
false,
|
||||
) as boolean;
|
||||
});
|
||||
|
||||
return inputData;
|
||||
}
|
||||
if (action.type === 'limit') {
|
||||
const maxResults = this.getParameterValue(
|
||||
action.properties.maxResults,
|
||||
|
||||
Reference in New Issue
Block a user