Skip to content

Commit d37d99c

Browse files
authored
feat: no longer support .variable repl command (#1092)
1 parent ca714b2 commit d37d99c

File tree

3 files changed

+1
-65
lines changed

3 files changed

+1
-65
lines changed

src/config/agent.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -272,27 +272,6 @@ impl Agent {
272272
self.session_variables = Some(session_variables);
273273
}
274274

275-
pub fn set_variable(&mut self, key: &str, value: &str) -> Result<()> {
276-
let variables = match self.session_variables.as_mut() {
277-
Some(v) => v,
278-
None => &mut self.shared_variables,
279-
};
280-
let Some(old_value) = variables.get(key) else {
281-
bail!("Unknown variable '{key}'")
282-
};
283-
if old_value == value {
284-
return Ok(());
285-
}
286-
variables.insert(key.to_string(), value.to_string());
287-
if self.session_variables.is_some() {
288-
self.update_session_dynamic_instructions(None)?;
289-
} else {
290-
self.update_shared_dynamic_instructions(true)?;
291-
}
292-
293-
Ok(())
294-
}
295-
296275
pub fn defined_variables(&self) -> &[AgentVariable] {
297276
&self.definition.variables
298277
}

src/config/mod.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,28 +1503,6 @@ impl Config {
15031503
}
15041504
}
15051505

1506-
pub fn set_agent_variable(&mut self, data: &str) -> Result<()> {
1507-
let parts: Vec<&str> = data.split_whitespace().collect();
1508-
if parts.len() != 2 {
1509-
bail!("Usage: .variable <key> <value>");
1510-
}
1511-
match self.agent.as_mut() {
1512-
Some(agent) => {
1513-
if let Some(session) = self.session.as_ref() {
1514-
session.guard_empty()?;
1515-
}
1516-
let key = parts[0];
1517-
let value = parts[1];
1518-
agent.set_variable(key, value)?;
1519-
if let Some(session) = self.session.as_mut() {
1520-
session.sync_agent(agent);
1521-
}
1522-
}
1523-
None => bail!("No agent"),
1524-
};
1525-
Ok(())
1526-
}
1527-
15281506
pub fn exit_agent(&mut self) -> Result<()> {
15291507
self.exit_session()?;
15301508
if self.agent.take().is_some() {
@@ -1741,14 +1719,6 @@ impl Config {
17411719
Some(agent) => map_completion_values(agent.conversation_staters().to_vec()),
17421720
None => vec![],
17431721
},
1744-
".variable" => match &self.agent {
1745-
Some(agent) => agent
1746-
.defined_variables()
1747-
.iter()
1748-
.map(|v| (v.name.clone(), Some(v.description.clone())))
1749-
.collect(),
1750-
None => vec![],
1751-
},
17521722
".set" => {
17531723
let mut values = vec![
17541724
"temperature",

src/repl/mod.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::{env, process};
2929
const MENU_NAME: &str = "completion_menu";
3030

3131
lazy_static::lazy_static! {
32-
static ref REPL_COMMANDS: [ReplCommand; 35] = [
32+
static ref REPL_COMMANDS: [ReplCommand; 34] = [
3333
ReplCommand::new(".help", "Show this help message", AssertState::pass()),
3434
ReplCommand::new(".info", "View system info", AssertState::pass()),
3535
ReplCommand::new(".model", "Change the current LLM", AssertState::pass()),
@@ -104,11 +104,6 @@ lazy_static::lazy_static! {
104104
"Use the conversation starter",
105105
AssertState::True(StateFlags::AGENT)
106106
),
107-
ReplCommand::new(
108-
".variable",
109-
"Set agent variable",
110-
AssertState::TrueFalse(StateFlags::AGENT, StateFlags::SESSION)
111-
),
112107
ReplCommand::new(
113108
".info agent",
114109
"View agent info",
@@ -464,14 +459,6 @@ pub async fn run_repl_command(
464459
config.read().print_markdown(&banner)?;
465460
}
466461
},
467-
".variable" => match args {
468-
Some(args) => {
469-
config.write().set_agent_variable(args)?;
470-
}
471-
_ => {
472-
println!("Usage: .variable <key> <value>")
473-
}
474-
},
475462
".save" => match split_first_arg(args) {
476463
Some(("role", name)) => {
477464
config.write().save_role(name)?;

0 commit comments

Comments
 (0)