mirror of
https://github.com/FlowiseAI/Flowise.git
synced 2026-10-12 02:02:17 +00:00
feat(agentflow): make client-specific knowledge fields for agent nodes (#6226)
- Updated Agent node to include 'client' property for 'agentKnowledgeDocumentStores' and 'agentKnowledgeVSEmbeddings', allowing differentiation between 'agentflowv2' and 'agentflowsdk'. - Added tests to ensure correct filtering of knowledge fields based on client type.
This commit is contained in:
@@ -273,6 +273,7 @@ class Agent_Agentflow implements INode {
|
||||
name: 'agentKnowledgeDocumentStores',
|
||||
type: 'array',
|
||||
description: 'Give your agent context about different document sources. Document stores must be upserted in advance.',
|
||||
client: ['agentflowv2'],
|
||||
array: [
|
||||
{
|
||||
label: 'Document Store',
|
||||
@@ -303,6 +304,7 @@ class Agent_Agentflow implements INode {
|
||||
name: 'agentKnowledgeVSEmbeddings',
|
||||
type: 'array',
|
||||
description: 'Give your agent context about different document sources from existing vector stores and embeddings',
|
||||
client: ['agentflowv2'],
|
||||
array: [
|
||||
{
|
||||
label: 'Vector Store',
|
||||
|
||||
@@ -214,6 +214,42 @@ describe('filterNodeByClient', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Agent node knowledge field filtering', () => {
|
||||
const agentNode = makeNode({
|
||||
inputs: [
|
||||
{ label: 'Agent Name', name: 'agentName', type: 'string' },
|
||||
{
|
||||
label: 'Knowledge (Document Stores)',
|
||||
name: 'agentKnowledgeDocumentStores',
|
||||
type: 'array',
|
||||
client: ['agentflowv2']
|
||||
},
|
||||
{
|
||||
label: 'Knowledge (Vector Embeddings)',
|
||||
name: 'agentKnowledgeVSEmbeddings',
|
||||
type: 'array',
|
||||
client: ['agentflowv2']
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
it('removes knowledge fields for agentflowsdk', () => {
|
||||
const result = filterNodeByClient(agentNode, 'agentflowsdk')
|
||||
const inputNames = result.inputs!.map((i: any) => i.name)
|
||||
expect(inputNames).toContain('agentName')
|
||||
expect(inputNames).not.toContain('agentKnowledgeDocumentStores')
|
||||
expect(inputNames).not.toContain('agentKnowledgeVSEmbeddings')
|
||||
})
|
||||
|
||||
it('keeps knowledge fields for agentflowv2', () => {
|
||||
const result = filterNodeByClient(agentNode, 'agentflowv2')
|
||||
const inputNames = result.inputs!.map((i: any) => i.name)
|
||||
expect(inputNames).toContain('agentName')
|
||||
expect(inputNames).toContain('agentKnowledgeDocumentStores')
|
||||
expect(inputNames).toContain('agentKnowledgeVSEmbeddings')
|
||||
})
|
||||
})
|
||||
|
||||
describe('immutability', () => {
|
||||
it('does not mutate the original node', () => {
|
||||
const node = makeNode({
|
||||
|
||||
Reference in New Issue
Block a user