Make compaction transitions recoverable
This commit is contained in:
@@ -122,6 +122,7 @@ impl GenerationService {
|
||||
turn: TurnSettings,
|
||||
messages: Vec<ChatTurn>,
|
||||
reason: &str,
|
||||
checkpoint: PathBuf,
|
||||
idle_timeout: Duration,
|
||||
) -> Result<ActiveGeneration, String> {
|
||||
let cancel = Arc::new(AtomicBool::new(false));
|
||||
@@ -132,7 +133,7 @@ impl GenerationService {
|
||||
engine,
|
||||
turn,
|
||||
messages,
|
||||
checkpoint: CheckpointTarget::OneShot(PathBuf::new()),
|
||||
checkpoint: CheckpointTarget::Local(checkpoint),
|
||||
compact_reason: Some(reason.to_owned()),
|
||||
idle_timeout,
|
||||
cancel: Arc::clone(&cancel),
|
||||
@@ -261,10 +262,14 @@ fn run_command(
|
||||
});
|
||||
};
|
||||
if let Some(reason) = &command.compact_reason {
|
||||
let CheckpointTarget::Local(checkpoint) = &command.checkpoint else {
|
||||
unreachable!("compaction checkpoints are local")
|
||||
};
|
||||
let result = generator.compact(
|
||||
&command.messages,
|
||||
&command.turn,
|
||||
reason,
|
||||
checkpoint,
|
||||
&command.cancel,
|
||||
&mut progress,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user