Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

datapools v2 change

Ahmed Essam7b6a8c62994e
diff --git a/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx b/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx
index 347d02df..3d9ac5a9 100644
--- a/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx
+++ b/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx
@@ -20,8 +20,9 @@ import {
SelectTrigger,
SelectValue,
} from '@src/react/shared/components/ui/select';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';
import { errorToast, successToast } from '@src/shared/components/toast';
-import { PlusCircle } from 'lucide-react';
+import { Info, PlusCircle } from 'lucide-react';
import { ChangeEvent, FC, useEffect, useState } from 'react';
import {
CreateCredentialsModal
@@ -57,7 +58,7 @@ export const CreateNamespaceModal: FC<CreateNamespaceModalProps> = ({
const [isCreating, setIsCreating] = useState(false);
const [isLoadingModels, setIsLoadingModels] = useState(false);
const [error, setError] = useState<string | null>(null);
-
+ const [isDimensionsReadOnly, setIsDimensionsReadOnly] = useState(false);
// State for Create Credentials Modal
const [isCreateCredModalOpen, setIsCreateCredModalOpen] = useState(false);
@@ -158,9 +159,33 @@ export const CreateNamespaceModal: FC<CreateNamespaceModalProps> = ({
}
setSelectedCredentialId(value);
+ handleDimentionDynamicChange('connection', value);
setError(null);
};
+ const handleDimentionDynamicChange = (change: 'embedding_model' | 'connection', id: string) => {
+ setIsDimensionsReadOnly(false);
+
+ if (change === 'embedding_model') {
+ // check if model is text-embedding-ada-002, then set dimensions to 1536 and read only
+ if (id === 'text-embedding-ada-002') {
+ setDimensions('1536');
+ setIsDimensionsReadOnly(true);
+ }
+ }
+
+ if (change === 'connection') {
+ // check if smyth conneciton, then set dimensions to 1536 and read only
+ if (id === '__smythos_vectordb_cred__') {
+ setDimensions('1536');
+ setIsDimensionsReadOnly(true);
+ }
+ }
+
+
+
+ };
+
/**
* Handle successful credential creation
*/
@@ -317,7 +342,11 @@ export const CreateNamespaceModal: FC<CreateNamespaceModalProps> = ({
</label>
<Select
value={selectedModelId}
- onValueChange={setSelectedModelId}
+ onValueChange={(value) => {
+
+ setSelectedModelId(value);
+ handleDimentionDynamicChange('embedding_model', value);
+ }}
disabled={isLoadingModels || isCreating}
>
<SelectTrigger className="w-full" disabled={isLoadingModels || isCreating}>
@@ -345,8 +374,18 @@ export const CreateNamespaceModal: FC<CreateNamespaceModalProps> = ({
{/* Dimensions Input */}
<div className="space-y-2">
- <label className="text-gray-700 mb-1 text-sm font-normal flex items-center">
+ <label className="text-gray-700 text-sm font-normal flex items-center">
Vector Dimensions
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="w-4 h-4 cursor-help ml-1" />
+ </TooltipTrigger>
+ <TooltipContent side="right" className="w-[200px] text-center">
+ <p>
+ The dimension should match the one configured in your vector database provider.
+ </p>
+ </TooltipContent>
+ </Tooltip>
</label>
<input
type="number"
@@ -354,6 +393,7 @@ export const CreateNamespaceModal: FC<CreateNamespaceModalProps> = ({
value={dimensions}
onChange={(e: ChangeEvent<HTMLInputElement>) => setDimensions(e.target.value)}
disabled={isCreating}
+ readOnly={isDimensionsReadOnly}
className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 disabled:bg-gray-100 disabled:cursor-not-allowed text-sm"
/>
<p className="text-xs text-gray-500">