Skip to content

Commit d4a9dc1

Browse files
authored
fix: remove timestamp from input prompt (#1808)
1 parent 9a932d1 commit d4a9dc1

File tree

5 files changed

+62
-60
lines changed

5 files changed

+62
-60
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/chat-cli/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ bstr = "1.12.0"
4545
bytes = "1.10.1"
4646
camino = { version = "1.1.3", features = ["serde1"] }
4747
cfg-if = "1.0.0"
48-
chrono = { version = "0.4.41", default-features = false, features = ["std"] }
4948
clap = { version = "4.5.32", features = [
5049
"deprecated",
5150
"derive",

crates/chat-cli/src/cli/chat/conversation_state.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ impl ConversationState {
220220
warn!("input must not be empty when adding new messages");
221221
"Empty prompt".to_string()
222222
} else {
223-
let now = chrono::Utc::now();
224-
let formatted_time = now.format("%Y-%m-%d %H:%M:%S").to_string();
225-
format!("{}\n\n<currentTimeUTC>\n{}\n</currentTimeUTC>", input, formatted_time)
223+
input
226224
};
227225

228226
let msg = UserMessage::new_prompt(input);

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -73,65 +73,13 @@ use hooks::{
7373
Hook,
7474
HookTrigger,
7575
};
76+
use input_source::InputSource;
7677
use message::{
7778
AssistantMessage,
7879
AssistantToolUse,
7980
ToolUseResult,
8081
ToolUseResultBlock,
8182
};
82-
use rand::distr::{
83-
Alphanumeric,
84-
SampleString,
85-
};
86-
use tokio::signal::ctrl_c;
87-
use util::shared_writer::{
88-
NullWriter,
89-
SharedWriter,
90-
};
91-
use util::ui::draw_box;
92-
93-
use crate::api_client::StreamingClient;
94-
use crate::api_client::clients::SendMessageOutput;
95-
use crate::api_client::model::{
96-
ChatResponseStream,
97-
Tool as FigTool,
98-
ToolResultStatus,
99-
};
100-
use crate::database::Database;
101-
use crate::database::settings::Setting;
102-
use crate::platform::Context;
103-
use crate::telemetry::TelemetryThread;
104-
use crate::telemetry::core::ToolUseEventBuilder;
105-
106-
/// Help text for the compact command
107-
fn compact_help_text() -> String {
108-
color_print::cformat!(
109-
r#"
110-
<magenta,em>Conversation Compaction</magenta,em>
111-
112-
The <em>/compact</em> command summarizes the conversation history to free up context space
113-
while preserving essential information. This is useful for long-running conversations
114-
that may eventually reach memory constraints.
115-
116-
<cyan!>Usage</cyan!>
117-
<em>/compact</em> <black!>Summarize the conversation and clear history</black!>
118-
<em>/compact [prompt]</em> <black!>Provide custom guidance for summarization</black!>
119-
120-
<cyan!>When to use</cyan!>
121-
• When you see the memory constraint warning message
122-
• When a conversation has been running for a long time
123-
• Before starting a new topic within the same session
124-
• After completing complex tool operations
125-
126-
<cyan!>How it works</cyan!>
127-
• Creates an AI-generated summary of your conversation
128-
• Retains key information, code, and tool executions in the summary
129-
• Clears the conversation history to free up space
130-
• The assistant will reference the summary context in future responses
131-
"#
132-
)
133-
}
134-
use input_source::InputSource;
13583
use parse::{
13684
ParseState,
13785
interpret_markdown,
@@ -140,6 +88,10 @@ use parser::{
14088
RecvErrorKind,
14189
ResponseParser,
14290
};
91+
use rand::distr::{
92+
Alphanumeric,
93+
SampleString,
94+
};
14395
use regex::Regex;
14496
use serde_json::Map;
14597
use spinners::{
@@ -151,6 +103,7 @@ use token_counter::{
151103
TokenCount,
152104
TokenCounter,
153105
};
106+
use tokio::signal::ctrl_c;
154107
use tool_manager::{
155108
GetPromptError,
156109
McpServerConfig,
@@ -175,6 +128,11 @@ use tracing::{
175128
};
176129
use unicode_width::UnicodeWidthStr;
177130
use util::images::RichImageBlock;
131+
use util::shared_writer::{
132+
NullWriter,
133+
SharedWriter,
134+
};
135+
use util::ui::draw_box;
178136
use util::{
179137
animate_output,
180138
drop_matched_context_files,
@@ -185,10 +143,52 @@ use uuid::Uuid;
185143
use winnow::Partial;
186144
use winnow::stream::Offset;
187145

146+
use crate::api_client::StreamingClient;
147+
use crate::api_client::clients::SendMessageOutput;
148+
use crate::api_client::model::{
149+
ChatResponseStream,
150+
Tool as FigTool,
151+
ToolResultStatus,
152+
};
153+
use crate::database::Database;
154+
use crate::database::settings::Setting;
188155
use crate::mcp_client::{
189156
Prompt,
190157
PromptGetResult,
191158
};
159+
use crate::platform::Context;
160+
use crate::telemetry::TelemetryThread;
161+
use crate::telemetry::core::ToolUseEventBuilder;
162+
use crate::util::CHAT_BINARY_NAME;
163+
164+
/// Help text for the compact command
165+
fn compact_help_text() -> String {
166+
color_print::cformat!(
167+
r#"
168+
<magenta,em>Conversation Compaction</magenta,em>
169+
170+
The <em>/compact</em> command summarizes the conversation history to free up context space
171+
while preserving essential information. This is useful for long-running conversations
172+
that may eventually reach memory constraints.
173+
174+
<cyan!>Usage</cyan!>
175+
<em>/compact</em> <black!>Summarize the conversation and clear history</black!>
176+
<em>/compact [prompt]</em> <black!>Provide custom guidance for summarization</black!>
177+
178+
<cyan!>When to use</cyan!>
179+
• When you see the memory constraint warning message
180+
• When a conversation has been running for a long time
181+
• Before starting a new topic within the same session
182+
• After completing complex tool operations
183+
184+
<cyan!>How it works</cyan!>
185+
• Creates an AI-generated summary of your conversation
186+
• Retains key information, code, and tool executions in the summary
187+
• Clears the conversation history to free up space
188+
• The assistant will reference the summary context in future responses
189+
"#
190+
)
191+
}
192192

193193
const WELCOME_TEXT: &str = color_print::cstr! {"<cyan!>
194194
⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
@@ -317,7 +317,10 @@ pub async fn chat(
317317
trust_tools: Option<Vec<String>>,
318318
) -> Result<ExitCode> {
319319
if !crate::util::system_info::in_cloudshell() && !crate::auth::is_logged_in(database).await {
320-
bail!("You are not logged in, please log in with {}", "q login".bold());
320+
bail!(
321+
"You are not logged in, please log in with {}",
322+
format!("{CHAT_BINARY_NAME} login").bold()
323+
);
321324
}
322325

323326
region_check("chat")?;

crates/chat-cli/src/cli/user.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ impl UserSubcommand {
187187
},
188188
Self::Profile => {
189189
if !crate::util::system_info::in_cloudshell() && !crate::auth::is_logged_in(database).await {
190-
bail!("You are not logged in, please log in with {}", "q login".bold());
190+
bail!(
191+
"You are not logged in, please log in with {}",
192+
format!("{CHAT_BINARY_NAME} login").bold()
193+
);
191194
}
192195

193196
if let Ok(Some(token)) = BuilderIdToken::load(database).await {

0 commit comments

Comments
 (0)