Skip to content

Commit 2edb500

Browse files
authored
fix: remove prompt change, read model from config (#5976)
1 parent 5d53643 commit 2edb500

File tree

1 file changed

+10
-12
lines changed
  • crates/goose-cli/src/commands

1 file changed

+10
-12
lines changed

crates/goose-cli/src/commands/term.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,7 @@ goose_preexec() {{
7272
}}
7373
7474
autoload -Uz add-zsh-hook
75-
add-zsh-hook preexec goose_preexec
76-
77-
if [[ -z "$GOOSE_PROMPT_INSTALLED" ]]; then
78-
export GOOSE_PROMPT_INSTALLED=1
79-
PROMPT='%F{{cyan}}🪿%f '$PROMPT
80-
fi{command_not_found_handler}"#,
75+
add-zsh-hook preexec goose_preexec{command_not_found_handler}"#,
8176
command_not_found: Some(
8277
r#"
8378
@@ -268,9 +263,10 @@ pub async fn handle_term_info() -> Result<()> {
268263
let session = SessionManager::get_session(&session_id, false).await.ok();
269264
let total_tokens = session.as_ref().and_then(|s| s.total_tokens).unwrap_or(0) as usize;
270265

271-
let model_name = session
272-
.as_ref()
273-
.and_then(|s| s.model_config.as_ref().map(|mc| mc.model_name.clone()))
266+
let config = goose::config::Config::global();
267+
let model_name = config
268+
.get_goose_model()
269+
.ok()
274270
.map(|name| {
275271
let short = name.rsplit('/').next().unwrap_or(&name);
276272
if let Some(stripped) = short.strip_prefix("goose-") {
@@ -281,9 +277,11 @@ pub async fn handle_term_info() -> Result<()> {
281277
})
282278
.unwrap_or_else(|| "?".to_string());
283279

284-
let context_limit = session
285-
.as_ref()
286-
.and_then(|s| s.model_config.as_ref().map(|mc| mc.context_limit()))
280+
let context_limit = config
281+
.get_goose_model()
282+
.ok()
283+
.and_then(|model_name| goose::model::ModelConfig::new(&model_name).ok())
284+
.map(|mc| mc.context_limit())
287285
.unwrap_or(128_000);
288286

289287
let percentage = if context_limit > 0 {

0 commit comments

Comments
 (0)