pub struct ConversationStore { /* private fields */ }Expand description
Manages conversation storage and retrieval using a connection pool
Implementations§
Source§impl ConversationStore
impl ConversationStore
Sourcepub fn new(pool: Arc<Pool<SqliteConnectionManager>>) -> Self
pub fn new(pool: Arc<Pool<SqliteConnectionManager>>) -> Self
Create a new conversation store with a shared connection pool
Sourcepub fn store_message_with_tx(
&self,
tx: &mut Connection,
session_id: &str,
role: &str,
content: &str,
message_index: i32,
tokens: i32,
importance_score: f32,
) -> Result<StoredMessage>
pub fn store_message_with_tx( &self, tx: &mut Connection, session_id: &str, role: &str, content: &str, message_index: i32, tokens: i32, importance_score: f32, ) -> Result<StoredMessage>
Store a message using an external transaction
Sourcepub fn store_messages_batch(
&self,
session_id: &str,
messages: &[(String, String, i32, i32, f32)],
) -> Result<Vec<StoredMessage>>
pub fn store_messages_batch( &self, session_id: &str, messages: &[(String, String, i32, i32, f32)], ) -> Result<Vec<StoredMessage>>
Store multiple messages in batch
Sourcepub fn store_details_batch(
&self,
details: &[(&str, i64, &str, &str, &str, f32)],
) -> Result<()>
pub fn store_details_batch( &self, details: &[(&str, i64, &str, &str, &str, f32)], ) -> Result<()>
Store details in batch
pub fn create_session( &self, metadata: Option<SessionMetadata>, ) -> Result<Session>
pub fn create_session_with_id( &self, session_id: Option<String>, metadata: Option<SessionMetadata>, ) -> Result<Session>
pub fn get_session(&self, session_id: &str) -> Result<Option<Session>>
pub fn get_session_messages( &self, session_id: &str, limit: Option<i32>, offset: Option<i32>, ) -> Result<Vec<StoredMessage>>
pub fn mark_embedding_generated(&self, message_id: i64) -> Result<()>
pub fn delete_session(&self, session_id: &str) -> Result<usize>
Sourcepub async fn search_messages_by_keywords(
&self,
session_id: &str,
keywords: &[String],
limit: usize,
) -> Result<Vec<StoredMessage>>
pub async fn search_messages_by_keywords( &self, session_id: &str, keywords: &[String], limit: usize, ) -> Result<Vec<StoredMessage>>
Search messages by keywords
Sourcepub async fn search_messages_by_topic_across_sessions(
&self,
topic_keywords: &[String],
limit: usize,
session_id_filter: Option<&str>,
) -> Result<Vec<StoredMessage>>
pub async fn search_messages_by_topic_across_sessions( &self, topic_keywords: &[String], limit: usize, session_id_filter: Option<&str>, ) -> Result<Vec<StoredMessage>>
Search messages by topic keywords across sessions
Auto Trait Implementations§
impl Freeze for ConversationStore
impl !RefUnwindSafe for ConversationStore
impl Send for ConversationStore
impl Sync for ConversationStore
impl Unpin for ConversationStore
impl !UnwindSafe for ConversationStore
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> 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