summaryrefslogtreecommitdiffstats
path: root/src/config/session.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-07-05 19:49:08 +0800
committerGitHub <noreply@github.com>2024-07-05 19:49:08 +0800
commit8b0c648a73dc812b0fd22a60a2975de57b7dd02c (patch)
tree01900adb730ef2bb6326c4db4dd6def6d91a8866 /src/config/session.rs
parent6a56af270ef0d98fe2fd689e58b7b833c257bfe9 (diff)
downloadaichat-8b0c648a73dc812b0fd22a60a2975de57b7dd02c.tar.gz
feat: enhenced flexibility for use tools (#688)
Diffstat (limited to 'src/config/session.rs')
-rw-r--r--src/config/session.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/config/session.rs b/src/config/session.rs
index 9aa4ca4..80629c1 100644
--- a/src/config/session.rs
+++ b/src/config/session.rs
@@ -21,7 +21,7 @@ pub struct Session {
#[serde(skip_serializing_if = "Option::is_none")]
top_p: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
- functions_filter: Option<FunctionsFilter>,
+ use_tools: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
save_session: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -134,8 +134,8 @@ impl Session {
if let Some(top_p) = self.top_p() {
data["top_p"] = top_p.into();
}
- if let Some(functions_filter) = self.functions_filter() {
- data["functions_filter"] = functions_filter.into();
+ if let Some(use_tools) = self.use_tools() {
+ data["use_tools"] = use_tools.into();
}
if let Some(save_session) = self.save_session() {
data["save_session"] = save_session.into();
@@ -171,8 +171,8 @@ impl Session {
items.push(("top_p", top_p.to_string()));
}
- if let Some(functions_filter) = self.functions_filter() {
- items.push(("functions_filter", functions_filter));
+ if let Some(use_tools) = self.use_tools() {
+ items.push(("use_tools", use_tools));
}
if let Some(save_session) = self.save_session() {
@@ -242,7 +242,7 @@ impl Session {
self.model_id = role.model().id();
self.temperature = role.temperature();
self.top_p = role.top_p();
- self.functions_filter = role.functions_filter();
+ self.use_tools = role.use_tools();
self.model = role.model().clone();
self.role_name = role.name().to_string();
self.role_prompt = role.prompt().to_string();
@@ -345,7 +345,7 @@ impl Session {
pub fn guard_empty(&self) -> Result<()> {
if !self.is_empty() {
- bail!("Cannot perform this action in a session with messages")
+ bail!("This action cannot be performed in a session with messages.")
}
Ok(())
}
@@ -442,8 +442,8 @@ impl RoleLike for Session {
self.top_p
}
- fn functions_filter(&self) -> Option<FunctionsFilter> {
- self.functions_filter.clone()
+ fn use_tools(&self) -> Option<String> {
+ self.use_tools.clone()
}
fn set_model(&mut self, model: &Model) {
@@ -468,9 +468,9 @@ impl RoleLike for Session {
}
}
- fn set_functions_filter(&mut self, value: Option<FunctionsFilter>) {
- if self.functions_filter != value {
- self.functions_filter = value;
+ fn set_use_tools(&mut self, value: Option<String>) {
+ if self.use_tools != value {
+ self.use_tools = value;
self.dirty = true;
}
}