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 get_conn_public(
&self,
) -> Result<PooledConnection<SqliteConnectionManager>>
pub fn get_conn_public( &self, ) -> Result<PooledConnection<SqliteConnectionManager>>
Public connection accessor for cross-module queries (e.g., search_api)
Sourcepub fn store_message_with_tx(
&self,
tx: &mut Connection,
params: MessageParams<'_>,
) -> Result<StoredMessage>
pub fn store_message_with_tx( &self, tx: &mut Connection, params: MessageParams<'_>, ) -> 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>
Sourcepub fn create_session_with_id(
&self,
session_id: &str,
metadata: Option<SessionMetadata>,
) -> Result<Session>
pub fn create_session_with_id( &self, session_id: &str, metadata: Option<SessionMetadata>, ) -> Result<Session>
Chat persistence: Create session with frontend-provided ID to maintain ID consistency across frontend and backend
Sourcepub fn update_session_title(&self, session_id: &str, title: &str) -> Result<()>
pub fn update_session_title(&self, session_id: &str, title: &str) -> Result<()>
Chat persistence: Update session title after auto-generation, also refresh last_accessed. Handles the race condition where title update arrives before the session is created by the streaming endpoint, using INSERT OR IGNORE to avoid UNIQUE constraint failures.
pub fn update_session_pinned( &self, session_id: &str, pinned: bool, ) -> Result<()>
pub fn get_session(&self, session_id: &str) -> Result<Option<Session>>
Sourcepub fn get_all_sessions(&self) -> Result<Vec<Session>>
pub fn get_all_sessions(&self) -> Result<Vec<Session>>
Chat persistence: Retrieve all sessions for sidebar display, ordered by recency
pub fn get_session_messages( &self, session_id: &str, limit: Option<i32>, offset: Option<i32>, ) -> Result<Vec<StoredMessage>>
pub fn get_session_message_count(&self, session_id: &str) -> Result<usize>
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 UnsafeUnpin 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
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>
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>
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