pub struct ChatSession {
pub provider: ProviderType,
pub model: String,
pub project_path: PathBuf,
pub history: Vec<(String, String)>,
pub token_usage: TokenUsage,
}Expand description
Chat session state
Fields§
§provider: ProviderType§model: String§project_path: PathBuf§history: Vec<(String, String)>§token_usage: TokenUsageImplementations§
Source§impl ChatSession
impl ChatSession
pub fn new( project_path: &Path, provider: ProviderType, model: Option<String>, ) -> Self
Sourcepub fn has_api_key(provider: ProviderType) -> bool
pub fn has_api_key(provider: ProviderType) -> bool
Check if API key is configured for a provider (env var OR config file)
Sourcepub fn load_api_key_to_env(provider: ProviderType)
pub fn load_api_key_to_env(provider: ProviderType)
Load API key from config if not in env, and set it in env for use
Sourcepub fn get_configured_providers() -> Vec<ProviderType>
pub fn get_configured_providers() -> Vec<ProviderType>
Get configured providers (those with API keys)
Sourcepub fn prompt_api_key(provider: ProviderType) -> AgentResult<String>
pub fn prompt_api_key(provider: ProviderType) -> AgentResult<String>
Prompt user to enter API key for a provider
Sourcepub fn handle_model_command(&mut self) -> AgentResult<()>
pub fn handle_model_command(&mut self) -> AgentResult<()>
Handle /model command - interactive model selection
Sourcepub fn handle_provider_command(&mut self) -> AgentResult<()>
pub fn handle_provider_command(&mut self) -> AgentResult<()>
Handle /provider command - switch provider with API key prompt if needed
Sourcepub fn print_help()
pub fn print_help()
Handle /help command
Sourcepub fn print_logo()
pub fn print_logo()
Print session banner with colorful SYNCABLE ASCII art
Print the welcome banner
Sourcepub fn process_command(&mut self, input: &str) -> AgentResult<bool>
pub fn process_command(&mut self, input: &str) -> AgentResult<bool>
Process a command (returns true if should continue, false if should exit)
Sourcepub fn is_command(input: &str) -> bool
pub fn is_command(input: &str) -> bool
Check if input is a command
Sourcepub fn read_input(&self) -> Result<String>
pub fn read_input(&self) -> Result<String>
Read user input with prompt - with interactive slash command support
Uses inquire library for proper terminal handling and autocomplete
Auto Trait Implementations§
impl Freeze for ChatSession
impl RefUnwindSafe for ChatSession
impl Send for ChatSession
impl Sync for ChatSession
impl Unpin for ChatSession
impl UnwindSafe for ChatSession
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> 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