Revert "Standardize Session Name Attribute" (#5250)
This commit is contained in:
@@ -75,7 +75,7 @@ async fn get_session_id(identifier: Identifier) -> Result<String> {
|
||||
|
||||
sessions
|
||||
.into_iter()
|
||||
.find(|s| s.name == name || s.id == name)
|
||||
.find(|s| s.id == name || s.description.contains(&name))
|
||||
.map(|s| s.id)
|
||||
.ok_or_else(|| anyhow::anyhow!("No session found with name '{}'", name))
|
||||
} else if let Some(path) = identifier.path {
|
||||
|
||||
@@ -222,7 +222,7 @@ pub async fn handle_schedule_sessions(id: String, limit: Option<usize>) -> Resul
|
||||
" - Session ID: {}, Working Dir: {}, Description: \"{}\", Schedule ID: {:?}",
|
||||
session_name, // Display the session_name as Session ID
|
||||
metadata.working_dir.display(),
|
||||
metadata.name,
|
||||
metadata.description,
|
||||
metadata.schedule_id.as_deref().unwrap_or("N/A")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const TRUNCATED_DESC_LENGTH: usize = 60;
|
||||
pub async fn remove_sessions(sessions: Vec<Session>) -> Result<()> {
|
||||
println!("The following sessions will be removed:");
|
||||
for session in &sessions {
|
||||
println!("- {} {}", session.id, session.name);
|
||||
println!("- {} {}", session.id, session.description);
|
||||
}
|
||||
|
||||
let should_delete = confirm("Are you sure you want to delete these sessions?")
|
||||
@@ -45,10 +45,10 @@ fn prompt_interactive_session_removal(sessions: &[Session]) -> Result<Vec<Sessio
|
||||
let display_map: std::collections::HashMap<String, Session> = sessions
|
||||
.iter()
|
||||
.map(|s| {
|
||||
let desc = if s.name.is_empty() {
|
||||
"(no name)"
|
||||
let desc = if s.description.is_empty() {
|
||||
"(no description)"
|
||||
} else {
|
||||
&s.name
|
||||
&s.description
|
||||
};
|
||||
let truncated_desc = safe_truncate(desc, TRUNCATED_DESC_LENGTH);
|
||||
let display_text = format!("{} - {} ({})", s.updated_at, truncated_desc, s.id);
|
||||
@@ -154,7 +154,10 @@ pub async fn handle_session_list(
|
||||
|
||||
println!("Available sessions:");
|
||||
for session in sessions {
|
||||
let output = format!("{} - {} - {}", session.id, session.name, session.updated_at);
|
||||
let output = format!(
|
||||
"{} - {} - {}",
|
||||
session.id, session.description, session.updated_at
|
||||
);
|
||||
println!("{}", output);
|
||||
}
|
||||
}
|
||||
@@ -185,7 +188,7 @@ pub async fn handle_session_export(
|
||||
let conversation = session
|
||||
.conversation
|
||||
.ok_or_else(|| anyhow::anyhow!("Session has no messages"))?;
|
||||
export_session_to_markdown(conversation.messages().to_vec(), &session.name)
|
||||
export_session_to_markdown(conversation.messages().to_vec(), &session.description)
|
||||
}
|
||||
_ => return Err(anyhow::anyhow!("Unsupported format: {}", format)),
|
||||
};
|
||||
@@ -290,10 +293,10 @@ pub async fn prompt_interactive_session_selection() -> Result<String> {
|
||||
let display_map: std::collections::HashMap<String, Session> = sessions
|
||||
.iter()
|
||||
.map(|s| {
|
||||
let desc = if s.name.is_empty() {
|
||||
"(no name)"
|
||||
let desc = if s.description.is_empty() {
|
||||
"(no description)"
|
||||
} else {
|
||||
&s.name
|
||||
&s.description
|
||||
};
|
||||
let truncated_desc = safe_truncate(desc, TRUNCATED_DESC_LENGTH);
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ async fn list_sessions() -> Json<serde_json::Value> {
|
||||
session_info.push(serde_json::json!({
|
||||
"name": session.id,
|
||||
"path": session.id,
|
||||
"description": session.name,
|
||||
"description": session.description,
|
||||
"message_count": session.message_count,
|
||||
"working_dir": session.working_dir
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user