Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions crates/goose-cli/src/commands/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,7 @@ goose_preexec() {{
}}

autoload -Uz add-zsh-hook
add-zsh-hook preexec goose_preexec

if [[ -z "$GOOSE_PROMPT_INSTALLED" ]]; then
export GOOSE_PROMPT_INSTALLED=1
PROMPT='%F{{cyan}}🪿%f '$PROMPT
fi{command_not_found_handler}"#,
add-zsh-hook preexec goose_preexec{command_not_found_handler}"#,
command_not_found: Some(
r#"

Expand Down Expand Up @@ -268,9 +263,10 @@ pub async fn handle_term_info() -> Result<()> {
let session = SessionManager::get_session(&session_id, false).await.ok();
let total_tokens = session.as_ref().and_then(|s| s.total_tokens).unwrap_or(0) as usize;

let model_name = session
.as_ref()
.and_then(|s| s.model_config.as_ref().map(|mc| mc.model_name.clone()))
let config = goose::config::Config::global();
let model_name = config
.get_goose_model()
.ok()
.map(|name| {
let short = name.rsplit('/').next().unwrap_or(&name);
if let Some(stripped) = short.strip_prefix("goose-") {
Expand All @@ -281,9 +277,11 @@ pub async fn handle_term_info() -> Result<()> {
})
.unwrap_or_else(|| "?".to_string());

let context_limit = session
.as_ref()
.and_then(|s| s.model_config.as_ref().map(|mc| mc.context_limit()))
let context_limit = config
.get_goose_model()
.ok()
.and_then(|model_name| goose::model::ModelConfig::new(&model_name).ok())
.map(|mc| mc.context_limit())
.unwrap_or(128_000);

let percentage = if context_limit > 0 {
Expand Down
Loading