pub struct ConversationManager { /* private fields */ }Expand description
Manages conversation persistence for a project
Implementations§
Source§impl ConversationManager
impl ConversationManager
Sourcepub fn new(project_dir: impl AsRef<Path>) -> Result<Self>
pub fn new(project_dir: impl AsRef<Path>) -> Result<Self>
Create a new conversation manager for a project directory
Sourcepub fn save_conversation(
&self,
conversation: &ConversationHistory,
) -> Result<()>
pub fn save_conversation( &self, conversation: &ConversationHistory, ) -> Result<()>
Save a conversation to disk
Sourcepub fn save_compaction_archive(
&self,
archive: &CompactionArchive,
) -> Result<PathBuf>
pub fn save_compaction_archive( &self, archive: &CompactionArchive, ) -> Result<PathBuf>
Save the raw messages removed by a compaction. Archives live
outside the hot conversation JSON so /load and /list don’t
parse old transcripts on every startup.
Sourcepub fn load_conversation(&self, id: &str) -> Result<ConversationHistory>
pub fn load_conversation(&self, id: &str) -> Result<ConversationHistory>
Load a specific conversation by ID
Sourcepub fn load_last_conversation(&self) -> Result<Option<ConversationHistory>>
pub fn load_last_conversation(&self) -> Result<Option<ConversationHistory>>
Load the most recent conversation.
Picks the newest file by filesystem mtime, then deserializes only
that one file. Much cheaper than list_conversations() (which
reads and parses every file) in directories with many sessions.
Sourcepub fn list_conversations(&self) -> Result<Vec<ConversationHistory>>
pub fn list_conversations(&self) -> Result<Vec<ConversationHistory>>
List all conversations in the project
Sourcepub fn delete_conversation(&self, id: &str) -> Result<()>
pub fn delete_conversation(&self, id: &str) -> Result<()>
Delete a conversation
Sourcepub fn conversations_dir(&self) -> &Path
pub fn conversations_dir(&self) -> &Path
Get the conversations directory path
pub fn compactions_dir(&self) -> &Path
Trait Implementations§
Source§impl Clone for ConversationManager
impl Clone for ConversationManager
Source§fn clone(&self) -> ConversationManager
fn clone(&self) -> ConversationManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConversationManager
impl RefUnwindSafe for ConversationManager
impl Send for ConversationManager
impl Sync for ConversationManager
impl Unpin for ConversationManager
impl UnsafeUnpin for ConversationManager
impl UnwindSafe for ConversationManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more