pub struct AISession {
pub id: SessionId,
pub config: SessionConfig,
pub status: RwLock<SessionStatus>,
pub context: Arc<RwLock<SessionContext>>,
pub created_at: DateTime<Utc>,
pub last_activity: Arc<RwLock<DateTime<Utc>>>,
pub metadata: Arc<RwLock<HashMap<String, Value>>>,
/* private fields */
}
Expand description
AI-optimized session
Fields§
§id: SessionId
Unique session ID
config: SessionConfig
Session configuration
status: RwLock<SessionStatus>
Current status
context: Arc<RwLock<SessionContext>>
Session context (AI state, history, etc.)
created_at: DateTime<Utc>
Creation time
last_activity: Arc<RwLock<DateTime<Utc>>>
Last activity time
metadata: Arc<RwLock<HashMap<String, Value>>>
Session metadata
Implementations§
Source§impl AISession
impl AISession
Sourcepub async fn new(config: SessionConfig) -> Result<Self>
pub async fn new(config: SessionConfig) -> Result<Self>
Create a new AI session
Sourcepub async fn new_with_id(
id: SessionId,
config: SessionConfig,
created_at: DateTime<Utc>,
) -> Result<Self>
pub async fn new_with_id( id: SessionId, config: SessionConfig, created_at: DateTime<Utc>, ) -> Result<Self>
Create an AI session with a specific ID (for restoration)
Sourcepub async fn send_input(&self, input: &str) -> Result<()>
pub async fn send_input(&self, input: &str) -> Result<()>
Send input to the session
Sourcepub async fn read_output(&self) -> Result<Vec<u8>>
pub async fn read_output(&self) -> Result<Vec<u8>>
Read output from the session
Sourcepub async fn status(&self) -> SessionStatus
pub async fn status(&self) -> SessionStatus
Get current session status
Sourcepub async fn set_metadata(&self, key: String, value: Value) -> Result<()>
pub async fn set_metadata(&self, key: String, value: Value) -> Result<()>
Update session metadata
Sourcepub async fn get_metadata(&self, key: &str) -> Option<Value>
pub async fn get_metadata(&self, key: &str) -> Option<Value>
Get session metadata
Source§impl AISession
impl AISession
Sourcepub async fn get_ai_context(&self) -> Result<SessionContext>
pub async fn get_ai_context(&self) -> Result<SessionContext>
Get AI context
Auto Trait Implementations§
impl !Freeze for AISession
impl !RefUnwindSafe for AISession
impl Send for AISession
impl Sync for AISession
impl Unpin for AISession
impl !UnwindSafe for AISession
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.