@@ -121,34 +121,39 @@ public void Initialize(AgentConfig config)
121121
122122 public IEnumerable < CommandBase > GetCommands ( ) => [ new ReplaceCommand ( this ) ] ;
123123 public bool CanAcceptFeedback ( UserAction action ) => Telemetry . Enabled ;
124- public void OnUserAction ( UserActionPayload actionPayload ) {
124+
125+ public void OnUserAction ( UserActionPayload actionPayload )
126+ {
125127 // Send telemetry about the user action.
126128 bool isUserFeedback = false ;
127- bool allowIdsForCorrelation = false ;
129+ bool shareConversation = false ;
128130 string details = null ;
129- UserAction action = actionPayload . Action ;
131+ string action = actionPayload . Action . ToString ( ) ;
130132
131- if ( action is UserAction . Dislike )
132- {
133- isUserFeedback = true ;
134- DislikePayload dislike = ( DislikePayload ) actionPayload ;
135- allowIdsForCorrelation = dislike . ShareConversation ;
136- details = string . Format ( "{0} | {1}" , dislike . ShortFeedback , dislike . LongFeedback ) ;
137- }
138- else if ( action is UserAction . Like )
133+ switch ( actionPayload )
139134 {
140- isUserFeedback = true ;
141- LikePayload like = ( LikePayload ) actionPayload ;
142- allowIdsForCorrelation = like . ShareConversation ;
135+ case DislikePayload dislike :
136+ isUserFeedback = true ;
137+ shareConversation = dislike . ShareConversation ;
138+ details = string . Format ( "{0} | {1}" , dislike . ShortFeedback , dislike . LongFeedback ) ;
139+ break ;
140+
141+ case LikePayload like :
142+ isUserFeedback = true ;
143+ shareConversation = like . ShareConversation ;
144+ break ;
145+
146+ default :
147+ break ;
143148 }
144149
145150 if ( isUserFeedback )
146151 {
147- Telemetry . Trace ( AzTrace . Feedback ( action . ToString ( ) , _copilotResponse , details , allowIdsForCorrelation ) ) ;
152+ Telemetry . Trace ( AzTrace . Feedback ( action , shareConversation , _copilotResponse , details ) ) ;
148153 }
149154 else
150155 {
151- Telemetry . Trace ( AzTrace . UserAction ( action . ToString ( ) , _copilotResponse , details ) ) ;
156+ Telemetry . Trace ( AzTrace . UserAction ( action , _copilotResponse , details ) ) ;
152157 }
153158 }
154159
@@ -423,7 +428,7 @@ private ResponseData ParseCLIHandlerResponse(IShell shell)
423428 {
424429 // The placeholder section is not in the format as we've instructed ...
425430 Log . Error ( "Placeholder section not in expected format:\n {0}" , text ) ;
426- Telemetry . Trace ( AzTrace . Exception ( _copilotResponse , "Placeholder section not in expected format." ) ) ;
431+ Telemetry . Trace ( AzTrace . Exception ( "Placeholder section not in expected format." ) ) ;
427432 }
428433
429434 ReplaceKnownPlaceholders ( data ) ;
0 commit comments