Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

63 lines
1.4 KiB
TypeScript

import type { INodeInputConfiguration } from 'n8n-workflow';
export const prettifyOperation = (resource: string, operation: string) => {
if (operation === 'deleteAssistant') {
return 'Delete Assistant';
}
if (operation === 'deleteFile') {
return 'Delete File';
}
if (operation === 'classify') {
return 'Classify Text';
}
if (operation === 'message' && resource === 'text') {
return 'Message Model';
}
const capitalize = (str: string) => {
const chars = str.split('');
chars[0] = chars[0].toUpperCase();
return chars.join('');
};
if (['transcribe', 'translate'].includes(operation)) {
resource = 'recording';
}
if (operation === 'list') {
resource = resource + 's';
}
return `${capitalize(operation)} ${capitalize(resource)}`;
};
/* istanbul ignore next */
export const configureNodeInputs = (
resource: string,
operation: string,
hideTools: string,
memory: string | undefined,
) => {
if (resource === 'assistant' && operation === 'message') {
const inputs: INodeInputConfiguration[] = [
{ type: 'main' },
{ type: 'ai_tool', displayName: 'Tools' },
];
if (memory !== 'threadId') {
inputs.push({ type: 'ai_memory', displayName: 'Memory', maxConnections: 1 });
}
return inputs;
}
if (resource === 'text' && (operation === 'message' || operation === 'response')) {
if (hideTools === 'hide') {
return ['main'];
}
return [{ type: 'main' }, { type: 'ai_tool', displayName: 'Tools' }];
}
return ['main'];
};