mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-24 05:36:28 +00:00
Format
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
@ -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!({
|
||||
|
@ -57,13 +57,13 @@ impl From<ChatConfig> 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<ChatSettings> 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<ChatSettings> for ChatConfig {
|
||||
None => SearchParameters::default(),
|
||||
};
|
||||
|
||||
ChatConfig {
|
||||
description,
|
||||
prompt,
|
||||
search_parameters,
|
||||
}
|
||||
ChatConfig { description, prompt, search_parameters }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1305,10 +1305,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
||||
fn update_chat_config(&mut self) -> Result<bool> {
|
||||
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user