pub struct Session {
pub file_path: PathBuf,
pub root: PathBuf,
pub view_path: PathBuf,
pub view: SessionView,
pub store: HistoryStore,
pub context_content: HashMap<String, String>,
pub history: HashMap<usize, MessageWithContext>,
}Fields§
§file_path: PathBuf§root: PathBuf§view_path: PathBuf§view: SessionView§store: HistoryStore§context_content: HashMap<String, String>§history: HashMap<usize, MessageWithContext>Implementations§
Source§impl Session
impl Session
Sourcepub fn load_active() -> Result<Self, AicoError>
pub fn load_active() -> Result<Self, AicoError>
Loads the session from the environment or current working directory.
Sourcepub fn load(session_file: PathBuf) -> Result<Self, AicoError>
pub fn load(session_file: PathBuf) -> Result<Self, AicoError>
Loads a session from a specific pointer file path.
pub fn save_view(&self) -> Result<(), AicoError>
pub fn sessions_dir(&self) -> PathBuf
pub fn get_view_path(&self, name: &str) -> PathBuf
pub fn switch_to_view(&self, new_view_path: &Path) -> Result<(), AicoError>
pub fn num_pairs(&self) -> usize
pub fn resolve_pair_index(&self, index_str: &str) -> Result<usize, AicoError>
pub fn resolve_indices( &self, indices: &[String], ) -> Result<Vec<usize>, AicoError>
pub fn resolve_pair_index_internal( &self, index_str: &str, allow_past_end: bool, ) -> Result<usize, AicoError>
pub fn edit_message( &mut self, message_index: usize, new_content: String, ) -> Result<(), AicoError>
pub fn compute_derived_content(&self, content: &str) -> Option<DerivedContent>
pub fn summarize_active_window( &self, history_vec: &[MessageWithContext], ) -> Result<Option<ActiveWindowSummary>, AicoError>
pub fn get_context_files(&self) -> Vec<String>
pub fn warn_missing_files(&self)
pub fn fetch_pair( &self, index: usize, ) -> Result<(HistoryRecord, HistoryRecord, usize, usize), AicoError>
pub fn append_record_to_view( &mut self, record: HistoryRecord, ) -> Result<(), AicoError>
pub fn append_pair( &mut self, user_record: HistoryRecord, assistant_record: HistoryRecord, ) -> Result<(), AicoError>
pub fn resolve_context_state( &self, history: &[MessageWithContext], ) -> Result<ContextState<'_>, AicoError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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