pub struct App {Show 17 fields
pub state: AppState,
pub messages: Vec<String>,
pub logs: Vec<String>,
pub available_models: Vec<ModelConfig>,
pub error_message: Option<String>,
pub last_query_time: Instant,
pub use_agent: bool,
pub agent: Option<Agent>,
pub tokio_runtime: Option<Runtime>,
pub api_key: Option<String>,
pub current_working_dir: Option<String>,
pub tasks: Vec<Task>,
pub current_task_id: Option<String>,
pub conversation_summaries: Vec<ConversationSummary>,
pub session_manager: Option<SessionManager>,
pub session_id: String,
pub tool_executions: HashMap<String, ToolExecution>,
}
Expand description
Main backend application state
Fields§
§state: AppState
§messages: Vec<String>
§logs: Vec<String>
§available_models: Vec<ModelConfig>
§error_message: Option<String>
§last_query_time: Instant
§use_agent: bool
§agent: Option<Agent>
§tokio_runtime: Option<Runtime>
§api_key: Option<String>
§current_working_dir: Option<String>
§tasks: Vec<Task>
§current_task_id: Option<String>
§conversation_summaries: Vec<ConversationSummary>
§session_manager: Option<SessionManager>
§session_id: String
§tool_executions: HashMap<String, ToolExecution>
Implementations§
Source§impl App
impl App
Sourcepub fn current_model(&self, index: usize) -> Result<&ModelConfig>
pub fn current_model(&self, index: usize) -> Result<&ModelConfig>
Get the current model configuration
Sourcepub fn query_model(&mut self, prompt: &str) -> Result<String>
pub fn query_model(&mut self, prompt: &str) -> Result<String>
Query the model with the given prompt
Sourcepub fn has_active_tasks(&self) -> bool
pub fn has_active_tasks(&self) -> bool
Check if there are any active tasks
Sourcepub fn get_task_statuses(&self) -> Vec<Value>
pub fn get_task_statuses(&self) -> Vec<Value>
Get the task statuses for all tasks
Sourcepub fn create_task(&mut self, description: &str) -> String
pub fn create_task(&mut self, description: &str) -> String
Create a new task and set it as current
Sourcepub fn current_task(&self) -> Option<&Task>
pub fn current_task(&self) -> Option<&Task>
Get the current task if any
Sourcepub fn current_task_mut(&mut self) -> Option<&mut Task>
pub fn current_task_mut(&mut self) -> Option<&mut Task>
Get the current task as mutable if any
Sourcepub fn add_tool_use(&mut self)
pub fn add_tool_use(&mut self)
Add a tool use to the current task
Sourcepub fn add_input_tokens(&mut self, tokens: u32)
pub fn add_input_tokens(&mut self, tokens: u32)
Add input tokens to the current task
Sourcepub fn complete_current_task(&mut self, tokens: u32)
pub fn complete_current_task(&mut self, tokens: u32)
Complete the current task
Sourcepub fn fail_current_task(&mut self, error: &str)
pub fn fail_current_task(&mut self, error: &str)
Mark the current task as failed
Sourcepub fn start_tool_execution(&mut self, name: &str) -> Option<String>
pub fn start_tool_execution(&mut self, name: &str) -> Option<String>
Start a new tool execution
Sourcepub fn update_tool_progress(
&mut self,
tool_id: &str,
message: &str,
metadata: Option<HashMap<String, Value>>,
)
pub fn update_tool_progress( &mut self, tool_id: &str, message: &str, metadata: Option<HashMap<String, Value>>, )
Update tool execution progress
Sourcepub fn complete_tool_execution(
&mut self,
tool_id: &str,
message: &str,
metadata: Option<HashMap<String, Value>>,
)
pub fn complete_tool_execution( &mut self, tool_id: &str, message: &str, metadata: Option<HashMap<String, Value>>, )
Complete a tool execution
Sourcepub fn fail_tool_execution(&mut self, tool_id: &str, error: &str)
pub fn fail_tool_execution(&mut self, tool_id: &str, error: &str)
Mark a tool execution as failed
Sourcepub fn cleanup_old_tool_executions(&mut self)
pub fn cleanup_old_tool_executions(&mut self)
Clean up old completed tool executions (older than 10 minutes)
Trait Implementations§
Source§impl ContextCompressor for App
impl ContextCompressor for App
Source§fn compress_context(&mut self) -> Result<()>
fn compress_context(&mut self) -> Result<()>
Generate a summary of the conversation history
Source§fn should_compress(&self) -> bool
fn should_compress(&self) -> bool
Check if conversation should be summarized based on thresholds
Source§fn conversation_char_count(&self) -> usize
fn conversation_char_count(&self) -> usize
Get the total character count of conversation history
Source§fn summary_count(&self) -> usize
fn summary_count(&self) -> usize
Get summaries count
Source§fn clear_history(&mut self)
fn clear_history(&mut self)
Clear all summaries and history
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl !UnwindSafe for App
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> 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