Browse Source

fix: tool servers ui settings can be bypassed with search

Timothy Jaeryang Baek 1 month ago
parent
commit
ed5de96d1d
1 changed files with 22 additions and 10 deletions
  1. 22 10
      src/lib/components/chat/SettingsModal.svelte

+ 22 - 10
src/lib/components/chat/SettingsModal.svelte

@@ -123,16 +123,28 @@
 				'alwaysonwebsearch'
 			]
 		},
-		{
-			id: 'connections',
-			title: 'Connections',
-			keywords: []
-		},
-		{
-			id: 'tools',
-			title: 'Tools',
-			keywords: []
-		},
+		...($user?.role === 'admin' ||
+		($user?.role === 'user' && $config?.features?.enable_direct_connections)
+			? [
+					{
+						id: 'connections',
+						title: 'Connections',
+						keywords: []
+					}
+				]
+			: []),
+
+		...($user?.role === 'admin' ||
+		($user?.role === 'user' && $user?.permissions?.features?.direct_tool_servers)
+			? [
+					{
+						id: 'tools',
+						title: 'Tools',
+						keywords: []
+					}
+				]
+			: []),
+
 		{
 			id: 'personalization',
 			title: 'Personalization',