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:
@@ -22,6 +22,18 @@ pub(crate) struct ActiveGeneration {
|
||||
pub(crate) enum CheckpointTarget {
|
||||
Local(PathBuf),
|
||||
Transient(PathBuf),
|
||||
/// Same transient KV handling as [`CheckpointTarget::Transient`], but asked
|
||||
/// for by the app itself (session titling) rather than by an HTTP client.
|
||||
OneShot(PathBuf),
|
||||
}
|
||||
|
||||
impl CheckpointTarget {
|
||||
fn source(&self) -> WorkSource {
|
||||
match self {
|
||||
Self::Local(_) | Self::OneShot(_) => WorkSource::LocalChat,
|
||||
Self::Transient(_) => WorkSource::Http,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) enum GenerationEvent {
|
||||
@@ -67,10 +79,7 @@ impl GenerationService {
|
||||
checkpoint: CheckpointTarget,
|
||||
idle_timeout: Duration,
|
||||
) -> Result<ActiveGeneration, String> {
|
||||
let source = match &checkpoint {
|
||||
CheckpointTarget::Local(_) => WorkSource::LocalChat,
|
||||
CheckpointTarget::Transient(_) => WorkSource::Http,
|
||||
};
|
||||
let source = checkpoint.source();
|
||||
let cancel = Arc::new(AtomicBool::new(false));
|
||||
let (events, receiver) = mpsc::channel();
|
||||
self.metrics.request_queued(source);
|
||||
@@ -105,10 +114,7 @@ fn run(commands: Receiver<Command>, metrics: Arc<Metrics>) {
|
||||
match commands.recv_timeout(Duration::from_secs(1)) {
|
||||
Ok(command) => {
|
||||
let request_started = Instant::now();
|
||||
let source = match &command.checkpoint {
|
||||
CheckpointTarget::Local(_) => WorkSource::LocalChat,
|
||||
CheckpointTarget::Transient(_) => WorkSource::Http,
|
||||
};
|
||||
let source = command.checkpoint.source();
|
||||
metrics.request_started(source);
|
||||
idle_timeout = command.idle_timeout;
|
||||
if loaded
|
||||
@@ -176,7 +182,8 @@ fn run(commands: Receiver<Command>, metrics: Arc<Metrics>) {
|
||||
&mut emit,
|
||||
&mut progress,
|
||||
),
|
||||
CheckpointTarget::Transient(directory) => generator.generate_transient(
|
||||
CheckpointTarget::Transient(directory)
|
||||
| CheckpointTarget::OneShot(directory) => generator.generate_transient(
|
||||
&directory,
|
||||
&command.messages,
|
||||
&command.turn,
|
||||
|
||||
Reference in New Issue
Block a user