@@ -327,7 +327,7 @@ async fn handle_oauth_configuration(provider_name: &str, key_name: &str) -> anyh
327327 ) ) ;
328328
329329 // Create a temporary provider instance to handle OAuth
330- let temp_model = ModelConfig :: new ( "temp" , provider_name ) ? ;
330+ let temp_model = ModelConfig :: new ( "temp" ) ? . with_canonical_limits ( provider_name ) ;
331331 match create ( provider_name, temp_model) . await {
332332 Ok ( provider) => match provider. configure_oauth ( ) . await {
333333 Ok ( _) => {
@@ -682,7 +682,8 @@ pub async fn configure_provider_dialog() -> anyhow::Result<bool> {
682682 let spin = spinner ( ) ;
683683 spin. start ( "Attempting to fetch supported models..." ) ;
684684 let models_res = {
685- let temp_model_config = ModelConfig :: new ( & provider_meta. default_model , provider_name) ?;
685+ let temp_model_config =
686+ ModelConfig :: new ( & provider_meta. default_model ) ?. with_canonical_limits ( provider_name) ;
686687 let temp_provider = create ( provider_name, temp_model_config) . await ?;
687688 retry_operation ( & RetryConfig :: default ( ) , || async {
688689 temp_provider. fetch_recommended_models ( ) . await
@@ -1442,7 +1443,7 @@ pub async fn configure_tool_permissions_dialog() -> anyhow::Result<()> {
14421443 let model: String = config
14431444 . get_goose_model ( )
14441445 . expect ( "No model configured. Please set model first" ) ;
1445- let model_config = ModelConfig :: new ( & model, & provider_name) ? ;
1446+ let model_config = ModelConfig :: new ( & model) ? . with_canonical_limits ( & provider_name) ;
14461447
14471448 let agent = Agent :: new ( ) ;
14481449 let new_provider = create ( & provider_name, model_config) . await ?;
@@ -1658,8 +1659,8 @@ pub async fn handle_openrouter_auth() -> anyhow::Result<()> {
16581659 // Test configuration - get the model that was configured
16591660 println ! ( "\n Testing configuration..." ) ;
16601661 let configured_model: String = config. get_goose_model ( ) ?;
1661- let model_config = match goose:: model:: ModelConfig :: new ( & configured_model, "openrouter" ) {
1662- Ok ( config) => config,
1662+ let model_config = match goose:: model:: ModelConfig :: new ( & configured_model) {
1663+ Ok ( config) => config. with_canonical_limits ( "openrouter" ) ,
16631664 Err ( e) => {
16641665 eprintln ! ( "⚠️ Invalid model configuration: {}" , e) ;
16651666 eprintln ! ( "Your settings have been saved. Please check your model configuration." ) ;
@@ -1738,8 +1739,8 @@ pub async fn handle_tetrate_auth() -> anyhow::Result<()> {
17381739 // Test configuration
17391740 println ! ( "\n Testing configuration..." ) ;
17401741 let configured_model: String = config. get_goose_model ( ) ?;
1741- let model_config = match goose:: model:: ModelConfig :: new ( & configured_model, "tetrate" ) {
1742- Ok ( config) => config,
1742+ let model_config = match goose:: model:: ModelConfig :: new ( & configured_model) {
1743+ Ok ( config) => config. with_canonical_limits ( "tetrate" ) ,
17431744 Err ( e) => {
17441745 eprintln ! ( "⚠️ Invalid model configuration: {}" , e) ;
17451746 eprintln ! ( "Your settings have been saved. Please check your model configuration." ) ;
0 commit comments