@@ -9,8 +9,10 @@ import {getDefaultReference} from '@/components/util/ReferenceUtil.js';
99import {
1010 DATA_TYPES ,
1111 DEFAULT_KNOWLEDGE_REPO_GROUP_STRUCT ,
12+ DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_USER_ID ,
1213 DEFAULT_LLM_KNOWLEDGE_BASES ,
13- DEFAULT_LLM_REFERENCE_OUTPUT , DEFAULT_LOOP_NODE_CONTEXT ,
14+ DEFAULT_LLM_REFERENCE_OUTPUT ,
15+ DEFAULT_LOOP_NODE_CONTEXT ,
1416 DEFAULT_MAX_MEMORY_ROUNDS ,
1517 END_NODE_TYPE ,
1618 FLOW_TYPE ,
@@ -390,10 +392,32 @@ export const knowledgeRetrievalCompatibilityProcessor = (shapeData, graph, pageH
390392 const process = self . process ;
391393 self . process = ( ) => {
392394 process . apply ( self ) ;
393- const optionValue = self . shapeData . flowMeta . jober . converter . entity . inputParams . find ( inputParam => inputParam . name === 'option' ) . value ;
394- if ( ! optionValue . find ( v => v . name === 'groupId' ) ) {
395- optionValue . push ( DEFAULT_KNOWLEDGE_REPO_GROUP_STRUCT ) ;
396- }
395+
396+ const optionParamProcess = ( ) => {
397+ const optionValue = self . shapeData . flowMeta . jober . converter . entity . inputParams
398+ . find ( inputParam => inputParam . name === 'option' ) ?. value ;
399+
400+ if ( Array . isArray ( optionValue ) && ! optionValue . some ( v => v . name === 'groupId' ) ) {
401+ optionValue . push ( DEFAULT_KNOWLEDGE_REPO_GROUP_STRUCT ) ;
402+ }
403+ } ;
404+
405+ const userIdParamProcess = ( ) => {
406+ const inputParams = self . shapeData . flowMeta . jober . converter . entity . inputParams ;
407+ const userIdParam = inputParams . find ( inputParam => inputParam . name === 'userId' ) ;
408+ if ( ! userIdParam ) {
409+ inputParams . push ( DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_USER_ID ) ;
410+ }
411+ const entityParams = self . shapeData . flowMeta . jober . entity . params ;
412+ if ( ! entityParams . find ( param => param . name === 'userId' ) ) {
413+ const optionIndex = entityParams . findIndex ( param => param . name === 'option' ) ;
414+ const insertIndex = optionIndex !== - 1 ? optionIndex + 1 : entityParams . length ;
415+ entityParams . splice ( insertIndex , 0 , { name : 'userId' } ) ;
416+ }
417+ } ;
418+
419+ optionParamProcess ( ) ;
420+ userIdParamProcess ( ) ;
397421 } ;
398422
399423 return self ;
0 commit comments