Add quick actions to sessions
Rename, AI retitle, pin and archive, reached from the "..." button on every session row and in the chat header. Sessions carry one lifecycle state (normal, pinned, archived) rather than independent flags, so the sidebar groups them without an unrepresentable pinned-and-archived case. The AI retitle runs as a one-shot against the transient KV cache through a new CheckpointTarget::OneShot, leaving no session or checkpoint behind while still reporting as local work in the metrics. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,6 +138,27 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::database::{Project, Session};
|
||||
|
||||
#[test]
|
||||
fn session_states_are_exclusive_and_ordered() {
|
||||
assert_eq!(SessionState::from_id("pinned"), Some(SessionState::Pinned));
|
||||
assert_eq!(SessionState::from_id("nonsense"), None);
|
||||
assert_eq!(SessionState::default(), SessionState::Normal);
|
||||
let mut ranks = [
|
||||
SessionState::Archived,
|
||||
SessionState::Normal,
|
||||
SessionState::Pinned,
|
||||
];
|
||||
ranks.sort_by_key(|state| state.rank());
|
||||
assert_eq!(
|
||||
ranks,
|
||||
[
|
||||
SessionState::Pinned,
|
||||
SessionState::Normal,
|
||||
SessionState::Archived
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn draft_titles_follow_the_stored_session_count() {
|
||||
let projects = vec![
|
||||
@@ -164,13 +185,11 @@ mod tests {
|
||||
}
|
||||
|
||||
fn session(id: i32, project_id: i32) -> Session {
|
||||
Session {
|
||||
Session::fixture(
|
||||
id,
|
||||
project_id,
|
||||
title: format!("Session {id}"),
|
||||
context_used: 0,
|
||||
context_limit: 0,
|
||||
last_tokens_per_second: None,
|
||||
}
|
||||
&format!("Session {id}"),
|
||||
SessionState::Normal,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user