From 1916787bdd54f2de9023e67b4801f59e74d4df4a Mon Sep 17 00:00:00 2001 From: Mubelotix Date: Mon, 28 Jul 2025 12:53:04 +0200 Subject: [PATCH] Format --- crates/meilisearch/tests/common/index.rs | 8 ++----- crates/meilisearch/tests/settings/chat.rs | 8 ++++--- crates/milli/src/update/chat.rs | 26 +++++++++-------------- crates/milli/src/update/settings.rs | 5 +---- 4 files changed, 18 insertions(+), 29 deletions(-) diff --git a/crates/meilisearch/tests/common/index.rs b/crates/meilisearch/tests/common/index.rs index bddc94d84..18947d557 100644 --- a/crates/meilisearch/tests/common/index.rs +++ b/crates/meilisearch/tests/common/index.rs @@ -174,12 +174,8 @@ impl<'a> Index<'a, Owned> { self._update_settings(settings).await } - pub async fn update_settings_chat( - &self, - settings: Value, - ) -> (Value, StatusCode) { - let url = - format!("/indexes/{}/settings/chat", urlencode(self.uid.as_ref())); + pub async fn update_settings_chat(&self, settings: Value) -> (Value, StatusCode) { + let url = format!("/indexes/{}/settings/chat", urlencode(self.uid.as_ref())); self.service.put_encoded(url, settings, self.encoder).await } diff --git a/crates/meilisearch/tests/settings/chat.rs b/crates/meilisearch/tests/settings/chat.rs index 261443228..d970d7664 100644 --- a/crates/meilisearch/tests/settings/chat.rs +++ b/crates/meilisearch/tests/settings/chat.rs @@ -7,9 +7,11 @@ async fn set_reset_chat_issue_5772() { let server = Server::new().await; let index = server.unique_index(); - let (_, code) = server.set_features(json!({ - "chatCompletions": true, - })).await; + let (_, code) = server + .set_features(json!({ + "chatCompletions": true, + })) + .await; snapshot!(code, @r#"200 OK"#); let (task1, _code) = index.update_settings_chat(json!({ diff --git a/crates/milli/src/update/chat.rs b/crates/milli/src/update/chat.rs index 9955b5422..45c4de866 100644 --- a/crates/milli/src/update/chat.rs +++ b/crates/milli/src/update/chat.rs @@ -57,13 +57,13 @@ impl From for ChatSettings { ranking_score_threshold, } = search_parameters; - if hybrid.is_none() && - limit.is_none() && - sort.is_none() && - distinct.is_none() && - matching_strategy.is_none() && - attributes_to_search_on.is_none() && - ranking_score_threshold.is_none() + if hybrid.is_none() + && limit.is_none() + && sort.is_none() + && distinct.is_none() + && matching_strategy.is_none() + && attributes_to_search_on.is_none() + && ranking_score_threshold.is_none() { None } else { @@ -94,10 +94,8 @@ impl From for ChatConfig { search_parameters, } = settings; - let prompt = PromptData { - template: document_template, - max_bytes: document_template_max_bytes, - }; + let prompt = + PromptData { template: document_template, max_bytes: document_template_max_bytes }; let search_parameters = match search_parameters { Some(params) => SearchParameters { @@ -115,11 +113,7 @@ impl From for ChatConfig { None => SearchParameters::default(), }; - ChatConfig { - description, - prompt, - search_parameters, - } + ChatConfig { description, prompt, search_parameters } } } diff --git a/crates/milli/src/update/settings.rs b/crates/milli/src/update/settings.rs index 50e83555f..860feee6b 100644 --- a/crates/milli/src/update/settings.rs +++ b/crates/milli/src/update/settings.rs @@ -1305,10 +1305,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> { fn update_chat_config(&mut self) -> Result { match &mut self.chat { Setting::Set(settings) => { - self.index.put_chat_config( - self.wtxn, - &settings.clone().into(), - )?; + self.index.put_chat_config(self.wtxn, &settings.clone().into())?; Ok(true) }