mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Disable fromAI button for vector stores (#13125)
This commit is contained in:
parent
814e2a8924
commit
bde84205f9
|
@ -54,6 +54,17 @@ const AI_DENYLIST_NODE_TYPE: INodeTypeDescription = {
|
||||||
...MOCK_NODE_TYPE_MIXIN,
|
...MOCK_NODE_TYPE_MIXIN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const AI_VECTOR_STORE_NODE_TYPE: INodeTypeDescription = {
|
||||||
|
name: 'aVectorStore',
|
||||||
|
codex: {
|
||||||
|
categories: ['AI'],
|
||||||
|
subcategories: {
|
||||||
|
AI: ['Tools', 'Vector Stores'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...MOCK_NODE_TYPE_MIXIN,
|
||||||
|
};
|
||||||
|
|
||||||
const NON_AI_NODE_TYPE: INodeTypeDescription = {
|
const NON_AI_NODE_TYPE: INodeTypeDescription = {
|
||||||
name: 'AN_NOT_AI_NODE_TYPE',
|
name: 'AN_NOT_AI_NODE_TYPE',
|
||||||
...MOCK_NODE_TYPE_MIXIN,
|
...MOCK_NODE_TYPE_MIXIN,
|
||||||
|
@ -64,6 +75,8 @@ describe('makeOverrideValue', () => {
|
||||||
['null nodeType', makeContext(''), null],
|
['null nodeType', makeContext(''), null],
|
||||||
['non-ai node type', makeContext(''), NON_AI_NODE_TYPE],
|
['non-ai node type', makeContext(''), NON_AI_NODE_TYPE],
|
||||||
['ai node type on denylist', makeContext(''), AI_DENYLIST_NODE_TYPE],
|
['ai node type on denylist', makeContext(''), AI_DENYLIST_NODE_TYPE],
|
||||||
|
['vector store type', makeContext(''), AI_VECTOR_STORE_NODE_TYPE],
|
||||||
|
['denied parameter name', makeContext('', 'parameters.toolName'), AI_NODE_TYPE],
|
||||||
])('should not create an override for %s', (_name, context, nodeType) => {
|
])('should not create an override for %s', (_name, context, nodeType) => {
|
||||||
expect(makeOverrideValue(context, nodeType)).toBeNull();
|
expect(makeOverrideValue(context, nodeType)).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
|
@ -48,6 +48,8 @@ const NODE_DENYLIST = ['toolCode', 'toolHttpRequest'];
|
||||||
|
|
||||||
const PATH_DENYLIST = [
|
const PATH_DENYLIST = [
|
||||||
'parameters.name',
|
'parameters.name',
|
||||||
|
// this is used in vector store tools
|
||||||
|
'parameters.toolName',
|
||||||
'parameters.description',
|
'parameters.description',
|
||||||
// This is used in e.g. the telegram node if the dropdown selects manual mode
|
// This is used in e.g. the telegram node if the dropdown selects manual mode
|
||||||
'parameters.toolDescription',
|
'parameters.toolDescription',
|
||||||
|
@ -164,7 +166,11 @@ export function canBeContentOverride(
|
||||||
if (PATH_DENYLIST.includes(props.path)) return false;
|
if (PATH_DENYLIST.includes(props.path)) return false;
|
||||||
|
|
||||||
const codex = nodeType?.codex;
|
const codex = nodeType?.codex;
|
||||||
if (!codex?.categories?.includes('AI') || !codex?.subcategories?.AI?.includes('Tools'))
|
if (
|
||||||
|
!codex?.categories?.includes('AI') ||
|
||||||
|
!codex?.subcategories?.AI?.includes('Tools') ||
|
||||||
|
codex?.subcategories?.AI?.includes('Vector Stores') // vector stores do not support fromAI
|
||||||
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !props.parameter.noDataExpression && 'options' !== props.parameter.type;
|
return !props.parameter.noDataExpression && 'options' !== props.parameter.type;
|
||||||
|
|
Loading…
Reference in a new issue