Skip to content

Commit d45446c

Browse files
committed
merge current
1 parent afd0ac1 commit d45446c

File tree

2 files changed

+23
-47
lines changed

2 files changed

+23
-47
lines changed

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

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub struct ChatArgs {
191191
/// Context profile to use
192192
#[arg(long = "profile")]
193193
pub profile: Option<String>,
194-
/// Current model to use
194+
/// Current model to use
195195
#[arg(long = "model")]
196196
pub model: Option<String>,
197197
/// Allows the model to use any tool to run commands without asking for confirmation.
@@ -278,51 +278,27 @@ impl ChatArgs {
278278
}
279279
}
280280

281-
// If modelId is specified, verify it exists before starting the chat
282-
let model_id: Option<String> = if let Some(model_name) = model_name {
283-
let model_name_lower = model_name.to_lowercase();
284-
match MODEL_OPTIONS.iter().find(|(_, name, _)| name == &model_name_lower) {
285-
Some((_, _, id)) => Some(id.to_string()),
286-
None => {
287-
let available_names: Vec<&str> = MODEL_OPTIONS.iter().map(|(_, name, _)| *name).collect();
288-
bail!(
289-
"Model '{}' does not exist. Available models: {}",
290-
model_name,
291-
available_names.join(", ")
292-
);
293-
},
294-
}
295-
} else {
296-
None
297-
};
281+
// If modelId is specified, verify it exists before starting the chat
282+
let model_id: Option<String> = if let Some(model_name) = model_name {
283+
let model_name_lower = model_name.to_lowercase();
284+
match MODEL_OPTIONS.iter().find(|(_, name, _)| name == &model_name_lower) {
285+
Some((_, _, id)) => Some(id.to_string()),
286+
None => {
287+
let available_names: Vec<&str> = MODEL_OPTIONS.iter().map(|(_, name, _)| *name).collect();
288+
bail!(
289+
"Model '{}' does not exist. Available models: {}",
290+
model_name,
291+
available_names.join(", ")
292+
);
293+
},
294+
}
295+
} else {
296+
None
297+
};
298298

299-
// if let Some(ref id) = model_id {
300-
// database.set_last_used_model_id(id.clone())?;
301-
// }
302-
let conversation_id = Alphanumeric.sample_string(&mut rand::rng(), 9);
303-
info!(?conversation_id, "Generated new conversation id");
304-
let (prompt_request_sender, prompt_request_receiver) = std::sync::mpsc::channel::<Option<String>>();
305-
let (prompt_response_sender, prompt_response_receiver) = std::sync::mpsc::channel::<Vec<String>>();
306-
let tool_manager_output: Box<dyn Write + Send + Sync + 'static> = if interactive {
307-
Box::new(output.clone())
308-
} else {
309-
Box::new(NullWriter {})
310-
};
311-
let mut tool_manager = ToolManagerBuilder::default()
312-
.mcp_server_config(mcp_server_configs)
313-
.prompt_list_sender(prompt_response_sender)
314-
.prompt_list_receiver(prompt_request_receiver)
315-
.conversation_id(&conversation_id)
316-
.interactive(interactive)
317-
.build(telemetry, tool_manager_output)
318-
.await?;
319-
let tool_config = tool_manager.load_tools(database, &mut output).await?;
320-
let mut tool_permissions = ToolPermissions::new(tool_config.len());
321-
if accept_all || trust_all_tools {
322-
tool_permissions.trust_all = true;
323-
for tool in tool_config.values() {
324-
tool_permissions.trust_tool(&tool.name);
325-
}
299+
// if let Some(ref id) = model_id {
300+
// database.set_last_used_model_id(id.clone())?;
301+
// }
326302
let conversation_id = Alphanumeric.sample_string(&mut rand::rng(), 9);
327303
info!(?conversation_id, "Generated new conversation id");
328304
let (prompt_request_sender, prompt_request_receiver) = std::sync::mpsc::channel::<Option<String>>();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ use crate::api_client::Client as CodewhispererClient;
5555
use crate::auth::builder_id::get_start_url_and_region;
5656
use crate::aws_common::app_name;
5757
use crate::cli::{
58-
RootSubcommand,
5958
DEFAULT_MODEL_ID,
60-
MODEL_OPTIONS
59+
MODEL_OPTIONS,
60+
RootSubcommand,
6161
};
6262
use crate::database::settings::Setting;
6363
use crate::database::{

0 commit comments

Comments
 (0)