agent: Do some cleanup of feedback comments submission (#27940)
This PR does some stylistic cleanup of the feedback comments submission code. Release Notes: - N/A
This commit is contained in:
parent
b7b7f1ccdd
commit
c7d27753ee
1 changed files with 20 additions and 26 deletions
|
@ -953,24 +953,19 @@ impl ActiveThread {
|
||||||
_window: &mut Window,
|
_window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if let Some(editor) = self.feedback_comments_editor.clone() {
|
let Some(editor) = self.feedback_comments_editor.clone() else {
|
||||||
let comments = editor.read(cx).text(cx);
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
// Submit negative feedback
|
let report_task = self.thread.update(cx, |thread, cx| {
|
||||||
let report = self.thread.update(cx, |thread, cx| {
|
|
||||||
thread.report_feedback(ThreadFeedback::Negative, cx)
|
thread.report_feedback(ThreadFeedback::Negative, cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let comments = editor.read(cx).text(cx);
|
||||||
if !comments.is_empty() {
|
if !comments.is_empty() {
|
||||||
let thread_id = self.thread.read(cx).id().clone();
|
let thread_id = self.thread.read(cx).id().clone();
|
||||||
let comments_value = String::from(comments.as_str());
|
|
||||||
|
|
||||||
// Log comments as a separate telemetry event
|
telemetry::event!("Assistant Thread Feedback Comments", thread_id, comments);
|
||||||
telemetry::event!(
|
|
||||||
"Assistant Thread Feedback Comments",
|
|
||||||
thread_id,
|
|
||||||
comments = comments_value
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.showing_feedback_comments = false;
|
self.showing_feedback_comments = false;
|
||||||
|
@ -978,12 +973,11 @@ impl ActiveThread {
|
||||||
|
|
||||||
let this = cx.entity().downgrade();
|
let this = cx.entity().downgrade();
|
||||||
cx.spawn(async move |_, cx| {
|
cx.spawn(async move |_, cx| {
|
||||||
report.await?;
|
report_task.await?;
|
||||||
this.update(cx, |_this, cx| cx.notify())
|
this.update(cx, |_this, cx| cx.notify())
|
||||||
})
|
})
|
||||||
.detach_and_log_err(cx);
|
.detach_and_log_err(cx);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_cancel_comments(
|
fn handle_cancel_comments(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue