mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
fix clippy
This commit is contained in:
parent
48d058ce5c
commit
00afcb7307
1 changed files with 7 additions and 10 deletions
|
|
@ -777,22 +777,19 @@ impl StreamContext {
|
|||
|
||||
fn check_intent_matched(model_server_response: &ChatCompletionsResponse) -> bool {
|
||||
let content = model_server_response
|
||||
.choices
|
||||
.get(0)
|
||||
.choices.first()
|
||||
.and_then(|choice| choice.message.content.as_ref());
|
||||
|
||||
let content_has_value = content.is_some() && !content.unwrap().is_empty();
|
||||
|
||||
let tool_calls = model_server_response
|
||||
.choices
|
||||
.get(0)
|
||||
.choices.first()
|
||||
.and_then(|choice| choice.message.tool_calls.as_ref());
|
||||
|
||||
// intent was matched if content has some value or tool_calls is empty
|
||||
let intent_matched =
|
||||
content_has_value || (tool_calls.is_some() && !tool_calls.unwrap().is_empty());
|
||||
|
||||
return intent_matched;
|
||||
|
||||
content_has_value || (tool_calls.is_some() && !tool_calls.unwrap().is_empty())
|
||||
}
|
||||
|
||||
impl Client for StreamContext {
|
||||
|
|
@ -832,7 +829,7 @@ mod test {
|
|||
metadata: None,
|
||||
};
|
||||
|
||||
assert_eq!(check_intent_matched(&model_server_response), false);
|
||||
assert!(!check_intent_matched(&model_server_response));
|
||||
|
||||
let model_server_response = ChatCompletionsResponse {
|
||||
choices: vec![Choice {
|
||||
|
|
@ -851,7 +848,7 @@ mod test {
|
|||
metadata: None,
|
||||
};
|
||||
|
||||
assert_eq!(check_intent_matched(&model_server_response), true);
|
||||
assert!(check_intent_matched(&model_server_response));
|
||||
|
||||
let model_server_response = ChatCompletionsResponse {
|
||||
choices: vec![Choice {
|
||||
|
|
@ -877,6 +874,6 @@ mod test {
|
|||
metadata: None,
|
||||
};
|
||||
|
||||
assert_eq!(check_intent_matched(&model_server_response), true);
|
||||
assert!(check_intent_matched(&model_server_response));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue