Skip to content

Commit fa2c437

Browse files
fix(ui): integrate tracker dispatch for prompt events in user input handling (#479)
Co-authored-by: amitksingh1490 <amitksingh1490@users.noreply.github.com>
1 parent 973ee29 commit fa2c437

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

crates/forge_main/src/input.rs

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ impl UserInput for Console {
4747
Ok(ReadResult::Exit) => return Ok(Command::Exit),
4848
Ok(ReadResult::Empty) => continue,
4949
Ok(ReadResult::Success(text)) => {
50+
tokio::spawn(
51+
crate::ui::TRACKER.dispatch(forge_tracker::EventKind::Prompt(text.clone())),
52+
);
5053
return Ok(Command::parse(&text));
5154
}
5255
Err(e) => {

crates/forge_main/src/ui.rs

-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use colored::Colorize;
55
use forge_api::{AgentMessage, ChatRequest, ChatResponse, ConversationId, Event, Model, API};
66
use forge_display::TitleFormat;
77
use forge_snaps::SnapshotInfo;
8-
use forge_tracker::EventKind;
98
use lazy_static::lazy_static;
109
use serde_json::Value;
1110
use tokio_stream::StreamExt;
@@ -406,8 +405,6 @@ impl<F: API> UI<F> {
406405
// Create the chat request with the event
407406
let chat = ChatRequest::new(event, conversation_id);
408407

409-
tokio::spawn(TRACKER.dispatch(EventKind::Prompt(content)));
410-
411408
match self.api.chat(chat).await {
412409
Ok(mut stream) => self.handle_chat_stream(&mut stream).await,
413410
Err(err) => Err(err),
@@ -518,9 +515,6 @@ impl<F: API> UI<F> {
518515

519516
// Create the chat request with the help query event
520517
let chat = ChatRequest::new(event, conversation_id);
521-
522-
tokio::spawn(TRACKER.dispatch(EventKind::Prompt(content)));
523-
524518
match self.api.chat(chat).await {
525519
Ok(mut stream) => self.handle_chat_stream(&mut stream).await,
526520
Err(err) => Err(err),

0 commit comments

Comments
 (0)