@@ -121,24 +121,40 @@ 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 ;
129+ bool shareConversation = false ;
127130 string details = null ;
128- UserAction action = actionPayload . Action ;
131+ string action = actionPayload . Action . ToString ( ) ;
129132
130- if ( action is UserAction . Dislike )
133+ switch ( actionPayload )
131134 {
132- var dislike = ( DislikePayload ) actionPayload ;
133- isUserFeedback = true ;
134- details = string . Format ( "{0} | {1}" , dislike . ShortFeedback , dislike . LongFeedback ) ;
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 ;
135148 }
136- else if ( action is UserAction . Like )
149+
150+ if ( isUserFeedback )
137151 {
138- isUserFeedback = true ;
152+ Telemetry . Trace ( AzTrace . Feedback ( action , shareConversation , _copilotResponse , details ) ) ;
153+ }
154+ else
155+ {
156+ Telemetry . Trace ( AzTrace . UserAction ( action , _copilotResponse , details ) ) ;
139157 }
140-
141- Telemetry . Trace ( AzTrace . UserAction ( action . ToString ( ) , _copilotResponse , details , isUserFeedback ) ) ;
142158 }
143159
144160 public async Task RefreshChatAsync ( IShell shell , bool force )
@@ -412,7 +428,7 @@ private ResponseData ParseCLIHandlerResponse(IShell shell)
412428 {
413429 // The placeholder section is not in the format as we've instructed ...
414430 Log . Error ( "Placeholder section not in expected format:\n {0}" , text ) ;
415- Telemetry . Trace ( AzTrace . Exception ( _copilotResponse , "Placeholder section not in expected format." ) ) ;
431+ Telemetry . Trace ( AzTrace . Exception ( "Placeholder section not in expected format." ) ) ;
416432 }
417433
418434 ReplaceKnownPlaceholders ( data ) ;
0 commit comments