pub struct Conversation {
pub session_uuid: String,
pub project_path: Option<String>,
pub main: ChatFile,
pub sub_agents: Vec<ChatFile>,
pub started_at: Option<DateTime<Utc>>,
pub last_activity: Option<DateTime<Utc>>,
}Expand description
A fully-loaded session: the main chat plus every sub-agent file in the same session UUID directory.
Fields§
§session_uuid: StringSession UUID from the directory name (not the inner sessionId).
project_path: Option<String>§main: ChatFileThe main chat file (the one without kind: "subagent"). If the
directory only contains sub-agent files, the first one is used.
sub_agents: Vec<ChatFile>Sub-agent chat files found alongside the main chat.
started_at: Option<DateTime<Utc>>§last_activity: Option<DateTime<Utc>>Implementations§
Source§impl Conversation
impl Conversation
pub fn new(session_uuid: String, main: ChatFile) -> Self
Sourcepub fn messages(&self) -> &[GeminiMessage]
pub fn messages(&self) -> &[GeminiMessage]
Messages in the main chat, in file order.
Sourcepub fn total_message_count(&self) -> usize
pub fn total_message_count(&self) -> usize
Total message count across main chat and sub-agent chats.
Sourcepub fn first_user_text(&self) -> Option<String>
pub fn first_user_text(&self) -> Option<String>
First user-message text from the main chat (untruncated).
Sourcepub fn title(&self, max_len: usize) -> Option<String>
pub fn title(&self, max_len: usize) -> Option<String>
Text of the first user message, truncated to max_len characters.
Sourcepub fn all_messages(&self) -> impl Iterator<Item = &GeminiMessage>
pub fn all_messages(&self) -> impl Iterator<Item = &GeminiMessage>
Iterate all messages (main + sub-agents) in document order.
Sourcepub fn sub_agent_by_session_id(&self, session_id: &str) -> Option<&ChatFile>
pub fn sub_agent_by_session_id(&self, session_id: &str) -> Option<&ChatFile>
Find the sub-agent chat whose inner sessionId matches.
Trait Implementations§
Source§impl Clone for Conversation
impl Clone for Conversation
Source§fn clone(&self) -> Conversation
fn clone(&self) -> Conversation
Returns a duplicate of the value. Read more
1.0.0 · 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 Conversation
impl Debug for Conversation
Source§impl<'de> Deserialize<'de> for Conversation
impl<'de> Deserialize<'de> for Conversation
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 Conversation
impl RefUnwindSafe for Conversation
impl Send for Conversation
impl Sync for Conversation
impl Unpin for Conversation
impl UnsafeUnpin for Conversation
impl UnwindSafe for Conversation
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