@@ -48,7 +48,7 @@ public class NodeAutoCompleteBarViewModel : SearchViewModel
4848 private bool displayLowConfidence ;
4949 private const string nodeAutocompleteMLEndpoint = "MLNodeAutocomplete" ;
5050 private const string nodeClusterAutocompleteMLEndpoint = "MLNodeClusterAutocomplete" ;
51- private const double minClusterConfidenceScore = 0.1 ;
51+ private const double minClusterConfidenceScore = 0.001 ;
5252 private static Assembly dynamoCoreWpfAssembly ;
5353
5454 private bool _isSingleAutocomplete ;
@@ -168,7 +168,7 @@ internal IEnumerable<ClusterResultItem> QualifiedResults
168168 {
169169 return null ;
170170 }
171- return FullResults . Results . Where ( x => double . Parse ( x . Probability ) * 100 > minClusterConfidenceScore ) ;
171+ return FullResults . Results . Where ( x => x . Probability > minClusterConfidenceScore ) ;
172172 }
173173 }
174174
@@ -381,7 +381,6 @@ public bool IsDNAClusterPlacementEnabled
381381 internal event Action < NodeModel > ParentNodeRemoved ;
382382
383383 internal MLNodeClusterAutoCompletionResponse FullResults { private set ; get ; }
384- internal List < SingleResultItem > FullSingleResults { set ; get ; }
385384 private Guid LastRequestGuid ;
386385
387386 /// <summary>
@@ -784,11 +783,7 @@ internal void AddCluster(int filterredIndex)
784783 var currentFilter = FilteredView . Cast < DNADropdownViewModel > ( ) . ToList ( ) ;
785784 var currentItem = filterredIndex >= 0 && filterredIndex < currentFilter . Count ? currentFilter [ filterredIndex ] : null ;
786785
787- var realCluster = QualifiedResults . FirstOrDefault ( x => x . Description . Equals ( currentItem . Description ) ) ;
788- if ( realCluster != null )
789- {
790- AddCluster ( realCluster ) ;
791- }
786+ AddCluster ( currentItem . ClusterResultItem ) ;
792787 }
793788
794789 // Add Cluster from server result into the workspace
@@ -960,22 +955,7 @@ internal void PopulateAutoComplete()
960955 {
961956 Version = "0.0" ,
962957 NumberOfResults = fullSingleResults . Count ,
963- Results = fullSingleResults . Select ( x => new ClusterResultItem
964- {
965- Description = x . Description ,
966- Title = x . Description ,
967- Probability = x . Score . ToString ( ) ,
968- EntryNodeIndex = 0 ,
969- EntryNodeInPort = PortViewModel . PortType == PortType . Output ? x . PortToConnect : - 1 ,
970- EntryNodeOutPort = PortViewModel . PortType == PortType . Input ? x . PortToConnect : - 1 ,
971- Topology = new TopologyItem
972- {
973- Nodes = new List < NodeItem > { new NodeItem {
974- Id = Guid . NewGuid ( ) . ToString ( ) ,
975- Type = new NodeType { Id = x . CreationName } } } ,
976- Connections = new List < ConnectionItem > ( )
977- }
978- } )
958+ Results = fullSingleResults ,
979959 } ;
980960 }
981961 else
@@ -998,15 +978,15 @@ internal void PopulateAutoComplete()
998978 return ;
999979 }
1000980
1001- FullSingleResults = fullSingleResults ?? FullSingleResults ;
1002981 FullResults = fullResults ?? FullResults ;
1003982
1004983 IEnumerable < DNADropdownViewModel > comboboxResults ;
1005984 if ( IsSingleAutocomplete || ! IsDisplayingMLRecommendation )
1006985 {
986+ var singleResults = FullResults . Results as List < SingleResultItem > ;
1007987 //getting bitmaps from resources necessarily has to be done in the UI thread
1008988 Dictionary < string , ImageSource > dict = [ ] ;
1009- foreach ( var singleResult in FullSingleResults )
989+ foreach ( var singleResult in singleResults )
1010990 {
1011991 if ( dict . ContainsKey ( singleResult . CreationName ) )
1012992 {
@@ -1016,18 +996,20 @@ internal void PopulateAutoComplete()
1016996 SearchViewModelRequestBitmapSource ( iconRequest ) ;
1017997 dict [ singleResult . CreationName ] = iconRequest . Icon ;
1018998 }
1019- comboboxResults = FullSingleResults . Where ( x => x . Score * 100 > minClusterConfidenceScore ) . Select ( x => new DNADropdownViewModel
999+ comboboxResults = QualifiedResults . Select ( x => new DNADropdownViewModel
10201000 {
10211001 Description = x . Description ,
1022- Parameters = x . Parameters ,
1023- SmallIcon = dict [ x . CreationName ] ,
1002+ Parameters = ( x as SingleResultItem ) . Parameters ,
1003+ SmallIcon = dict [ ( x as SingleResultItem ) . CreationName ] ,
1004+ ClusterResultItem = x
10241005 } ) ;
10251006 }
10261007 else
10271008 {
10281009 comboboxResults = QualifiedResults . Select ( x => new DNADropdownViewModel
10291010 {
1030- Description = x . Description
1011+ Description = x . Description ,
1012+ ClusterResultItem = x
10311013 //default icon (cluster) is set in the xaml view
10321014 } ) ;
10331015 }
0 commit comments