pub struct ConversationBuffer { /* private fields */ }Expand description
In-memory circular buffer of recent conversation turns.
Implementations§
Source§impl ConversationBuffer
impl ConversationBuffer
Sourcepub fn push_agent(&mut self, response: &str, project_id: Option<Uuid>)
pub fn push_agent(&mut self, response: &str, project_id: Option<Uuid>)
Record an agent response and project context.
Sourcepub fn recent(&self, n: usize) -> Vec<&ConversationTurn>
pub fn recent(&self, n: usize) -> Vec<&ConversationTurn>
Get the most recent N turns.
Sourcepub fn turns(&self) -> VecDeque<ConversationTurn>
pub fn turns(&self) -> VecDeque<ConversationTurn>
Get all turns.
Sourcepub fn should_check_topic(&self, min_turns: usize) -> bool
pub fn should_check_topic(&self, min_turns: usize) -> bool
Check if topic shift detection should run.
Sourcepub fn mark_topic_checked(&mut self)
pub fn mark_topic_checked(&mut self)
Record that a topic check was performed.
Sourcepub fn record_turn(&mut self, min_turns: usize) -> bool
pub fn record_turn(&mut self, min_turns: usize) -> bool
Increment the turn counter and check if topic check should run.
Sourcepub fn pattern_changed(&self) -> bool
pub fn pattern_changed(&self) -> bool
Detect if the conversation pattern has changed.
Trait Implementations§
Source§impl Clone for ConversationBuffer
impl Clone for ConversationBuffer
Source§fn clone(&self) -> ConversationBuffer
fn clone(&self) -> ConversationBuffer
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 moreSource§impl Debug for ConversationBuffer
impl Debug for ConversationBuffer
Auto Trait Implementations§
impl Freeze for ConversationBuffer
impl RefUnwindSafe for ConversationBuffer
impl Send for ConversationBuffer
impl Sync for ConversationBuffer
impl Unpin for ConversationBuffer
impl UnsafeUnpin for ConversationBuffer
impl UnwindSafe for ConversationBuffer
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