mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-06 20:25:40 +00:00
Make clippy happy
This commit is contained in:
parent
d5d30ed4f2
commit
9af1a29949
@ -214,7 +214,7 @@ impl IndexScheduler {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
run_loop_iteration: self.run_loop_iteration.clone(),
|
run_loop_iteration: self.run_loop_iteration.clone(),
|
||||||
features: self.features.clone(),
|
features: self.features.clone(),
|
||||||
chat_settings: self.chat_settings.clone(),
|
chat_settings: self.chat_settings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,12 +877,12 @@ impl IndexScheduler {
|
|||||||
|
|
||||||
pub fn chat_settings(&self) -> Result<Option<serde_json::Value>> {
|
pub fn chat_settings(&self) -> Result<Option<serde_json::Value>> {
|
||||||
let rtxn = self.env.read_txn().map_err(Error::HeedTransaction)?;
|
let rtxn = self.env.read_txn().map_err(Error::HeedTransaction)?;
|
||||||
self.chat_settings.get(&rtxn, &"main").map_err(Into::into)
|
self.chat_settings.get(&rtxn, "main").map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn put_chat_settings(&self, settings: &serde_json::Value) -> Result<()> {
|
pub fn put_chat_settings(&self, settings: &serde_json::Value) -> Result<()> {
|
||||||
let mut wtxn = self.env.write_txn().map_err(Error::HeedTransaction)?;
|
let mut wtxn = self.env.write_txn().map_err(Error::HeedTransaction)?;
|
||||||
self.chat_settings.put(&mut wtxn, &"main", &settings)?;
|
self.chat_settings.put(&mut wtxn, "main", settings)?;
|
||||||
wtxn.commit().map_err(Error::HeedTransaction)?;
|
wtxn.commit().map_err(Error::HeedTransaction)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -276,10 +276,10 @@ async fn streamed_chat(
|
|||||||
match result {
|
match result {
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
let delta = &resp.choices[0].delta;
|
let delta = &resp.choices[0].delta;
|
||||||
|
#[allow(deprecated)]
|
||||||
let ChatCompletionStreamResponseDelta {
|
let ChatCompletionStreamResponseDelta {
|
||||||
content,
|
content,
|
||||||
// Using deprecated field but keeping for compatibility
|
// Using deprecated field but keeping for compatibility
|
||||||
#[allow(deprecated)]
|
|
||||||
function_call: _,
|
function_call: _,
|
||||||
ref tool_calls,
|
ref tool_calls,
|
||||||
role: _,
|
role: _,
|
||||||
@ -291,7 +291,7 @@ async fn streamed_chat(
|
|||||||
break 'main;
|
break 'main;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(_) = content {
|
if content.is_some() {
|
||||||
tx.send(Event::Data(sse::Data::new_json(&resp).unwrap())).await.unwrap()
|
tx.send(Event::Data(sse::Data::new_json(&resp).unwrap())).await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,8 +321,8 @@ async fn streamed_chat(
|
|||||||
|
|
||||||
let (meili_calls, _other_calls): (Vec<_>, Vec<_>) =
|
let (meili_calls, _other_calls): (Vec<_>, Vec<_>) =
|
||||||
mem::take(&mut global_tool_calls)
|
mem::take(&mut global_tool_calls)
|
||||||
.into_iter()
|
.into_values()
|
||||||
.map(|(_, call)| ChatCompletionMessageToolCall {
|
.map(|call| ChatCompletionMessageToolCall {
|
||||||
id: call.id,
|
id: call.id,
|
||||||
r#type: ChatCompletionToolType::Function,
|
r#type: ChatCompletionToolType::Function,
|
||||||
function: FunctionCall {
|
function: FunctionCall {
|
||||||
@ -342,7 +342,7 @@ async fn streamed_chat(
|
|||||||
|
|
||||||
for call in meili_calls {
|
for call in meili_calls {
|
||||||
tx.send(Event::Data(
|
tx.send(Event::Data(
|
||||||
sse::Data::new_json(&json!({
|
sse::Data::new_json(json!({
|
||||||
"object": "chat.completion.tool.call",
|
"object": "chat.completion.tool.call",
|
||||||
"tool": call,
|
"tool": call,
|
||||||
}))
|
}))
|
||||||
@ -380,7 +380,7 @@ async fn streamed_chat(
|
|||||||
);
|
);
|
||||||
|
|
||||||
tx.send(Event::Data(
|
tx.send(Event::Data(
|
||||||
sse::Data::new_json(&json!({
|
sse::Data::new_json(json!({
|
||||||
"object": "chat.completion.tool.output",
|
"object": "chat.completion.tool.output",
|
||||||
"tool": ChatCompletionRequestMessage::Tool(
|
"tool": ChatCompletionRequestMessage::Tool(
|
||||||
ChatCompletionRequestToolMessage {
|
ChatCompletionRequestToolMessage {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user