pub struct CommandContext {
pub chat_view: Arc<Mutex<ChatView>>,
pub session_manager: Arc<Mutex<SessionManager>>,
pub session_id: String,
pub state: Arc<Mutex<TuiState>>,
pub messages: Arc<Mutex<Vec<Message>>>,
pub total_input_tokens: Arc<Mutex<u64>>,
pub total_output_tokens: Arc<Mutex<u64>>,
pub clipboard: Option<Arc<Mutex<ClipboardManager>>>,
}Expand description
Context provided to commands for execution
Fields§
§chat_view: Arc<Mutex<ChatView>>Chat view for displaying messages
session_manager: Arc<Mutex<SessionManager>>Session manager for session operations
session_id: StringCurrent session ID
state: Arc<Mutex<TuiState>>Current TUI state
messages: Arc<Mutex<Vec<Message>>>Conversation messages (LLM format)
total_input_tokens: Arc<Mutex<u64>>Total input tokens
total_output_tokens: Arc<Mutex<u64>>Total output tokens
clipboard: Option<Arc<Mutex<ClipboardManager>>>Clipboard manager (optional)
Implementations§
Source§impl CommandContext
impl CommandContext
Sourcepub fn new(
chat_view: Arc<Mutex<ChatView>>,
session_manager: Arc<Mutex<SessionManager>>,
session_id: String,
state: Arc<Mutex<TuiState>>,
messages: Arc<Mutex<Vec<Message>>>,
total_input_tokens: Arc<Mutex<u64>>,
total_output_tokens: Arc<Mutex<u64>>,
clipboard: Option<Arc<Mutex<ClipboardManager>>>,
) -> Self
pub fn new( chat_view: Arc<Mutex<ChatView>>, session_manager: Arc<Mutex<SessionManager>>, session_id: String, state: Arc<Mutex<TuiState>>, messages: Arc<Mutex<Vec<Message>>>, total_input_tokens: Arc<Mutex<u64>>, total_output_tokens: Arc<Mutex<u64>>, clipboard: Option<Arc<Mutex<ClipboardManager>>>, ) -> Self
Create a new command context
Sourcepub fn add_system_message(&self, text: String)
pub fn add_system_message(&self, text: String)
Add a system message to the chat
Sourcepub fn add_user_message(&self, text: String)
pub fn add_user_message(&self, text: String)
Add a user message to the chat
Sourcepub fn clear_chat(&self)
pub fn clear_chat(&self)
Clear the chat view
Auto Trait Implementations§
impl Freeze for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnsafeUnpin for CommandContext
impl UnwindSafe for CommandContext
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