pub struct SessionManager { /* private fields */ }
Expand description
Session manager for handling multiple sessions
Implementations§
Source§impl SessionManager
impl SessionManager
pub fn new(storage: Box<dyn Storage>) -> Self
Sourcepub async fn create_session(&mut self) -> Result<Session>
pub async fn create_session(&mut self) -> Result<Session>
Create a new session
Sourcepub async fn list_sessions(&self) -> Result<Vec<SessionInfo>>
pub async fn list_sessions(&self) -> Result<Vec<SessionInfo>>
List all sessions
Sourcepub async fn add_message(
&mut self,
session_id: &str,
role: MessageRole,
content: String,
) -> Result<Message>
pub async fn add_message( &mut self, session_id: &str, role: MessageRole, content: String, ) -> Result<Message>
Add a message to a session
Sourcepub async fn continue_last_session(&mut self) -> Result<Option<Session>>
pub async fn continue_last_session(&mut self) -> Result<Option<Session>>
Continue the last session
Auto Trait Implementations§
impl Freeze for SessionManager
impl !RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl !UnwindSafe for SessionManager
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