pub struct ChatSession {
pub version: u32,
pub name: String,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub context_config: SessionContextConfig,
pub llm_hint: String,
pub messages: Vec<SessionMessage>,
}Fields§
§version: u32§name: String§created_at: DateTime<Utc>§updated_at: DateTime<Utc>§context_config: SessionContextConfig§llm_hint: StringInformational record of which LLM was active when last saved. Never used to select the LLM.
messages: Vec<SessionMessage>Implementations§
Source§impl ChatSession
impl ChatSession
pub fn new(name: &str, context_config: SessionContextConfig) -> Self
pub fn load(sessions_dir: &Path, name: &str) -> Result<Self>
Sourcepub fn save(&mut self, sessions_dir: &Path) -> Result<()>
pub fn save(&mut self, sessions_dir: &Path) -> Result<()>
Atomic save (tmp + rename). Creates sessions_dir if it doesn’t exist.
Sourcepub fn list(sessions_dir: &Path) -> Result<Vec<SessionSummary>>
pub fn list(sessions_dir: &Path) -> Result<Vec<SessionSummary>>
List all sessions in sessions_dir, sorted by updated_at descending.
Sourcepub fn to_messages(&self) -> Vec<Message>
pub fn to_messages(&self) -> Vec<Message>
Convert stored messages to LLM Message format (strips timestamps).
pub fn push_user(&mut self, content: String)
pub fn push_assistant(&mut self, content: String)
Trait Implementations§
Source§impl Clone for ChatSession
impl Clone for ChatSession
Source§fn clone(&self) -> ChatSession
fn clone(&self) -> ChatSession
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 ChatSession
impl Debug for ChatSession
Source§impl<'de> Deserialize<'de> for ChatSession
impl<'de> Deserialize<'de> for ChatSession
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChatSession
impl RefUnwindSafe for ChatSession
impl Send for ChatSession
impl Sync for ChatSession
impl Unpin for ChatSession
impl UnsafeUnpin for ChatSession
impl UnwindSafe for ChatSession
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