@@ -56,7 +56,7 @@ export default function AddNewEmbeddingModal() {
5656
5757 useEffect ( ( ) => {
5858 prepareSuggestions ( ) ;
59- checkIfPlatformHasToken ( ) ;
59+ // checkIfPlatformHasToken();
6060 } , [ ] ) ;
6161
6262 useEffect ( ( ) => {
@@ -84,7 +84,7 @@ export default function AddNewEmbeddingModal() {
8484 const suggestionListFiltered = suggestionList . map ( ( suggestion : any ) => {
8585 const suggestionCopy = { ...suggestion } ;
8686 const applicability = JSON . parse ( suggestionCopy . applicability ) ;
87- if ( ( granularity . value == EmbeddingType . ON_ATTRIBUTE && applicability . attribute ) || ( granularity . value == EmbeddingType . ON_TOKEN && applicability . token ) ) {
87+ if ( ( granularity . value == EmbeddingType . ON_ATTRIBUTE && applicability . attribute ) /* || (granularity.value == EmbeddingType.ON_TOKEN && applicability.token)*/ ) {
8888 suggestionCopy . forceHidden = false ;
8989 } else {
9090 suggestionCopy . forceHidden = true ;
@@ -99,11 +99,13 @@ export default function AddNewEmbeddingModal() {
9999
100100 function checkIfAttributeHasToken ( ) {
101101 const attribute = useableEmbedableAttributes . find ( ( a ) => a . id == targetAttribute . id ) ;
102- if ( attribute ?. dataType == DataTypeEnum . EMBEDDING_LIST ) {
103- setGranularityArray ( GRANULARITY_TYPES_ARRAY . filter ( ( g ) => g . value != EmbeddingType . ON_TOKEN ) ) ;
104- } else {
105- checkIfPlatformHasToken ( ) ;
106- }
102+ setGranularityArray ( GRANULARITY_TYPES_ARRAY ) ;
103+
104+ // if (attribute?.dataType == DataTypeEnum.EMBEDDING_LIST) {
105+ // setGranularityArray(GRANULARITY_TYPES_ARRAY.filter((g) => g.value != EmbeddingType.ON_TOKEN));
106+ // } else {
107+ // checkIfPlatformHasToken();
108+ // }
107109 }
108110
109111 function changePlatformOrGranularity ( ) {
@@ -131,18 +133,20 @@ export default function AddNewEmbeddingModal() {
131133 acceptButtonCopy . disabled = checkIfCreateEmbeddingIsDisabled ( { platform, model, apiToken, termsAccepted, embeddings, targetAttribute, granularity, engine, url, version, embeddingPlatforms } ) ;
132134 setAcceptButton ( acceptButtonCopy ) ;
133135 setTermsAccepted ( false ) ;
134- setModel ( null ) ;
136+ if ( savePlatform == PlatformType . PRIVATEMODE_AI ) {
137+ setModel ( "intfloat/multilingual-e5-large-instruct" ) ;
138+ } else setModel ( null ) ;
135139 setApiToken ( '' ) ;
136140 }
137141
138- function checkIfPlatformHasToken ( ) {
139- if ( ! platform ) return ;
140- if ( platform . name == platformNamesDict [ PlatformType . OPEN_AI ] || platform . name == platformNamesDict [ PlatformType . AZURE ] ) {
141- setGranularityArray ( GRANULARITY_TYPES_ARRAY . filter ( ( g ) => g . value != EmbeddingType . ON_TOKEN ) ) ;
142- } else {
143- setGranularityArray ( GRANULARITY_TYPES_ARRAY ) ;
144- }
145- }
142+ // function checkIfPlatformHasToken() {
143+ // if (!platform) return;
144+ // if (platform.name == platformNamesDict[PlatformType.OPEN_AI] || platform.name == platformNamesDict[PlatformType.AZURE]) {
145+ // setGranularityArray(GRANULARITY_TYPES_ARRAY.filter((g) => g.value != EmbeddingType.ON_TOKEN));
146+ // } else {
147+ // setGranularityArray(GRANULARITY_TYPES_ARRAY);
148+ // }
149+ // }
146150
147151 const prepareAzureData = useCallback ( ( ) => {
148152 const getAzureUrl = localStorage . getItem ( 'azureUrls' ) ;
@@ -175,7 +179,8 @@ export default function AddNewEmbeddingModal() {
175179 platform : platform . platform ,
176180 termsText : gdprText . current != null ? gdprText . current . innerText : null ,
177181 termsAccepted : termsAccepted ,
178- embeddingType : granularity . value == EmbeddingType . ON_TOKEN ? EmbeddingType . ON_TOKEN : EmbeddingType . ON_ATTRIBUTE ,
182+ // embeddingType: granularity.value == EmbeddingType.ON_TOKEN ? EmbeddingType.ON_TOKEN : EmbeddingType.ON_ATTRIBUTE,
183+ embeddingType : EmbeddingType . ON_ATTRIBUTE ,
179184 filterAttributes : filteredAttributes
180185 }
181186
@@ -191,6 +196,8 @@ export default function AddNewEmbeddingModal() {
191196 config . type = DEFAULT_AZURE_TYPE ;
192197 config . version = version ;
193198 prepareAzureData ( ) ;
199+ } else if ( platform . name == platformNamesDict [ PlatformType . PRIVATEMODE_AI ] ) {
200+ config . model = model ;
194201 }
195202 createEmbeddingPost ( projectId , targetAttribute . id , JSON . stringify ( config ) , ( res ) => { } ) ;
196203
@@ -290,13 +297,20 @@ export default function AddNewEmbeddingModal() {
290297 < SuggestionsAzure options = { azureVersions } selectedOption = { ( option : string ) => setVersion ( option ) } name = "Version" tooltip = "The latest version of the Azure OpenAI service can also be found here." />
291298 </ > }
292299 </ > }
300+ { platform && platform . name == platformNamesDict [ PlatformType . PRIVATEMODE_AI ] && < >
301+ < Tooltip content = { TOOLTIPS_DICT . PROJECT_SETTINGS . EMBEDDINGS . MODEL } placement = "right" color = "invert" >
302+ < span className = "card-title mb-0 label-text flex" > < span className = "cursor-help underline filtersUnderline" > Model</ span > </ span >
303+ </ Tooltip >
304+ < input defaultValue = "intfloat/multilingual-e5-large-instruct" disabled className = "h-9 w-full text-sm border-gray-300 rounded-md placeholder-italic border text-gray-900 pl-4 focus:outline-none focus:ring-2 focus:ring-gray-300 focus:ring-offset-2 focus:ring-offset-gray-100 disabled:opacity-50" />
305+ </ > }
293306 </ div >
294- { platform && ( platform . name == platformNamesDict [ PlatformType . OPEN_AI ] || platform . name == platformNamesDict [ PlatformType . AZURE ] ) && < div className = "text-center mt-3" >
307+ { platform && ( platform . name == platformNamesDict [ PlatformType . OPEN_AI ] || platform . name == platformNamesDict [ PlatformType . AZURE ] || platform . name == platformNamesDict [ PlatformType . PRIVATEMODE_AI ] ) && < div className = "text-center mt-3" >
295308 < div className = "border border-gray-300 text-xs text-gray-500 p-2.5 rounded-lg text-justify" >
296309 < label ref = { gdprText } className = "text-gray-700" >
297310 { selectedPlatform . splitTerms [ 0 ] }
298311 { platform . name == platformNamesDict [ PlatformType . OPEN_AI ] && < a href = { selectedPlatform . link } target = "_blank" className = "underline" > openai terms of service.</ a > }
299312 { platform . name == platformNamesDict [ PlatformType . AZURE ] && < a href = { selectedPlatform . link } target = "_blank" className = "underline" > azure terms of service.</ a > }
313+ { platform . name == platformNamesDict [ PlatformType . PRIVATEMODE_AI ] && < a href = { selectedPlatform . link } target = "_blank" className = "underline" > private mode ai terms of service.</ a > }
300314 < div > { selectedPlatform . splitTerms [ 1 ] } </ div >
301315 </ label >
302316 </ div >
0 commit comments