@@ -74,42 +74,44 @@ async def get_config(
7474 # Get RAG data sources for the user (feature-gated MCP-backed discovery)
7575 rag_data_sources = []
7676 rag_servers = []
77- try :
78- if app_settings .feature_rag_mcp_enabled :
79- rag_mcp = app_factory .get_rag_mcp_service ()
80- rag_data_sources = await rag_mcp .discover_data_sources (
81- current_user , user_compliance_level = compliance_level
82- )
83- rag_servers = await rag_mcp .discover_servers (
84- current_user , user_compliance_level = compliance_level
85- )
86- else :
87- rag_client = app_factory .get_rag_client ()
88- # rag_client.discover_data_sources now returns List[DataSource] objects
89- data_source_objects = await rag_client .discover_data_sources (current_user )
90- # Convert to list of names (strings) for the 'data_sources' field (backward compatibility)
91- rag_data_sources = [ds .name for ds in data_source_objects ]
92- # Populate rag_servers with the mock data in the expected format for the UI
93- rag_servers = [
94- {
95- "server" : "rag_mock" ,
96- "displayName" : "RAG Mock Data" ,
97- "icon" : "database" ,
98- "complianceLevel" : "Public" , # Default compliance for the mock server itself
99- "sources" : [
100- {
101- "id" : ds .name ,
102- "name" : ds .name ,
103- "authRequired" : True ,
104- "selected" : False ,
105- "complianceLevel" : ds .compliance_level ,
106- }
107- for ds in data_source_objects
108- ],
109- }
110- ]
111- except Exception as e :
112- logger .warning (f"Error resolving RAG data sources: { e } " )
77+ # Only attempt RAG discovery if RAG feature is enabled
78+ if app_settings .feature_rag_enabled :
79+ try :
80+ if app_settings .feature_rag_mcp_enabled :
81+ rag_mcp = app_factory .get_rag_mcp_service ()
82+ rag_data_sources = await rag_mcp .discover_data_sources (
83+ current_user , user_compliance_level = compliance_level
84+ )
85+ rag_servers = await rag_mcp .discover_servers (
86+ current_user , user_compliance_level = compliance_level
87+ )
88+ else :
89+ rag_client = app_factory .get_rag_client ()
90+ # rag_client.discover_data_sources now returns List[DataSource] objects
91+ data_source_objects = await rag_client .discover_data_sources (current_user )
92+ # Convert to list of names (strings) for the 'data_sources' field (backward compatibility)
93+ rag_data_sources = [ds .name for ds in data_source_objects ]
94+ # Populate rag_servers with the mock data in the expected format for the UI
95+ rag_servers = [
96+ {
97+ "server" : "rag_mock" ,
98+ "displayName" : "RAG Mock Data" ,
99+ "icon" : "database" ,
100+ "complianceLevel" : "Public" , # Default compliance for the mock server itself
101+ "sources" : [
102+ {
103+ "id" : ds .name ,
104+ "name" : ds .name ,
105+ "authRequired" : True ,
106+ "selected" : False ,
107+ "complianceLevel" : ds .compliance_level ,
108+ }
109+ for ds in data_source_objects
110+ ],
111+ }
112+ ]
113+ except Exception as e :
114+ logger .warning (f"Error resolving RAG data sources: { e } " )
113115
114116 # Check if tools are enabled
115117 tools_info = []
0 commit comments