File tree Expand file tree Collapse file tree
crates/contribai-rs/src/llm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -594,7 +594,9 @@ impl OpenAIProvider {
594594 let base_url = config
595595 . base_url
596596 . clone ( )
597- . unwrap_or_else ( || "https://api.openai.com/v1" . to_string ( ) ) ;
597+ . unwrap_or_else ( || "https://api.openai.com/v1" . to_string ( ) )
598+ . trim_end_matches ( '/' )
599+ . to_string ( ) ;
598600
599601 info ! ( model = %config. model, base_url = %base_url, "OpenAI provider" ) ;
600602
@@ -711,7 +713,9 @@ impl AnthropicProvider {
711713 let base_url = config
712714 . base_url
713715 . clone ( )
714- . unwrap_or_else ( || "https://api.anthropic.com/v1" . to_string ( ) ) ;
716+ . unwrap_or_else ( || "https://api.anthropic.com/v1" . to_string ( ) )
717+ . trim_end_matches ( '/' )
718+ . to_string ( ) ;
715719
716720 info ! ( model = %config. model, base_url = %base_url, "Anthropic provider" ) ;
717721
@@ -768,7 +772,7 @@ impl LlmProvider for AnthropicProvider {
768772
769773 let response = self
770774 . client
771- . post ( self . base_url . to_string ( ) + " /messages")
775+ . post ( format ! ( "{} /messages", self . base_url ) )
772776 . header ( "x-api-key" , & self . api_key )
773777 . header ( "anthropic-version" , "2023-06-01" )
774778 . header ( "content-type" , "application/json" )
You can’t perform that action at this time.
0 commit comments