Skip to content

Commit 8c180b0

Browse files
committed
small fixes
1 parent aa51981 commit 8c180b0

File tree

6 files changed

+60
-58
lines changed

6 files changed

+60
-58
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
@@ -213,9 +213,7 @@ impl ConversationState {
213213
warn!("input must not be empty when adding new messages");
214214
"Empty prompt".to_string()
215215
} else {
216-
let now = chrono::Utc::now();
217-
let formatted_time = now.format("%Y-%m-%d %H:%M:%S").to_string();
218-
format!("{}\n\n<currentTimeUTC>\n{}\n</currentTimeUTC>", input, formatted_time)
216+
input
219217
};
220218

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

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

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -72,62 +72,13 @@ use hooks::{
7272
Hook,
7373
HookTrigger,
7474
};
75+
use input_source::InputSource;
7576
use message::{
7677
AssistantMessage,
7778
AssistantToolUse,
7879
ToolUseResult,
7980
ToolUseResultBlock,
8081
};
81-
use rand::distr::{
82-
Alphanumeric,
83-
SampleString,
84-
};
85-
use tokio::signal::ctrl_c;
86-
use util::shared_writer::SharedWriter;
87-
use util::ui::draw_box;
88-
89-
use crate::api_client::StreamingClient;
90-
use crate::api_client::clients::SendMessageOutput;
91-
use crate::api_client::model::{
92-
ChatResponseStream,
93-
Tool as FigTool,
94-
ToolResultStatus,
95-
};
96-
use crate::database::Database;
97-
use crate::database::settings::Setting;
98-
use crate::platform::Context;
99-
use crate::telemetry::TelemetryThread;
100-
use crate::telemetry::core::ToolUseEventBuilder;
101-
102-
/// Help text for the compact command
103-
fn compact_help_text() -> String {
104-
color_print::cformat!(
105-
r#"
106-
<magenta,em>Conversation Compaction</magenta,em>
107-
108-
The <em>/compact</em> command summarizes the conversation history to free up context space
109-
while preserving essential information. This is useful for long-running conversations
110-
that may eventually reach memory constraints.
111-
112-
<cyan!>Usage</cyan!>
113-
<em>/compact</em> <black!>Summarize the conversation and clear history</black!>
114-
<em>/compact [prompt]</em> <black!>Provide custom guidance for summarization</black!>
115-
116-
<cyan!>When to use</cyan!>
117-
• When you see the memory constraint warning message
118-
• When a conversation has been running for a long time
119-
• Before starting a new topic within the same session
120-
• After completing complex tool operations
121-
122-
<cyan!>How it works</cyan!>
123-
• Creates an AI-generated summary of your conversation
124-
• Retains key information, code, and tool executions in the summary
125-
• Clears the conversation history to free up space
126-
• The assistant will reference the summary context in future responses
127-
"#
128-
)
129-
}
130-
use input_source::InputSource;
13182
use parse::{
13283
ParseState,
13384
interpret_markdown,
@@ -136,6 +87,10 @@ use parser::{
13687
RecvErrorKind,
13788
ResponseParser,
13889
};
90+
use rand::distr::{
91+
Alphanumeric,
92+
SampleString,
93+
};
13994
use regex::Regex;
14095
use serde_json::Map;
14196
use spinners::{
@@ -147,6 +102,7 @@ use token_counter::{
147102
TokenCount,
148103
TokenCounter,
149104
};
105+
use tokio::signal::ctrl_c;
150106
use tool_manager::{
151107
GetPromptError,
152108
McpServerConfig,
@@ -171,6 +127,8 @@ use tracing::{
171127
};
172128
use unicode_width::UnicodeWidthStr;
173129
use util::images::RichImageBlock;
130+
use util::shared_writer::SharedWriter;
131+
use util::ui::draw_box;
174132
use util::{
175133
animate_output,
176134
drop_matched_context_files,
@@ -181,10 +139,52 @@ use uuid::Uuid;
181139
use winnow::Partial;
182140
use winnow::stream::Offset;
183141

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

189189
const WELCOME_TEXT: &str = color_print::cstr! {"<cyan!>
190190
⢠⣶⣶⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣶⣦⡀⠀
@@ -311,7 +311,10 @@ pub async fn chat(
311311
trust_tools: Option<Vec<String>>,
312312
) -> Result<ExitCode> {
313313
if !crate::util::system_info::in_cloudshell() && !crate::auth::is_logged_in(database).await {
314-
bail!("You are not logged in, please log in with {}", "q login".bold());
314+
bail!(
315+
"You are not logged in, please log in with {}",
316+
format!("{CHAT_BINARY_NAME} login").bold()
317+
);
315318
}
316319

317320
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 {

crates/fig_auth/src/builder_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl DeviceRegistration {
138138
}
139139

140140
/// Loads the OIDC registered client from the secret store, deleting it if it is expired.
141-
pub async fn load_from_secret_store(secret_store: &SecretStore, region: &Region) -> Result<Option<Self>> {
141+
async fn load_from_secret_store(secret_store: &SecretStore, region: &Region) -> Result<Option<Self>> {
142142
let device_registration = secret_store.get(Self::SECRET_KEY).await?;
143143

144144
if let Some(device_registration) = device_registration {

0 commit comments

Comments
 (0)