@@ -49,7 +49,7 @@ public class NodeAutoCompleteBarViewModel : SearchViewModel
4949 private bool displayLowConfidence ;
5050 private const string nodeAutocompleteMLEndpoint = "MLNodeAutocomplete" ;
5151 private const string nodeClusterAutocompleteMLEndpoint = "MLNodeClusterAutocomplete" ;
52- private const double minClusterConfidenceScore = 0.1 ;
52+ private const double minClusterConfidenceScore = 0.001 ;
5353 private static Assembly dynamoCoreWpfAssembly ;
5454
5555 private bool _isSingleAutocomplete ;
@@ -169,7 +169,7 @@ internal IEnumerable<ClusterResultItem> QualifiedResults
169169 {
170170 return null ;
171171 }
172- return FullResults . Results . Where ( x => double . Parse ( x . Probability ) * 100 > minClusterConfidenceScore ) ;
172+ return FullResults . Results . Where ( x => x . Probability > minClusterConfidenceScore ) ;
173173 }
174174 }
175175
@@ -382,7 +382,6 @@ public bool IsDNAClusterPlacementEnabled
382382 internal event Action < NodeModel > ParentNodeRemoved ;
383383
384384 internal MLNodeClusterAutoCompletionResponse FullResults { private set ; get ; }
385- internal List < SingleResultItem > FullSingleResults { set ; get ; }
386385 private Guid LastRequestGuid ;
387386
388387 /// <summary>
@@ -796,11 +795,7 @@ internal void AddCluster(int filterredIndex)
796795 var currentFilter = FilteredView . Cast < DNADropdownViewModel > ( ) . ToList ( ) ;
797796 var currentItem = filterredIndex >= 0 && filterredIndex < currentFilter . Count ? currentFilter [ filterredIndex ] : null ;
798797
799- var realCluster = QualifiedResults . FirstOrDefault ( x => x . Description . Equals ( currentItem . Description ) ) ;
800- if ( realCluster != null )
801- {
802- AddCluster ( realCluster ) ;
803- }
798+ AddCluster ( currentItem . ClusterResultItem ) ;
804799 }
805800
806801 // Add Cluster from server result into the workspace
@@ -974,22 +969,7 @@ internal void PopulateAutoComplete()
974969 {
975970 Version = "0.0" ,
976971 NumberOfResults = fullSingleResults . Count ,
977- Results = fullSingleResults . Select ( x => new ClusterResultItem
978- {
979- Description = x . Description ,
980- Title = x . Description ,
981- Probability = x . Score . ToString ( ) ,
982- EntryNodeIndex = 0 ,
983- EntryNodeInPort = PortViewModel . PortType == PortType . Output ? x . PortToConnect : - 1 ,
984- EntryNodeOutPort = PortViewModel . PortType == PortType . Input ? x . PortToConnect : - 1 ,
985- Topology = new TopologyItem
986- {
987- Nodes = new List < NodeItem > { new NodeItem {
988- Id = Guid . NewGuid ( ) . ToString ( ) ,
989- Type = new NodeType { Id = x . CreationName } } } ,
990- Connections = new List < ConnectionItem > ( )
991- }
992- } )
972+ Results = fullSingleResults ,
993973 } ;
994974 }
995975 else
@@ -1012,15 +992,15 @@ internal void PopulateAutoComplete()
1012992 return ;
1013993 }
1014994
1015- FullSingleResults = fullSingleResults ?? FullSingleResults ;
1016995 FullResults = fullResults ?? FullResults ;
1017996
1018997 IEnumerable < DNADropdownViewModel > comboboxResults ;
1019998 if ( IsSingleAutocomplete || ! IsDisplayingMLRecommendation )
1020999 {
1000+ var singleResults = FullResults . Results as List < SingleResultItem > ;
10211001 //getting bitmaps from resources necessarily has to be done in the UI thread
10221002 Dictionary < string , ImageSource > dict = [ ] ;
1023- foreach ( var singleResult in FullSingleResults )
1003+ foreach ( var singleResult in singleResults )
10241004 {
10251005 if ( dict . ContainsKey ( singleResult . CreationName ) )
10261006 {
@@ -1030,18 +1010,20 @@ internal void PopulateAutoComplete()
10301010 SearchViewModelRequestBitmapSource ( iconRequest ) ;
10311011 dict [ singleResult . CreationName ] = iconRequest . Icon ;
10321012 }
1033- comboboxResults = FullSingleResults . Where ( x => x . Score * 100 > minClusterConfidenceScore ) . Select ( x => new DNADropdownViewModel
1013+ comboboxResults = QualifiedResults . Select ( x => new DNADropdownViewModel
10341014 {
10351015 Description = x . Description ,
1036- Parameters = x . Parameters ,
1037- SmallIcon = dict [ x . CreationName ] ,
1016+ Parameters = ( x as SingleResultItem ) . Parameters ,
1017+ SmallIcon = dict [ ( x as SingleResultItem ) . CreationName ] ,
1018+ ClusterResultItem = x
10381019 } ) ;
10391020 }
10401021 else
10411022 {
10421023 comboboxResults = QualifiedResults . Select ( x => new DNADropdownViewModel
10431024 {
1044- Description = x . Description
1025+ Description = x . Description ,
1026+ ClusterResultItem = x
10451027 //default icon (cluster) is set in the xaml view
10461028 } ) ;
10471029 }
0 commit comments