feat: add test_load and test_parse binaries for configuration loading and parsing
This commit is contained in:
@@ -112,18 +112,21 @@ pub async fn chat_completions_handler(
|
||||
// When the requested model matches the shared client we reuse it to
|
||||
// avoid allocating a new HTTP connection. Otherwise we create a
|
||||
// temporary LlmClient with the requested model — the ownership
|
||||
// lives on the stack via `temp_client`.
|
||||
#[allow(unused_assignments)]
|
||||
let mut temp_client: Option<zesdex_infrastructure::llm::LlmClient> = None;
|
||||
// lives on the stack via a match binding.
|
||||
//
|
||||
// We use an uninitialized let-binding for `temp_client` so the
|
||||
// compiler can see it's assigned at most once, avoiding
|
||||
// `#[allow(unused_assignments)]`.
|
||||
let temp_client;
|
||||
let llm_client = if model == state.llm_client.model {
|
||||
&state.llm_client
|
||||
} else {
|
||||
temp_client = Some(zesdex_infrastructure::llm::LlmClient::new(
|
||||
temp_client = zesdex_infrastructure::llm::LlmClient::new(
|
||||
state.llm_client.api_key.clone(),
|
||||
model,
|
||||
Some(state.llm_client.base_url.clone()),
|
||||
));
|
||||
temp_client.as_ref().unwrap()
|
||||
);
|
||||
&temp_client
|
||||
};
|
||||
|
||||
let (response, usage) = llm_client
|
||||
|
||||
Reference in New Issue
Block a user