summaryrefslogtreecommitdiffstats
path: root/src/config/session.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-05-22 21:37:24 +0800
committerGitHub <noreply@github.com>2024-05-22 21:37:24 +0800
commit50b13d2de9c5573108f4b1c26306ad674ebb9f80 (patch)
tree2fff9f731f526da449dd50e99663308a71e34fed /src/config/session.rs
parentba3bcfd67c1d6fea5d3d3c5908c975682ee7909b (diff)
downloadaichat-50b13d2de9c5573108f4b1c26306ad674ebb9f80.tar.gz
refactor: rename `function_filter` to `function_matcher` (#535)
Diffstat (limited to 'src/config/session.rs')
-rw-r--r--src/config/session.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/config/session.rs b/src/config/session.rs
index ef1eab1..8f2ac7e 100644
--- a/src/config/session.rs
+++ b/src/config/session.rs
@@ -22,7 +22,7 @@ pub struct Session {
#[serde(skip_serializing_if = "Option::is_none")]
top_p: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
- function_filter: Option<String>,
+ function_matcher: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
save_session: Option<bool>,
messages: Vec<Message>,
@@ -50,7 +50,7 @@ impl Session {
model_id: config.model.id(),
temperature: config.temperature,
top_p: config.top_p,
- function_filter: None,
+ function_matcher: None,
save_session: config.save_session,
messages: Default::default(),
compressed_messages: Default::default(),
@@ -96,8 +96,8 @@ impl Session {
self.top_p
}
- pub fn function_filter(&self) -> Option<&str> {
- self.function_filter.as_deref()
+ pub fn function_matcher(&self) -> Option<&str> {
+ self.function_matcher.as_deref()
}
pub fn save_session(&self) -> Option<bool> {
@@ -134,8 +134,8 @@ impl Session {
if let Some(top_p) = self.top_p() {
data["top_p"] = top_p.into();
}
- if let Some(function_filter) = self.function_filter() {
- data["function_filter"] = function_filter.into();
+ if let Some(function_matcher) = self.function_matcher() {
+ data["function_matcher"] = function_matcher.into();
}
if let Some(save_session) = self.save_session() {
data["save_session"] = save_session.into();
@@ -170,8 +170,8 @@ impl Session {
items.push(("top_p", top_p.to_string()));
}
- if let Some(function_filter) = self.function_filter() {
- items.push(("function_filter", function_filter.into()));
+ if let Some(function_matcher) = self.function_matcher() {
+ items.push(("function_matcher", function_matcher.into()));
}
if let Some(save_session) = self.save_session() {
@@ -247,14 +247,14 @@ impl Session {
}
}
- pub fn set_functions(&mut self, function_filter: Option<&str>) {
- self.function_filter = function_filter.map(|v| v.to_string());
+ pub fn set_function_matcher(&mut self, function_matcher: Option<&str>) {
+ self.function_matcher = function_matcher.map(|v| v.to_string());
}
pub fn set_role_properties(&mut self, role: &Role) {
self.set_temperature(role.temperature);
self.set_top_p(role.top_p);
- self.set_functions(role.function_filter.as_deref());
+ self.set_function_matcher(role.function_matcher.as_deref());
}
pub fn set_save_session(&mut self, value: Option<bool>) {